Weblog entry #2 for Utumno
angband:/home/leszek# cat /etc/udev/netinterfaces.rules
KERNEL=="eth*",SYSFS{address}=="00:0E:2E:57:22:23",NAME="eth0"
KERNEL=="eth*",SYSFS{address}=="00:50:BA:01:93:3F",NAME="eth1"
KERNEL=="eth*",SYSFS{address}=="00:13:D4:EF:4B:EC",NAME="eth2"
and a link to it
angband:/etc/udev/rules.d# ls -l /etc/udev/rules.d/ | grep netinterfaces
lrwxrwxrwx 1 root root 22 2006-03-04 23:00 010_netinterfaces.rules -> ../netinterfaces.rules
... turns out the above is not entirely correct.
I took the mac addresses (00:0E:2E:57:22:23) from
angband:/etc/udev/rules.d# ifconfig -a | grep eth
eth0 Link encap:Ethernet HWaddr 00:0E:2E:57:22:23
eth1 Link encap:Ethernet HWaddr 00:50:BA:01:93:3F
eth2 Link encap:Ethernet HWaddr 00:13:D4:EF:4B:EC
which is wrong, because ... ifconfig reports them in uppercase and udev expects them in lowercase!
The correct way to figure out a MAC address of interface eth0 as it is seen by udev is
angband:/etc/udev/rules.d# udevinfo -a -p /sys/class/net/eth0/ | grep address
SYSFS{address}=="00:0e:2e:57:22:23"
Comments on this Entry
[ Send Message | View dkg's Scratchpad | View Weblogs ]
[ Parent | Reply to this comment ]
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
[ Parent | Reply to this comment ]
[ Send Message | View dkg's Scratchpad | View Weblogs ]
however, i've found that if you want to swap around interface names that already exist with ifrename (e.g. if you want "eth0" to be "eth1", and "eth1" to be "eth0"), you need to rename one of them out to an alternate name first, because it can't rename interfaces to an existing name. I get around that particular problem by giving my interfaces nice clean names that aren't auto-assigned names anyway (e.g. "wired" and "wireless", or "lan" and "wan"). This kind of semantic naming is actually pretty useful for scripts which do things to the interfaces as well.
As for doing everything with udev (and no extra packages), i see your point. It feels like a cleaner solution. However, i'm scared of tampering with udev config files because the udev maintainer seems to change them so often. I've only got one simple change to my udev config on a machine running etch (changing the mode of /dev/nvram from 0660 to 0640), and i find myself constantly having to juggle config file changes when udev upgrades come through.
But I haven't tried creating a separate config file that lives outside the shipped config files, like you've done here. i like that because it's a more modular and maintainable arrangment. But reading man udev, i can't figure out which rule takes precedence in the event that two rules match. Is it the first matching rule discovered lexically in /etc/udev/rules.d/ or the last matching rule?
[ Parent | Reply to this comment ]
You should insert module, then ifrename and after it ifup. if you run ifrename after ifup there possible some problems (with some versions of wpa_supplicant at least).
So, if you don't use 2.4 kernel it would be better to swich to udev.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Send Message | View dkg's Scratchpad | View Weblogs ]
udev will stop processing rules as soon as it finds a matching rule in a file for the new item of hardware that has been detected.Thanks again!
[ Parent | Reply to this comment ]