2008年8月14日 星期四

udev experience

udev allows Linux users to have a dynamic /dev directory and it provides the ability to have persistent device names.

# pwd
/etc/udev/rules.d

# grep -R -H "eth" ./*
./rules.d/75-persistent-net-generator.rules:KERNEL!="eth*|ath*|wlan*[0-9]|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end"
./rules.d/70-persistent-net.rules:SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1a:4d:9d:af:36", ATTR{type}=="1", NAME="eth0"
./rules.d/70-persistent-net.rules:SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1c:f0:c7:f6:92", ATTR{type}=="1", NAME="eth1"

# ifconfig eth0 ==> the mac address of eth0 is the same as the eth0 recorded by the udev (list as above line)
eth0 Link encap:Ethernet HWaddr 00:1A:4D:9D:AF:36
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21a:4dff:fe9d:af36/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3811224 errors:0 dropped:0 overruns:0 frame:0
TX packets:3039504 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4258641035 (3.9 GiB) TX bytes:548058354 (522.6 MiB)
Interrupt:17 Base address:0xa000

# ifconfig eth1 ==> the mac address of eth1 is the same as the eth0 recorded by the udev (list as above line)
eth1 Link encap:Ethernet HWaddr 00:1C:F0:C7:F6:92
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)
Interrupt:20

沒有留言: