LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 08-22-2006, 07:07 PM   #1
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Rep: Reputation: 16
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.
 
Old 08-22-2006, 07:39 PM   #2
Matir
Moderator
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 118Reputation: 118
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.
 
Old 08-22-2006, 08:13 PM   #3
dansawyer
Member
 
Registered: Mar 2005
Posts: 122

Rep: Reputation: 15
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
 
Old 08-23-2006, 07:26 PM   #4
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Original Poster
Rep: Reputation: 16
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.
 
Old 08-23-2006, 07:34 PM   #5
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Original Poster
Rep: Reputation: 16
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."
 
Old 08-23-2006, 08:18 PM   #6
dansawyer
Member
 
Registered: Mar 2005
Posts: 122

Rep: Reputation: 15
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
 
Old 08-23-2006, 08:36 PM   #7
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Original Poster
Rep: Reputation: 16
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
 
Old 08-23-2006, 09:45 PM   #8
dansawyer
Member
 
Registered: Mar 2005
Posts: 122

Rep: Reputation: 15
The scripts were produced by the Fedora network tool.

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

- Dan
 
Old 08-24-2006, 09:19 AM   #9
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
Do you use udev?
 
Old 08-24-2006, 07:48 PM   #10
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Original Poster
Rep: Reputation: 16
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.
 
Old 08-24-2006, 07:52 PM   #11
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Original Poster
Rep: Reputation: 16
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 ?
 
Old 12-13-2006, 03:34 PM   #12
DHatherley
LQ Newbie
 
Registered: Dec 2006
Location: Manchester, UK
Distribution: Kubuntu Edgy (6.10)
Posts: 2

Rep: Reputation: 0
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.
 
Old 12-14-2006, 04:05 AM   #13
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 52
If no udev, then it can be done using ifrename

Have a look here:
https://www.debian-administration.org/articles/463
 
Old 12-29-2006, 01:41 AM   #14
stefanlasiewski
Member
 
Registered: Aug 2003
Location: Berkeley, California, USA
Distribution: Red Hat Enterprise Linux, Debian & Ubuntu
Posts: 92

Original Poster
Rep: Reputation: 16
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!
 
  


Reply

Tags
network, suse


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
eth0 NIC Card Not Working! 3com 3c501 NIC. Mustard010 Linux - Networking 16 08-15-2007 02:22 AM
eth0 - eth1 - eth2 and how to determine which driver they are using vharishankar Linux - Networking 7 06-02-2005 10:52 PM
need eth2 to be eth0 frkstein Linux - Networking 1 04-27-2005 07:17 PM
force eth0 to use e100 nutthick Slackware 6 11-14-2004 05:12 AM
eth0 eth1 and eth2 on boot sergiodemoura Linux - Newbie 4 12-03-2003 01:21 AM


All times are GMT -5. The time now is 04:48 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration