You are not logged in.
Pages: 1
How can I ensure that my onboard NIC on my laptop always comes up as eth0?
My laptop has an onboard NIC, a second NIC in the PC card slot, and the wifi interface. I'd like to make sure that the onboard is always eth0, the wifi is always eth1, and the PC card is always eth2.
There is also a firewire interface that gets in there. Here is my current 'ifconfig -a':
[root@yen ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:50:DA:30:80:B8
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:13
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:5098 (4.9 Kb)
Interrupt:9 Base address:0x4400
eth1 Link encap:Ethernet HWaddr 08:00:46:CD:32:51
inet addr:129.155.230.118 Bcast:129.155.230.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:13144 errors:0 dropped:0 overruns:0 frame:0
TX packets:13898 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7631539 (7.2 Mb) TX bytes:1352582 (1.2 Mb)
Interrupt:9 Base address:0xc000
eth2 Link encap:Ethernet HWaddr 00:0E:35:03:ED:04
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:9 Base address:0x2000 Memory:d0201000-d0201fff
eth3 Link encap:UNSPEC HWaddr 08-00-46-03-01-97-76-FE-00-00-00-00-00-00-00-00
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1128 errors:0 dropped:0 overruns:0 frame:0
TX packets:1128 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:64166 (62.6 Kb) TX bytes:64166 (62.6 Kb)
sit0 Link encap:UNSPEC HWaddr 00-00-00-00-31-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
[root@yen ~]#
In that output, eth0 is the PC card (3c59x), eth1 is the onboard (eepro100), eth2 is the wifi (ipw2200) and eth3 is the firewire.
And lsmod:
[root@yen ~]# lsmod
Module Size Used by
eth1394 22664 0
ohci_hcd 22660 0
ipw2200 117484 0
ieee80211 34116 1 ipw2200
ieee80211_crypt 5508 1 ieee80211
eepro100 31372 0
mii 5632 1 eepro100
ohci1394 35588 0
ieee1394 114360 2 eth1394,ohci1394
snd_intel8x0m 19400 1
snd_intel8x0 36428 1
snd_ac97_codec 73808 2 snd_intel8x0m,snd_intel8x0
snd_pcm_oss 56488 0
snd_mixer_oss 21376 1 snd_pcm_oss
snd_pcm 101508 3 snd_intel8x0m,snd_intel8x0,snd_pcm_oss
snd_timer 27140 1 snd_pcm
snd_page_alloc 10248 3 snd_intel8x0m,snd_intel8x0,snd_pcm
gameport 5120 1 snd_intel8x0
snd_mpu401_uart 8704 1 snd_intel8x0
snd_rawmidi 26276 1 snd_mpu401_uart
snd_seq_device 8456 1 snd_rawmidi
snd 58980 14 snd_intel8x0m,snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device
soundcore 10848 1 snd
usb_storage 70848 0
ehci_hcd 31748 0
uhci_hcd 33680 0
shpchp 101252 0
pci_hotplug 13060 1 shpchp
tsdev 8128 0
evdev 9984 0
sonypi 24404 3
ntfs 156432 1
3c59x 40104 0
[root@yen ~]#
Mark
Offline
Make sure you "alias" them (the modules actually) as you wish in "/etc/modprobe.conf".
Here's the relevant part of mine:
#
# /etc/modprobe.conf (for v2.6 kernels)
#
alias eth0 8139too
alias eth1 e100
I can switch them, but I also need to switch the IP addresses in /etc/rc.conf (make sure that /etc/rc.conf contains the correct IP assignments)
:: / my web presence
Offline
A more powerful way is to use udev rules
try adding a line such as
KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="eth2"
in /etc/udev/rules.d/00-my.rules for each device. Change the mac address to match the name you want it to have. Make sure that the udev starts before the pcmcia daemon.
The mac address is from "/sys/class/net/eth0/address" and so on.
Offline
and that..is why I don't like udev..
lol
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
and that..is why I don't like udev..
lol
what if you had 2 cards that used the same module - you couldn't use the alias method - but the mac address is unique to the card... therefore udev wins
Offline
cactus wrote:and that..is why I don't like udev..
lolwhat if you had 2 cards that used the same module - you couldn't use the alias method - but the mac address is unique to the card... therefore udev wins
:shock:
:?
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
And udev also lets you call it something else, you could call in inth0 and outh0 or whatever else you wanted.
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
what if you had 2 cards that used the same module - you couldn't use the alias method - but the mac address is unique to the card... therefore udev wins
Hmm... if the cards use the same module... then there's probably no performance loss in changing the wires... isn't it? (well.. this is what I did on my old computer, where I did have 2 eth cards using the same module).
Anyway, I have to admit, the udev rules solution is interesting... it also shows how much inside knowledge is needed to run Linux... I wonder how an ordinary user would take such an answer...
:: / my web presence
Offline
How many ordinary users would need such an answer?
I have discovered that all of mans unhappiness derives from only one source, not being able to sit quietly in a room
- Blaise Pascal
Offline
what do you define as "ordinary"?
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
A more powerful way is to use udev rules
try adding a line such as
KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="eth2"
in /etc/udev/rules.d/00-my.rules for each device. Change the mac address to match the name you want it to have. Make sure that the udev starts before the pcmcia daemon.
The mac address is from "/sys/class/net/eth0/address" and so on.
Thanks! I'll give this a whirl. I actually don't even start pcmcia. Not sure why, but my PC card NIC (3Com 3c59x) works fine without starting pcmicia at all.
Mark
Offline
Well after my first attempt, no joy. I created /etc/udev/rules.d/00-local.rules:
KERNEL="eth*", SYSFS{address}="08:00:46:CD:32:51", NAME="eth0"
KERNEL="eth*", SYSFS{address}="00:0E:35:03:ED:04", NAME="eth1"
KERNEL="eth*", SYSFS{address}="00:50:DA:30:80:B8", NAME="eth2"
and rebooted, but they still are not coming up in the right order, or with the right names. I'll give more info, maybe this will help.
This is my laptop, a Sony Centrino V505 model with the 2200BG chipset. I have three network interfaces:
Onboard NIC: Intel Corp. 82801BD PRO/100 VE (MOB) Ethernet Controller (rev 131).
Wireless Interface: Intel Corp. PRO/Wireless 2200BG (rev 5).
PC Card NIC: 3Com Corporation 3cCFE575CT CardBus [Cyclone] (rev 16).
I would like to have them configured, at the very least, so the onboard NIC always comes up as eth0, since that is the one I use the most. The other two I don't care so much about.
Now, I am not starting pcmcia in rc.conf:
DAEMONS=(syslog-ng !hotplug !pcmcia network acpid cpudyn ntpd netfs portmap lisa fam crond cups postfix spamd clamav)
Notice I am also not starting hotplug. hotplug, or something related to it causes a kernel panic whenever I do a shutdown or reboot. So I disabled it and started loading my modules myself:
MODULES=(!usbserial !ide-scsi sonypi eepro100 ipw2200 snd_intel8x0 snd_intel8x0m ehci_hcd uhci_hcd freq_table cpufreq_ondemand cpufreq_userspace cpufreq_powersave)
Notice that I am not loading the PC card driver, 3c59x. But if the PC Card is inserted in the card slot when the system boots, something is loading 3c59x. And it is being loaded ahead of my listed modules above because it always comes up as eth0, even with my 00-local.rules in place.
Module Size Used by
cpufreq_powersave 2048 0
cpufreq_userspace 9584 0
cpufreq_ondemand 6936 0
freq_table 4752 0
usb_storage 70848 0
uhci_hcd 33680 0
ehci_hcd 31748 0
snd_intel8x0m 19400 1
snd_intel8x0 36428 1
snd_ac97_codec 73808 2 snd_intel8x0m,snd_intel8x0
snd_pcm_oss 56488 0
snd_mixer_oss 21376 1 snd_pcm_oss
snd_pcm 101508 3 snd_intel8x0m,snd_intel8x0,snd_pcm_oss
snd_timer 27140 1 snd_pcm
snd_page_alloc 10248 3 snd_intel8x0m,snd_intel8x0,snd_pcm
gameport 5120 1 snd_intel8x0
snd_mpu401_uart 8704 1 snd_intel8x0
snd_rawmidi 26276 1 snd_mpu401_uart
snd_seq_device 8456 1 snd_rawmidi
snd 58980 14 snd_intel8x0m,snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer,snd_mpu401_uart,snd_rawmidi,snd_seq_device
soundcore 10848 1 snd
ipw2200 117484 0
ieee80211 34116 1 ipw2200
ieee80211_crypt 5508 1 ieee80211
eepro100 31372 0
mii 5632 1 eepro100
tsdev 8128 0
evdev 9984 0
sonypi 24404 3
ntfs 156432 1
3c59x 40104 0
eth0 Link encap:Ethernet HWaddr 00:50:DA:30:80:B8
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:11
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:6490 (6.3 Kb)
Interrupt:9 Base address:0x4400
eth1 Link encap:Ethernet HWaddr 08:00:46:CD:32:51
inet addr:129.155.230.118 Bcast:129.155.230.255 Mask:255.255.255.0
inet6 addr: fe80::a00:46ff:fecd:3251/64 Scope:Link
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2049 errors:0 dropped:0 overruns:0 frame:0
TX packets:2525 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:858421 (838.3 Kb) TX bytes:246995 (241.2 Kb)
Interrupt:9 Base address:0xa000
eth2 Link encap:Ethernet HWaddr 00:0E:35:03:ED:04
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:9 Base address:0x8000 Memory:d0201000-d0201fff
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:315 errors:0 dropped:0 overruns:0 frame:0
TX packets:315 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:18140 (17.7 Kb) TX bytes:18140 (17.7 Kb)
sit0 Link encap:UNSPEC HWaddr 00-00-00-00-31-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1480 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
So I guess my first step is to figure out what is loading 3c59x, and why is my 00-local.rules being ignored?
Mark
Offline
hmm if your udev rules are being ignored... verify you have "devfs=nomount" in your kernel boot line...
also, you can reload udev by running /etc/udev_start... try fiddling with things and then restarting (this way you shouldn't have to reboot alot)
Offline
How many ordinary users would need such an answer?
Hmm... How many users use more than an interface in a laptop? Let's look into the statistics...
Then again... how many users use Linux on their laptops... Lets look into the statistics again...
This being said, I think that flexibility is one of the strong points of using the Laptops. In order to have it, users need an easily adaptable system, which, I'm sorry to say, it is kind of tricky (if not hard) to get under Linux - for the common user, without previous dig-outs from the forums. On top of all these, laptops are not desktops - they, by their nature, are made to be productive - people need to be productive by first using the laptop functionalities easily...
This will all change after some time though... I don't know how much though.
what do you define as "ordinary"?
WordNet (r) 2.0 (August 2003) [wn]
ordinary
adj 1: not exceptional in any way especially in quality or ability
or size or degree; "ordinary everyday objects";
"ordinary decency"; "an ordinary day"; "an ordinary
wine" [ant: extraordinary]
2: lacking special distinction, rank, or status; commonly
encountered; "average people"; "the ordinary (or common)
man in the street" [syn: average]
Well, I admit.. I could have used "common", but "ordinary" came to my mind in that particular moment.
:: / my web presence
Offline
lol..
sometimes you write up a long response to something..then read back through it, and realize that you really could care less one way or the other about what you previously thought was an important opinion you wished to express..
I wonder how many times I have written half-page replies, only to just close the browser window instead of hitting submit.
*nothing to see here...move along*
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
i can happily say you are all wrong
The best way to do this is with nameif
nameif <interface> <hwaddr>
nameif eth0 08:00:46:CD:32:51
You can also use /etc/mactab to define them:
eth0 08:00:46:CD:32:51
eth1 00:0E:35:03:ED:04
eth2 00:50:DA:30:80:B8
Although personally i would use wlan0 instead of eth1 for the wifi
These can be set simply by running nameif
You could add this to your rc.d/network script, at the start after it sources the wireless and dhcpd files. it must be at the start as the interfaces have to be down for it to work
# load interface bindings
if [ -n /etc/mactab ] && nameif
Most of that is from memory - i lost my notes
Offline
dibblethewrecker, you are king. If I was not already married ... ! Sigh.
Frumpus ♥ addict
[mu'.krum.pus], [frum.pus]
Offline
I'm hava a Dell 700m laptop using modules ipw2100 and b44 modules I tried the udev rules
KERNEL=="eth*", SYSFS{address}=="<mac address>", NAME:="eth0"
KERNEL=="eth*",SYSFS{address}=="<mac address2>", NAME:="eth1"
and it does not properly force the b44 module to be eth0
I also tried using
nameif eth0 <mac address>
nameif eth1 <mac address>
but this doesn't work for me either. I get an error that eth0 cannot be named eth1 because eth1 already exists.
I'm guessing that since hotplug is in charge of loading the modules, it loads the ipw2100 module first and makes it eth0. Then installs the b44 module and names it eth1. I worked around this problem by explicitly loading b44 first and then ipw2100 in rc.conf.
Why does this happen? Why can't I modify the names of these modules using the udev rules? What am I doing wrong? I have devfs=nomount in kernel options.......named my rules as 00-custom.rules.
Offline
Read this first:
http://www.reactivated.net/writing_udev … mple-iface
Check if your mac addres is not uppercase (use udevinfo). You're probably right about the rest - try testing your rule with udevtest to find out if it works at all.
Offline
i can happily say you are all wrong
The best way to do this is with nameif
nameif <interface> <hwaddr> nameif eth0 08:00:46:CD:32:51
You can also use /etc/mactab to define them:
eth0 08:00:46:CD:32:51 eth1 00:0E:35:03:ED:04 eth2 00:50:DA:30:80:B8
Although personally i would use wlan0 instead of eth1 for the wifi
These can be set simply by running nameif
You could add this to your rc.d/network script, at the start after it sources the wireless and dhcpd files. it must be at the start as the interfaces have to be down for it to work
# load interface bindings if [ -n /etc/mactab ] && nameif
Most of that is from memory - i lost my notes
when i try to use command "/sbin/nameif" on the command line as itself or inside the script "/etc/rc.d/network"
# look for interface binding settings
[ -f /etc/mactab ] && nameif
the output is
[root@fabrizionb ~]# nameif
interface 'wlan0' not found
*** glibc detected *** nameif: double free or corruption (fasttop): 0x0804b1f0 *
**
======= Backtrace: =========
/lib/tls/libc.so.6[0xb7e9d233]
/lib/tls/libc.so.6(__libc_free+0x84)[0xb7e9dc94]
nameif[0x8049394]
/lib/tls/libc.so.6(__libc_start_main+0xdb)[0xb7e4dd6b]
nameif[0x80489d1]
======= Memory map: ========
08048000-0804a000 r-xp 00000000 03:02 19033 /sbin/nameif
0804a000-0804b000 rw-p 00001000 03:02 19033 /sbin/nameif
0804b000-0806c000 rw-p 0804b000 00:00 0 [heap]
b7d00000-b7d21000 rw-p b7d00000 00:00 0
b7d21000-b7e00000 ---p b7d21000 00:00 0
b7e2d000-b7e37000 r-xp 00000000 03:02 9853 /usr/lib/libgcc_s.so.1
b7e37000-b7e38000 rw-p 00009000 03:02 9853 /usr/lib/libgcc_s.so.1
b7e38000-b7e39000 rw-p b7e38000 00:00 0
b7e39000-b7f52000 r-xp 00000000 03:02 1183 /lib/tls/libc-2.3.5.so
b7f52000-b7f53000 r--p 00118000 03:02 1183 /lib/tls/libc-2.3.5.so
b7f53000-b7f56000 rw-p 00119000 03:02 1183 /lib/tls/libc-2.3.5.so
b7f56000-b7f58000 rw-p b7f56000 00:00 0
b7f76000-b7f77000 rw-p b7f76000 00:00 0
b7f77000-b7f91000 r-xp 00000000 03:02 1166 /lib/ld-2.3.5.so
b7f91000-b7f93000 rw-p 0001a000 03:02 1166 /lib/ld-2.3.5.so
bfb7b000-bfb91000 rw-p bfb7b000 00:00 0 [stack]
ffffe000-fffff000 ---p 00000000 00:00 0 [vdso]
Aborted
aniway it seems that it works...
Offline
Bfg - this thread is way out of date. Udev has changed a whole lot in the last eight months(!). Have a look at the udev wiki page for more relevant advice.
Offline
Pages: 1