Update udev static NIC configuration tip.
authorMichael Prokop <mika@grml.org>
Tue, 1 Mar 2011 21:06:12 +0000 (22:06 +0100)
committerMichael Prokop <mika@grml.org>
Tue, 1 Mar 2011 21:06:12 +0000 (22:06 +0100)
grml_tips

index 1d2db86..b26d5d9 100644 (file)
--- a/grml_tips
+++ b/grml_tips
@@ -1100,38 +1100,29 @@ and vice versa:
 
 % iconv -f iso-8859-15 -t utf8 < isofile > utffile
 -- 
-Assign static setup for network cards (eth0 and eth1) via udev:
+Assign static setup for network cards (NICs) via udev:
 
-First method - manual:
-~~~~~~~~~~~~~~~~~~~~~~
-Get information for SYSFS address:
-# udevadm info -a -p /sys/class/net/eth0/ | grep address
+Retrieve information for address (corresponding to MAC address):
 
-Then create udev rules:
-# cat /etc/udev/network.rules
-# match eth* stuff:
-KERNEL=="eth*", SYSFS{address}=="00:00:00:00:00:01", NAME="wlan0"
-KERNEL=="eth*", SYSFS{address}=="00:00:00:00:00:02", NAME="lan0"
-# do not match eth* drivers but also e.g. firewire stuff:
-ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="00:00:00:00:00:03", NAME="1394"
+  # udevadm info -a -p /sys/class/net/eth0/ | grep -i 'ATTR{address}'
 
-Now activate the rules:
-# cd /etc/udev/rules.d/ && ln -s ../network.rules z35_network.rules
+Execute /lib/udev/write_net_rules with according values (INTERFACE
+is old NIC name, INTERFACE_NAME is new NIC name and MATCHADDR
+is the MAC address retrieved with udevadm info command):
 
-Unload the drivers, restart udev and load the drivers again to activate
-the settings.
+  # INTERFACE=eth0 INTERFACE_NAME=lan0  MATCHADDR=00:00:00:00:00:01 /lib/udev/write_net_rules
 
-Second method - automatic:
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-Run /lib/udev/write_net_rules shipped with recent udev versions:
+This will generate file /etc/udev/rules.d/70-persistent-net.rules with content:
 
-# INTERFACE=wlan1 /lib/udev/write_net_rules 00:00:00:00:00:04
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:01", KERNEL=="eth*", NAME="lan0"
 
-This command will create /etc/udev/rules.d/z25_persistent-net.rules containing:
+Finally take down the interface (ifdown/ifconfig) and execute:
 
-SUBSYSTEM=="net", DRIVER=="?*", SYSFS{address}=="00:00:00:00:00:04", NAME=wlan1
+  # udevadm trigger --action=add --subsystem-match=net
 
-See /usr/share/doc/udev/writing_udev_rules/index.html for more information.
+so the interface will be renamed. (Rebooting or
+unloading drivers/restart udev/loading drivers again
+works as well of course.)
 -- 
 Change the suffix from *.sh to *.pl using zsh: