[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

predefine interfaces by MAC with udev?



Now my Live system has network interfaces with personalized name 

ifconfig
*********************************************************
eth-mypc  Link encap:Ethernet  HWaddr 00:1b:fc:19:ef:43
          UP 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)
*********************************************************

cat /etc/udev/rules.d/010_netinterfaces.rules
*********************************************************
# rules

KERNEL=="eth*", SYSFS{address}=="00:1b:fc:19:ef:43", NAME="eth-mypc"
KERNEL=="eth*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="eth-mypc"
KERNEL=="eth*", SYSFS{address}=="00:56:78:98:76:54", NAME="eth-mypc"

KERNEL=="wlan*", SYSFS{address}=="00:56:78:98:76:54", NAME="wlan-mypc"
KERNEL=="wlan*", SYSFS{address}=="00:12:34:fe:dc:ba", NAME="wlan-mypc"
KERNEL=="wlan*", SYSFS{address}=="00:19:5b:78:f3:df", NAME="wlan-mypc"
*********************************************************

That is the first config supposed to work, when listing various interfaces 
then udev selects that interface corresponding to the MAC address, and 
renames it.

The interfaces are created, but not working into the started OS.
dmesg shows some lines about this,

*********************************************************
net wlan-mypc: device_rename: sysfs_create_symlink failed (-17)
udev: renamed network interface wlan0 to wlan-mypc
*********************************************************

searching kernel.org about this error, we must create a kernel with 
CONFIG_SYSFS_DEPRECATED disabled, Pending to test.

Regards,

Jordi Pujol



Reply to: