Recently I installed four systems with identical hardware and identical installations of Debian Etch. After installation was complete I found that while on three systems networking worked fine, on the fourth I could not bring up eth0, which gave the error:
luke:~# ifup eth0 SIOCSIFADDR: No such device eth0: ERROR while getting interface flags: No such device SIOCSIFNETMASK: No such device SIOCSIFBRDADDR: No such device eth0: ERROR while getting interface flags: No such device eth0: ERROR while getting interface flags: No such device Failed to bring up eth0.
Checking the logs showed two problems. Firstly, the kernel was complaining that the network interface had an invalid mac-address:
0000:00:07.0: Invalid Mac address detected: 4b:61:7f:4d:1a:00 Please complain to your hardware vendor. Switching to a random MAC.
And then the second network interface (in this case a firewire interface) was being assigned to the same device name:
luke:~# dmesg | grep eth forcedeth.c: Reverse Engineered nForce ethernet driver. Version 0.56. forcedeth: using HIGHDMA eth0: forcedeth.c: subsystem: 01458:e000 bound to 0000:00:07.0 eth1394: eth0: IEEE-1394 IPv4 over 1394 Ethernet (fw-host0)
Notice both network adapters are assigned to eth0. Clearly something was not right.
The real problem was the invalid MAC-address. Usually the mac-address remains static since it's hard-coded in to the chip on the network interface itself, but since that MAC-address was invalid a different, random mac-address was being used on each reboot.
This was causing UDEV to think it was a new network adapter and so it was assigning it a new device name on each reboot, and appending the following junk in to /etc/udev/rules.d/z20_persistent.rules:
# PCI device 0x10de:0x03ef (forcedeth)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:2d:66:5f", NAME="eth0"
# Firewire device 001a4d0000e2438f (ohci1394)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:1a:4d:00:00:e2:43:8f", NAME="eth1"
# PCI device 0x10de:0x03ef (forcedeth)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:93:03:f8", NAME="eth2"
# PCI device 0x10de:0x03ef (forcedeth)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:2c:97:b5", NAME="eth3"
# PCI device 0x10de:0x03ef (forcedeth)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:fd:86:07", NAME="eth4"
# PCI device 0x10de:0x03ef (forcedeth)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:ef:0f:7a", NAME="eth5"
Note that there are multiple lines for devices with all sorts of MAC-addresses, and device names which are incremental. A new device was being added on each reboot of the system.
Several posts I found when searching the Internet for this problem suggested setting a static MAC-address in my /etc/network/interfaces file, but this didn't work for me. The kernel module wouldn't use the network controller's invalid MAC-address, so I couldn't use that address when configuring the network interfaces file.
The solution in the end was to write a rule for UDEV that identified the network controller by it's PCI bus ID rather than by it's MAC-address. My /etc/udev/rules.d/z25_persistent-net.rules (/etc/udev/rules.d/z20_persistent.rules) now looks like this:
# PCI device 0x10de:0x03ef (forcedeth)
# SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:00:6c:2d:66:5f", NAME="eth0"
# Firewire device 001a4d0000e2438f (ohci1394)
SUBSYSTEM=="net", DRIVERS=="?*", ATTRS{address}=="00:1a:4d:00:00:e2:43:8f", NAME="eth1"
SUBSYSTEM=="net", DRIVERS=="?*", ID=="0000:00:07.0", NAME="eth0"
The first pair of lines which are commented out are the original lines added by the installer identifying my network interface by MAC address. The second pair of lines are for my firewire, and the final pair of lines are those I added to fix the problem. Note that your device ID may be different, but you will find it in /var/log/kern.log.
When I rebooted, the network adapter was detected as eth0 and could be bought up without error. Subsequent reboots showed that the device name remained static, despite it's random MAC address. Random mac-addresses may however confuse your router's, and so you should set a static MAC address in /etc/network/interfaces by adding the following line to the configuration for eth0:
iface eth0 inet static
address 192.168.1.1
[...]
hwaddress ether 00:00:6C:2D:66:5F
You can find your current MAC-address using ifconfig.
Subscribe to the RSS feed for Andy's Debian HOWTOs
Article from Andy's Debian HOWTOs (http://www.besy.co.uk/debian/debian)
Discussion