Author Topic: Got eth1 and eth2 instead of eth0 and eth1  (Read 1621 times)

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Got eth1 and eth2 instead of eth0 and eth1
« on: January 23, 2008, 12:30:40 am »
Installing b3 from DVD for AMD64... for the first time on a dual NIC machine (mobo plus PCI)

For some reason it just doesn't like it - at one point it said bad MAC address, but not sure where, and basically couldn't access my external network/ADSL router, etc - thus no software to download, no browsing, etc.

I made the assumption that the mobo NIC would be eth0 and the PCI eth1 - is that normal?

In the /etc/network/interfaces file, it does list them as eth0 and eth1. And the same in the admin web site, but the external comes up as if it were not connected (no IP address etc, and my DHCP is turned on, on the ADSL router), the interal comes up as the correct internal LAN address. If I swap interfaces or cables connected to the NICs, I variously get a valid external DHCP address on one interface, and the correct fixed IP on the other, but the wrong way around! Swap again, and I'm back to where I started.

When I look in the system settings->Network panel for Kubuntu, it tells me I have eth1 and eth2! eth1 is set to the internal fixed IP address, and eth2 is disabled and I can't enable it...

How do I reconcile this, as the adaptor numbers don't even match between the different GUIs and files....

dan g

  • Regular Poster
  • **
  • Posts: 30
    • View Profile
Re: Got eth1 and eth2 instead of eth0 and eth1
« Reply #1 on: January 23, 2008, 10:35:26 am »
doing a 'swap interfaces' might just work for you.
go in web-admin and see Advanced> Network> settings

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Got eth1 and eth2 instead of eth0 and eth1
« Reply #2 on: January 24, 2008, 01:31:35 am »
Thanks Dan, as I mentioned above, it was the swap interfaces button I keep pressing, vainly hoping that in the process it might fix up whatever the config problem is!

I have now worked out how to fix it - at some point during installation, there must have been a hiccup whilst assigning the ethX numbers and after that, it simply remembers the number and keeps it. LMCE does NOT like those numbers, nor give you the opportunity to change them.

After a bit of research, I found that you can create a new .rules file in /udev/rules.d that captures the kernel messages whilst these names are being set, and modifies them. So I created <filename>.rules that contains:

KERNEL=="eth*", SYSFS{address}=="aa:bb:cc:dd:ee:ff", NAME="eth0"
KERNEL=="eth*", SYSFS{address}=="aa:bb:cc:dd:ee:ff", NAME="eth1"

Where aa:bb..etc are the mac addresses of the cards that you want to have those names. TIP: the mac addresses are case sensitive and must be lower case...

Domodude

  • Guest
Re: Got eth1 and eth2 instead of eth0 and eth1
« Reply #3 on: January 24, 2008, 11:48:41 am »
Would editing the (existing) /etc/iftab work? That file also contains the MAC addresses and names of the cards.

I had on 0704 an issue with the network, because after exchanging a network card, I ended up with eth0 and eth2. The only thing that I needed to do in the end was change the MAC address of eth1 in the /etc/iftab file.

colinjones

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 3003
    • View Profile
Re: Got eth1 and eth2 instead of eth0 and eth1
« Reply #4 on: January 24, 2008, 12:13:30 pm »
I believe so, but for me it didn't already exist, so I went with the udev instead

caiman

  • Veteran
  • ***
  • Posts: 119
    • View Profile
Re: Got eth1 and eth2 instead of eth0 and eth1
« Reply #5 on: July 27, 2008, 02:35:03 pm »
Had the same problem after changing the motherboard and NIC, and thanks to the comments above, I found that there was already a udev file that was forcing the names to the NIC, and it had incorrect entries:
Code: [Select]
/etc/udev/rules.d/70-persistent-net.rules