天天看點

【基礎設定】修改網卡裝置名稱

vm使用克隆出來的虛拟機,網卡名稱變成eth1,要把這個eth1改成eth0,參照如下步驟:

檢視eth1對應的mac位址

ifconfig

如:eth1:00:0C:29:74:F2:99

修改/etc/sysconfig/network-scripts/ifcfg-eth0的mac位址為eth1的mac位址

由于vm克隆過來,network-scripts目錄下沒有eth1的檔案,目錄下有一個ifcfg-eth0,修改如下:

hwaddr由原來的mac改成eth1的mac,儲存。

DEVICE=eth0

HWADDR=00:0C:29:74:F2:99

ONBOOT=yes

IPADDR=192.168.198.10

BOOTPROTO=none

NETMASK=255.255.255.0

TYPE=Ethernet

GATEWAY=192.198.198.2

3. 修改/etc/udev/rules.d/70-persistent-net.rules檔案

attr{address} 與 name兩個字段

[root@nginx rules.d]# cat 70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules

# program, run by the persistent-net-generator.rules rules file.

#

# You can modify it, as long as you keep each rule on a single

# line, and change only the value of the NAME= key.

# PCI device 0x1022:0x2000 (pcnet32)

# SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:55:61:94", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:74:f2:99", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

[root@nginx rules.d]# 

4. 重新開機系統

繼續閱讀