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) # PCI device 0x8086:0x100f (e1000) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:75:d1:d7", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
看到这个文件的name字段后面写的是什么你就编辑一下你的网卡 vi /etc/sysconfig/network-scripts/ifcfg-eth0,只需要把DEVICE=eth0 ,改成/这个文件/etc/udev/rules.d/70-persistent-net.rules的et后面的name字段就好了,这里是eth1,所以你的ifcfg-eth0的内容应该是这样的,编辑完了之后就把/etc/udev/rules.d/70-persistent-net.rules文件删除,重启服务service network restart
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth1 TYPE=Ethernet IPADDR=192.168.0.5 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 ONBOOT=yes NM_CONTROLLED=yes BOOTPROTO=static