Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92
Rep:
Force NIC to be 'eth0' instead of 'eth2'
Hello Everyone,
I am working on a machine which has four ethernet cards. Currently, Linux is assigning 'eth0' to one of the crappier cards.
I would like to force one card to be recognized as 'eth0'. I'm guessing there is a way to bind the MAC address to the eth0 designator, but I don't know how.
This is a Suse PRO 9.2 system .
Could anyone give any hints?
-= Stefan
Last edited by stefanlasiewski; 08-22-2006 at 07:16 PM.
The eth# numbers are assigned by the order in which the hardware is discovered. Modprobing the cards in the order you want would give you the right numbering.
The eth# can be hard wired by adding the cards unique id to the config script. This is a laptop with two pcmcia cards. One is forced to eth0 and the other to eth1 one.
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92
Original Poster
Rep:
Quote:
Originally Posted by dansawyer
The eth# can be hard wired by adding the cards unique id to the config script. This is a laptop with two pcmcia cards. One is forced to eth0 and the other to eth1 one.
Dan -- I don't know what you mean. Did you intend to include a your config script?
It sounds like I want exactly this solution --- I just can't figure out how to do this from the documentation. For example, there is nothing that says 'eth0' in /etc/sysconfig/network/ifcfg.template .
The Suse document /usr/share/doc/packages/sysconfig/README says that I should set these sorts of settings in /etc/udev/udev.conf --- but that's a whole other ball of wax.
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92
Original Poster
Rep:
Quote:
Originally Posted by Matir
The eth# numbers are assigned by the order in which the hardware is discovered. Modprobing the cards in the order you want would give you the right numbering.
Interestingly --- SuSE claims that using modprobe to force this order is depricated.
"The best solution, however, is to use persistent interface designations. You can specify the names of the individual interfaces in the configuration files. Details about this method are available in the file /usr/share/doc/packages/sysconfig/README. Since SUSE LINUX 9.3, udev also deals with network interfaces, although these are not device nodes. This allows use of persistent interface names in a more standardized manner."
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92
Original Poster
Rep:
Dan,
Thanks a bunch!
Just to confirm, those are your ifcfg scripts under /etc/sysconfig/network , correct? Interestingly, I don't see the phrase "DEVICE" mentioned in the ifcfg docs
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92
Original Poster
Rep:
Quote:
Originally Posted by stefanlasiewski
Just to confirm, those are your ifcfg scripts under /etc/sysconfig/network , correct? Interestingly, I don't see the phrase "DEVICE" mentioned in the ifcfg docs
Arg. Setting "DEVICE=eth0" in /etc/sysconfig/network/ifcfg* didn't seem to help.
I'm not a SUSE user (tried it, found it slow), but under Ubuntu NIC names can be bound to MAC addresses in the file /etc/iftab. I believe this config file is part of the udev package, so if SUSE 9.2 uses udev you could be in luck. See man iftab to see how to create entries in the file, but binding names to mac addresses is pretty simple:
Code:
eth1 mac 00:11:22:33:44:55
(Obviously, substitute your nic name for eth1 and mac address for 00:11:22:33:44:55).
Alternatively, the man page refers to a tool called ifrename that comes with "other distributions", which may or may not include SUSE and may or may not cover what you're after.
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92
Original Poster
Rep:
I gave up trying to do this in SuSE Pro 9.2. I reinstalled CentOS 4.x on the host.
Forcing one NIC to become eth0 was very easy. I simply switched the MAC addresses in /etc/system/network-scripts/ifcfg-eth0 and ifcfg-eth2, and then rebooted. Works great!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.