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"
# PCI device 0x1022:0x2000 (pcnet32)
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. 重启系统
转载于:https://blog.51cto.com/hxw168/1571255