Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers 3

up vote 11 down vote accepted

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

share|improve this answer
    
Just used this to move a full 12.04 LTS Server install onto new server hardware. After I swapped all drives across, I no longer has any network (on the new hardware). I actually edited /etc/udev/rules.d/70-persistent-net.rules, to rename NEW interface as 'eth0'. –  david6 Nov 2 '13 at 4:12
add comment

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.

share|improve this answer
    
I am actually using DHCP. –  Jonas Oct 25 '10 at 13:39
    
I don't have a directory /etc/sysconfig/ –  Jonas Oct 25 '10 at 13:41
1  
@Jonas check /etc/network/interfaces maybe –  jschoen Oct 25 '10 at 13:54
    
You probably should edit /etc/network/interfaces and add a line like: auto eth1. Please try to give info about the Ubuntu version that you are using in the question as details like paths can change between versions. –  Javier Rivera Oct 25 '10 at 13:56
1  
This reply refers to Red Hat Linux rather than Ubuntu. –  Scott Oct 29 '10 at 13:57
show 2 more comments

First in VM Guest create a file named newfile: sudo nano /etc/init.d/newfile with two lines:

#!/bin/bash
sudo ifup eth0

next, from console:

sudo chmod +x /etc/init.d/newfile
sudo chmod 755 /etc/init.d/newfile 
sudo update-rc.d newfile defaults

I used this solution because eth0 is down after reboot with static IP (with DHCP work fine).

my /etc/network/interfaces:

    # The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
nameservers 192.168.1.1

(sorry for my english)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.