Udev and its traps

September 24th, 2008

I’ve got 3 network interfaces and I wanted them to have consistent names across reboots. I read somewhere that this can be achieved with udev by adding a small script

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″

2 Responses to “Udev and its traps”

  1. Anonymous Says:

    you can also use ‘ifrename’ to set up interface names. With ifrename, you just need to set up a simple text file in /etc/iftab.

  2. Как найти алмазы в майнкрафте Says:

    It is appropriate time to make some plans for the long run and it’s time to be
    happy. I’ve learn this submit and if I may I wish to suggest you few
    fascinating things or suggestions. Maybe you could write next articles referring to this article.
    I want to read more issues approximately it!

Leave a Reply