Ubuntu下更改eth0網絡卡名稱為eth1

2021-09-08 03:27:55 字數 1163 閱讀 9957

這個方法用於解決ubuntu下更換網絡卡後,新網絡卡變更為eth1,並且源網絡卡的名稱eth0,無法給新網絡卡用的情況。也可以用於為網絡卡更名。

網絡卡mac位址改變之後,在linux中找到網絡卡,新的網絡卡會被識別為eth1或者更為靠後的網絡卡寫入到/etc/udev/rules.d/70-persistent-net.rules這個檔案中,修改/etc/udev/rules.d/70-persistent-net.rules這個檔案,將eth0的mac位址修改為改變後的位址就可以。

首先備份檔案

/etc/udev/rules.d/70-persistent-net.rules

1

cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules_backup

然後修改這個檔案

1 gedit /etc/udev/rules.d/70-persistent-net.rules

# this file maintains persistent names for network inte***ces.

# 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 0x14e4:0x1713 (tg3)

subsystem=="net", action=="add", drivers=="?*", attr=="00:1e:ec:0f:79:f

6", attr=="1", kernel=="eth*", name="eth0"

# pci device 0x8086:0x4222 (iwl3945)

subsystem=="net", action=="add", drivers=="?*", attr=="00:1f:3c:48:70:b

1", attr=="1", kernel=="wlan*", name="wlan0"

將其中的eth0,改為eth1,如果需要將沒用的網絡卡裝置刪除。儲存後重啟系統即可。

eth0網絡卡配置詳解

配置 說明 device eth0 網絡卡裝置名,eth0表示第一張網絡卡 bootproto none 是否自動獲取ip none static dhcp 當值為dhcp時,只需配置上述例子中的那幾項就可以聯網 hwaddr 00 0c 29 11 30 39 mac位址 nm controlle...

eth0網絡卡配置詳解

配置 說明 device eth0 網絡卡裝置名,eth0表示第一張網絡卡 bootproto none 是否自動獲取ip none static dhcp 當值為dhcp時,只需配置上述例子中的那幾項就可以聯網 hwaddr 00 0c 29 11 30 39 mac位址 nm controlle...

ubuntu 16 04網絡卡找不到eth0

自15版本開始就不叫eth0。可以通過ifconfig進行檢視 其中enp3s0才是網絡卡的名稱,lo為環路。參考 1 sudo vi etc default grub找到grub cmdline linux 改為grub cmdline linux net.ifnames 0 biosdevnam...