Click to See Complete Forum and Search --> : Switch device numbering of eth0 and eth1
skubiszm
07-18-2005, 08:45 PM
Sorry if the title is unclear. My PC currently has two ethernet cards (but that could change), one built into the motherboard and a PCI NIC. Now the problem is I want the one on the motherboard to be eth0 and all additional PCI NIC's to be eth1, eth2, etc. Unfortunately, linux seems to be assigning numbers to PCI NIC's before the mobo NIC. How do I force the mob NIC to be eth0? I am using FC4.
-skubiszm
use udev rules.
many examples/how-tos available if you google for it.
skubiszm
07-18-2005, 10:25 PM
Thanks for the typical linux response. A little more polite than UTFG, so I guess that's a plus.
You did, however, give me a push in the right direction to include udev in my searches. I did not, however, find any information about using udev rules to correctly number my ethernet interfaces. I found an example to rename my interface to "lan" (http://gentoo-wiki.com/HOWTO_Customizing_UDEV#Example:_Writing_a_rule_to_ name_my_network_interface), but that is not what I was looking for.
I then came across this link (http://www.linuxsa.org.au/pipermail/linuxsa/2005-May/079243.html) which gave me a little better of an idea. Redhat/Fedora has these nifty config files located at /etc/sysconfig/network-scripts/ named ifcfg-eth0, ifcfg-eth1, etc. These were created with the settings I specified when I initially installed FC4. My ifcfg-eth0 looks like this:
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0E:0C:XX:XX:XX
ONBOOT=yes
TYPE=Ethernet
DHCP_HOSTNAME=xxx.com
USERCTL=no
PEERDNS=yes
IPV6INIT=no
Now, the only problem with these config files was the HWADDR's. So I simply switched them, swapped the cables and rebooted. I should note that the box locked up trying to "Shutdown eth0" the first time I rebooted, but I just hard-booted it and when it came up, everything was as it should be.
I think those same files can be editted through Fedora's Network Config app, but it was pretty easy to copy and paste to swap the MAC addresses.
Hope someone else finds this helpful.
-skubiszm
rocketpcguy
07-19-2005, 02:57 AM
Solved
Thanks for the typical linux response. A little more polite than UTFG, so I guess that's a plus.
hmmm, speaking of being polite..., nevermind, at least you were nice enough to explain how you solved it.
ph34r
07-19-2005, 08:59 AM
The device number is controlled by what order the modules are loaded in... so whatever is eth0 had its module loaded before whatever is eth1
skubiszm
07-19-2005, 12:51 PM
Is there a way to control the order the modules are loaded? What if the drivers weren't modules but were compiled into the kernel?
-skubiszm