歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux 修改網卡設備名(interface name)

Linux 修改網卡設備名(interface name)

日期:2017/2/28 13:59:05   编辑:Linux教程

今天在本地虛擬機環境下安裝GI時,報了下圖的錯誤,分析原因為網卡的interface name不一致,node1為eth0、ech1和eth2但是node2為eth1、eth2和eth3,這樣在建立完SSH互信後,點擊下一步時,報錯,並且該錯誤不能忽略。

通過網上的解決方法為修改/etc/udev/rules.d/70-persistent-net.rules中ATTR{address}值與/etc/sysconfig/network-scripts/ifcfg-Auto_eth1中的MAC值保持一致,然後重啟服務器即可。

第一步:查看當前網卡的MAC地址值,注意,我的node2是通過vmware的克隆功能來復制的,文件中的值有可能與實際虛擬機的網卡MAC地址值不同。

[root@oel6 network-scripts]# cat ifcfg-Auto_eth1

TYPE=Ethernet

BOOTPROTO=none

IPADDR=192.168.0.12

GATEWAY=192.168.0.1

NETMASK=255.255.255.0

DEFROUTE=no

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="Auto eth0"

UUID=7624a820-03b1-4a8e-abd1-559879087e5d

ONBOOT=yes

HWADDR=00:0c:29:4f:36:73

LAST_CONNECT=1432796101

第二步:修改配置文件 ATTR{address}為對應網卡MAC地址值,並且修改NAME值為想要的值。

[root@oel6 network-scripts]# cat /etc/udev/rules.d/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 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:4f:36:73", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:4f:36:7d", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x8086:0x100f (e1000)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:4f:36:87", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

第三步:重啟機器,使修改生效。

PS:在修改eth0等名字時,需要注意節點間網段的對應。例如,node1上eth0配置成192.10.12.14 則node2上也需要配置成192.10.12.0網段,否則還是報該案例中錯誤。

Copyright © Linux教程網 All Rights Reserved