歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> Linux資訊 >> Linux文化

怎麼修改網卡的device name


>>> 此貼的回復 >> 如果系統中用了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 這種方法我沒有用過,只是從資料上看過,所以不能保證它的正確性。

[ 關閉窗口 ]

Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : [email protected]
Copyright © Linux教程網 All Rights Reserved