红联Linux门户
Linux帮助

Linux修改网卡设备名(interface name)

发布时间:2015-08-13 22:04:20来源:linux网站作者:winston_DBA

今天在本地虚拟机环境下安装GI时,报了下图的错误,分析原因为网卡的interface name不一致,node1为eth0、ech1和eth2但是node2为eth1、eth2和eth3,这样在建立完SSH互信后,点击下一步时,报错,并且该错误不能忽略。

Linux修改网卡设备名(interface name)

通过网上的解决方法为修改/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网段,否则还是报该案例中错误。


Linux自动生成设备名的方法:http://www.linuxdiyf.com/linux/7439.html

Linux与grub下查看各分区设备名称:http://www.linuxdiyf.com/linux/7396.html