[Ubuntu Study] 修改eth1,eth0的名稱

因為要測試Router的功能,所以特別拿我老闆的主機來架設,剛好裝好Driver後發覺!為什麼

它的網卡編號是從eth5, eth4開始?!因為它是Ubuntu的系統,所以我特地上網Search一下是不

是有辦法修改eth4,eth5成eth0,eth1,沒辦法因為我們的router因為特殊需求把code寫死去讀eht0,eth1,

幸好很快就找到這篇:http://kanghuanyao.blogspot.com/2009/02/ubuntueth0-eth1.html

目前測試中。

##> sudo vi /etc/udev/rules.d/70-persistent-net.rules


把最後的NAME="eth4",NAME="eth5",改成NAME="eth0",NAME="eth1"。希望會順利,


點再補上是不是成功了。


====================>更新 20111103-10:16


截取其中一個出來看,看來是成功了!



eth1      Link encap:Ethernet  HWaddr 00:80:c8:d8:9a:f5
              inet addr:192.168.10.158  Bcast:192.168.10.255  Mask:255.255.255.0
              inet6 addr: fe80::280:c8ff:fed8:9af5/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:187 errors:0 dropped:0 overruns:0 frame:0
              TX packets:101 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:24173 (23.6 KB)  TX bytes:15979 (15.6 KB)
              Interrupt:16 Base address:0x2400

/etc/udev/rules.d/70-persistent-net.rules的設定檔如下,原來它之前有其他的網卡,所以

才會被安插在eth4開始命名。



john@asus:~$ cat /etc/udev/rules.d/70-persistent-net.rules
# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.


# PCI device 0x10ec:0x8168 (r8169)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:f3:09:42:31", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# USB device 0x0586:0x3401 (zd1211rw)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:13:49:38:3e:47", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"


# PCI device 0x8086:0x1051 (e100)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:14:85:3b:d1:af", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"


# PCI device 0x10ec:0x8168 (r8169)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:f3:08:1b:18", ATTR{type}=="1", KERNEL=="eth*", NAME="eth3"


# PCI device 0x10ec:0x8168 (r8169)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:f3:08:3e:5f", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"


# PCI device 0x1106:0x3043 (via-rhine)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:80:c8:d8:9a:f5", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"



留言

這個網誌中的熱門文章

[Security] wpa_supplicant setup

[Wordpress] 登出時出現 404 Error

[OpenNMS Note] OpenNMS SNMP的誕生