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

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

One Response 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.

Leave a Reply