LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Force NIC to be 'eth0' instead of 'eth2' (https://www.linuxquestions.org/questions/linux-networking-3/force-nic-to-be-eth0-instead-of-eth2-476393/)

stefanlasiewski 08-22-2006 07:07 PM

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

Matir 08-22-2006 07:39 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.

dansawyer 08-22-2006 08:13 PM

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

stefanlasiewski 08-23-2006 07:26 PM

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.

stefanlasiewski 08-23-2006 07:34 PM

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.

See the Suse 9.3 Adminguide Guide at http://www-uxsup.csx.cam.ac.uk/pub/d...lug.agent.html

"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."

dansawyer 08-23-2006 08:18 PM

here are the scripts

USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Wireless
DEVICE=eth0
HWADDR=00:04:e2:bb:bc:ba
BOOTPROTO=dhcp
NETMASK=
DHCP_HOSTNAME=
IPADDR=
DOMAIN=
# ESSID=McKinley
CHANNEL=1
MODE=Managed
RATE='36 Mb/s'
ESSID=none
ONBOOT=no

USERCTL=no
IPV6INIT=no
PEERDNS=yes
GATEWAY=10.0.0.1
TYPE=Ethernet
DEVICE=eth1
BOOTPROTO=none
NETMASK=255.255.255.0
IPADDR=10.0.0.16
HWADDR=00:50:22:00:22:b0
ONBOOT=no

stefanlasiewski 08-23-2006 08:36 PM

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 :(

dansawyer 08-23-2006 09:45 PM

The scripts were produced by the Fedora network tool.

There appear to be two duplicate copies in the /etc/sysconfig/ path.

- Dan

nx5000 08-24-2006 09:19 AM

Do you use udev?

stefanlasiewski 08-24-2006 07:48 PM

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.

stefanlasiewski 08-24-2006 07:52 PM

Quote:

Originally Posted by nx5000
Do you use udev?

No --- I might try that next (or I might give up).

Can anyone offer hints for the udev.conf file ?

DHatherley 12-13-2006 03:34 PM

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.

nx5000 12-14-2006 04:05 AM

If no udev, then it can be done using ifrename

Have a look here:
https://www.debian-administration.org/articles/463

stefanlasiewski 12-29-2006 01:41 AM

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!


All times are GMT -5. The time now is 12:13 AM.