I run Ubuntu Server 10.10 in VirtualBox with Windows as host. Accidently I choosed to generate a new random MAC-address for my Ubuntu machine in VirtualBox. And now when I have booted my Ubuntu with the new MAC-address, I don't get an external IP-address. I'm using DHCP to get IP-addresses.
I guess I have to run a command and inform my Ubuntu system that the MAC-address has changed to get an external IP-address.
If I execute sudo /etc/init.d/networking restart
I get this message:
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth0
How can I solve this?
Since your mac address have changed you no longer have an interface called eth0, this name is reserved for an interface with the "old" mac-address. The "new" interface should have the next free name (eg. ethN).
To see all the interfaces on the machine you can use this command:
ifconfig -a
If you want to reset the name reservations for network interfaces you can remove the file
/etc/udev/rules.d/70-persistent-net.rules
and restart the machine (or remove/insert the device, though this is not possible in this case).Alternatively you can change the interface-name that you have configured to what ever the new one is called by changing all occurences of the old name with the new one in the file
/etc/network/interfaces
I guess you are using static IP on your ubuntu host.
Since you have changed the MAC address, the ubuntu will create a new "eth" for you instead of using the old one.
Modify the file /etc/sysconfig/networks/ifcfg-eth0 to ifcfg-eth1 or setup a static configuration using network manager.
First in VM Guest create a file named newfile: sudo nano /etc/init.d/newfile with two lines:
next, from console:
I used this solution because eth0 is down after reboot with static IP (with DHCP work fine).
my /etc/network/interfaces:
(sorry for my english)