歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu下更改eth0網卡名稱為eth1

Ubuntu下更改eth0網卡名稱為eth1

日期:2017/2/28 16:46:09   编辑:Linux教程

這個方法用於解決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

root@shangyuan-laptop:/etc/udev/rules.d# more 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 0x14e4:0x1713 (tg3)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1e:ec:0f:79:f
6", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3c:48:70:b
1", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"


將其中的eth0,改為eth1,保存後重啟系統即可。

Copyright © Linux教程網 All Rights Reserved