>>> 此贴的回复 >> 如果系统中用了udev的话,可以通过网卡的MAC地址来决定网卡的逻辑名。 在/etc/udev/conf.d/目录下创建010-nicname这个文件,文件内容为(下面的是我的电脑上的,nic是以太网卡,wireless为无线网卡。) KERNEL=="eth*", SYSFS{address}=="00:0f:1f:44:5a:48", NAME="nic" KERNEL=="eth*", SYSFS{address}=="00:0c:f1:3e:ec:f4", NAME="wireless"
如果没有udev的话,还可以用iproute这个软件包中的ip命令来修改网卡的名字 看看下面的方法:
x300-huang:~# ifconfig -a lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:100 (100.0 b) TX bytes:100 (100.0 b)
nic Link encap:Ethernet HWaddr 00:0F:1F:44:5A:48 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:11
wireless Link encap:Ethernet HWaddr 00:0F:1F:44:5A:48 inet addr:10.1.31.6 Bcast:10.1.31.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2272 errors:3 dropped:0 overruns:0 frame:0 TX packets:2966 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1755449 (1.6 MiB) TX bytes:564390 (551.1 KiB) Interrupt:5 Base address:0xe000 Memory:e0210000-e0210fff
x300-huang:~# ip link set dev nic name test x300-huang:~# ifconfig -a lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:100 (100.0 b) TX bytes:100 (100.0 b)
test Link encap:Ethernet HWaddr 00:0F:1F:44:5A:48 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:11
wireless Link encap:Ethernet HWaddr 00:0F:1F:44:5A:48 inet addr:10.1.31.6 Bcast:10.1.31.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2286 errors:3 dropped:0 overruns:0 frame:0 TX packets:2995 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1760347 (1.6 MiB) TX bytes:570658 (557.2 KiB) Interrupt:5 Base address:0xe000 Memory:e0210000-e0210fff
这样也可以将网卡的逻辑名字修改,只是这么做开机后配置就会丢失。
如果系统是2.4的内核,好象还可以在/etc/modules文件中通过 alias 设备名 内核模块 的方法来给设备定一个逻辑名。 比如: alias card1 8139too 这种方法我没有用过,只是从资料上看过,所以不能保证它的正确性。
[ 关闭窗口 ]