predefine interfaces by MAC with udev?
another test, more complex,
also works selecting device names by MAC
ifconfig
**********************************
jpeth0 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)
jpwlan0 Link encap:Ethernet HWaddr 00:19:5b:78:f3:df
inet addr:192.168.44.132 Bcast:192.168.44.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4883 (4.7 KiB) TX bytes:720 (720.0 B)
**********************************
cat /etc/udev/rules.d/z25_persistent-net.rules
**********************************
# PCI device 0x1969:0x1048 (atl1)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1b:fc:19:ef:43",
NAME="jpeth0"
# USB device 07d1:3c03 (rt73usb)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:19:5b:78:f3:df",
ATTR{type}=="1", NAME="jpwlan0"
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1b:fc:19:ef:44",
NAME="jpeth0"
# USB device 07d1:3c03 (rt73usb)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:19:5b:78:f3:d0",
ATTR{type}=="1", NAME="jpwlan0"
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1b:fc:19:ef:45",
NAME="jpeth01"
# USB device 07d1:3c03 (rt73usb)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:19:5b:78:f3:d1",
ATTR{type}=="1", NAME="jpwlan01"
**********************************
El Sunday 10 February 2008 12:56:52 Jordi Pujol va escriure:
> Hello list,
>
> After creating and installing a kernel with CONFIG_SYSFS_DEPRECATED
> disabled the interfaces are renamed by udev,
> and that is working,
>
> # ifconfig
> **********************************
> jpeth0 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)
>
> jpwlan0 Link encap:Ethernet HWaddr 00:19:5b:78:f3:df
> inet addr:192.168.44.132 Bcast:192.168.44.255
> Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:22 errors:0 dropped:0 overruns:0 frame:0
> TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:5472 (5.3 KiB) TX bytes:720 (720.0 B)
> **********************************
>
> cat /etc/udev/rules.d/z25_persistent-net.rules
> **********************************
> # PCI device 0x1969:0x1048 (atl1)
> SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1b:fc:19:ef:43",
> NAME="jpeth0"
> # USB device 07d1:3c03 (rt73usb)
> SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:19:5b:78:f3:df",
> ATTR{type}=="1", NAME="jpwlan0"
> **********************************
>
> Hope this helps,
>
> Jordi Pujol
>
> El Friday 08 February 2008 20:44:13 Jordi Pujol va escriure:
> > 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: