Network settings - linux

how can change my pc settings in linux so that my network cannot recognise my previous mac address and thinks that is a new pc that connects to network via wifi. I ask this because something went wrong and cannot connect because my pc is blocked from this network

To change your MAC address on Linux (or OSX), use the command ifconfig :
ifconfig [interface name] hw ether [new MAC address]
Example:
ifconfig eth0 hw ether 01:02:03:04:05:06

Related

Debian guest on VirtualBox with bridged adapter has no internet access

I have setup a Debian guest and I am messing around with it to learn more about VirtualBox, Debian, and later after that is done I'll be messing around with a NodeJS server on it.
After a while I noticed I couldn't do some things with it when I had a Bridged adapter setup for the VM. NPM would not install packages because it timed out. I tried running "w3m google.com" and even looked up google.com's ip to check for a DNS issue.
No matter what, I cannot connect to any form of internet. But I can ping anything just fine. I can ping google, npmjs.org, etc.
Thanks for the assistance.
Update: I have been working on this more today, Newer router, asus, I read that people were having issues with belkin routers with bridged adapters so I switched, the asus is new anyways.
The host is connected via ethernet wire.
The VM shows up on the router just fine, And I connect to that device with the IP given by the router just fine. but I still cannot connect to google.com or anything.
This is too long to explain in a comment. Below is how the bridged adapter works.
Yet, if you can ping from the guest debian that means some form of DHCP happened and you must have and IP (which is a different IP from the host machine). I'd check router configuration to see if you're not allowing/disallowing specific MACs and/or IPs from the usage of TCP/UDP protocols (that is a measure some people use on their routers).
Bridged adapter
A bridged adapter on VirtualBox simulates as if there was a bridge (well it is easier to think of this as a hub) on the cable connection to your (host) actual machine. Even if the connection is over wireless the simulation is similar.
For (almost) all purposes the guest (debian) and the router the host machine is connected to are connected directly. Have separate MAC, separate IP, they even give separate ARP requests.
router <---> host machine running VirtualBox
^
|
+-----> guest machine running Debian
This is done by sending packets with a different hardware address (you can configure the hardware address in the adapter).
You need to configure the guest system (Debian) to connect to the network as if it was a separate machine. For example, if you use a WPA connection from the host machine you need to configure WPA (including the username and password) in the guest machine.
I am not an expert, but after some research I could solve a similar problem. I have a Mac hosting a Debian server. I used Bridged Adapter on interface en0 in my Mac.
1) My Mac is running on 192.168.10.101. I know that because I run the command:
ifconfig -a
and the interface en0 shows that IP
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 6c:40:08:98:72:4c
inet6 fe80::6e40:8ff:fe98:724c%en0 prefixlen 64 scopeid 0x4
inet 192.168.10.101 netmask 0xffffff00 broadcast 192.168.10.255
2) Running netstat command at my Mac:
netstat -nr
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.10.1 UGSc 296 142 en0
I see that the Mac Gateway is on 192.168.10.1
3) Mac and Debian must be in the same segment as the Gateway, I mean 192.168.10.xxx. So I decided that my Debian must run on the static IP 192.168.10.115.
I edited /etc/network/interfaces file at my Debian server to look this way:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.10.115
netmask 255.255.255.0
gateway 192.168.10.1
dns-nameservers 8.8.8.8 192.168.10.1
Then I did ping from my Mac and ping from my Debian and they answered Ok. I also have access to internet from Debian, because I have the same Default Gateway as my Mac.
root#debian64:/home/myuser# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default TEW-711BR 0.0.0.0 UG 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
I hope it helps and if anybody have better explanations I would like to learn.

How can I use udhcpd to start a dhcp server on more than one nic?

I have a machine which running embedded Linux system, kernel version 2.6.37. It has a Wifi device and about 3 ethernets.
Now I want to start a dhcp server on this machine and then let is looks like a router. I hope each device connect to this machine via wifi/eth could dhcp to get ip and join in this LAN. These devices will have the same subnet and also could ping each other.
I try to use udhcpd to start the dhcp server. I write the udhcpd.conf as the following:
start 192.168.3.2
end 192.168.3.20
interface wlan0 eth0 eth1 eth2
But when I run "udhcpd udhcpd.conf -f", error occurred:
udhcpd (v1.20.1) started
udhcpd: max_leases=235 is too big, setting to 19
udhcpd: can't open '/var/lib/misc/udhcpd.leases': No such file or directory
udhcpd: is interface wlan0 eth0 eth1 eth2 up and configured?: No such device
I checked the documents for udhcpd of busybox, but I can't find any information to talk about this situation.
You should bridge all interfaces to a bridge, then run udhcpcd on the bridge interface.
There is a guide on how to setup bridge
https://wiki.archlinux.org/index.php/Network_bridge

scan and connect to wifi from linux terminal on virtual machine

I am trying to scan wifi networks via Linux terminal running on a virtual machine. I am running virtual machine on Mac OS. On MAC terminal, I can see all WIFI networks using (airport) command and can connect to one network.
The NetworkAdapter setting for Vistual machine is set to "Share with MAC".
On Linux terminal, When I do ifconfig -a, I get
eth0 & lo
However, when I type : sudo iwlist eht0 scan , I get error message:
sudo iwlist eht0 scan
Can someone help that how I can do that with Linux running on virtual machine ? ? What I am doing wrong . .
On every VM I've ever seen, the virtual machine emulates the WiFi interface of the host OS (Mac) as an ordinary wired interface to the guest OS (Linux). Therefore you can't scan for WiFi networks from the Linux, because as far as it's concerned, it's not a WiFi interface.
The exception to this would be if you attached a USB WiFi adapter and had the guest OS natively recognize it as a USB device (meaning it would be ignored by the host OS). Note this may not work on some virtual machines; VirtualBox is particuarly bad at recongizing network adapters.
well if you:
nmcli dev wifi
it will show you all the wireless access points (ESSID) available then you can
nmcli dev wifi connect $ESSID password $PASSWORD
example
nmcli dev wifi connect "School Hotspot" password "q5w4e3r2t1y0"
That kinda thang :-)

multicast traffic fails with virtualbox host only network

I have an application where it sends some multicast request to the multicast group ,
If I test my Client and Server application on two separate PC which are in same subnet it works fine .
Since I can not run always on two PCs during testing of my application, I thought of using the virtualbox to run the another OS to run my server application .
My Host is ubuntu , I installed the vitrtualbox to run the another guest os linux , and since my traffic only has to be with in the HOST and Guest , I have selected a "host only network type" .
My guest OS get the IP address but when I run my server application, It fails to join to the multicast group says
"No Such Device" .
Can someone help me to set up a network between the Guest and HOST OS ..
My main goal is to send a multicast request and it should reach the guest OS.
In VM:
ls /sys/class/net - get net devices. (lo, eth0, eth1...). You should have one lo and two eth devices.
sudo nano /etc/network/interfaces. At eth0 there is a NAT connection. Lo is a localhost. We should set the Host-Only connection. Add the following:
# The host-only network interface
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0
network 192.168.56.0
broadcast 192.168.56.255
(Address is taken from ipconfig/ifconfig output in host system. Instead eth1 you can have another connection name, taken from the step 4.b.i)
For checking the edited file, run:
sudo service network-manager restart
Check if you have all three connections running. Check Host-Only addresses.
ifconfig
Reboot
sudo reboot

Configuring ethernet or wifi inernet on centos

How do i configure ethernet or wifi on laptop, i followed this tutorial and my ethernet started properly and still i couldn't receive any packet from ping 8.8.8.8 dns, i have ethernet and wifi on my laptop... same setting on virtual machine works perfectl but on real os it wouldn't work... if i ping
ping 127.0.0.1
or
ping localhost
what could be the problem???
It could be that your interface is down.
ifconfig eth0 up
Eth0 is an interface name to get the list of your visible interface type in "ifconfig"
also you should provide us with the list of interface and possibly also hardware
dmesg
will display the full list of device on your laptop.
Also to be noted some of these command requires root / sudoer.
Wifi : http://wiki.centos.org/HowTos/Laptops/Wireless

Resources