首页 / 操作系统 / Linux / Linux 修改网卡设备名(interface name)
今天在本地虚拟机环境下安装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_eth1TYPE=EthernetBOOTPROTO=noneIPADDR=192.168.0.12GATEWAY=192.168.0.1NETMASK=255.255.255.0DEFROUTE=noIPV4_FAILURE_FATAL=yesIPV6INIT=noNAME="Auto eth0"UUID=7624a820-03b1-4a8e-abd1-559879087e5dONBOOT=yesHWADDR=00:0c:29:4f:36:73LAST_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网段,否则还是报该案例中错误。本文永久更新链接地址