在配置vmbox虚拟机的时候,为了方便,经常采用复制虚拟机的操作,但是复制后的虚拟机即便采用了桥接网络的方式,还是无法正常连接局域网


后来网上查了一下,可以重新设置eth

首先查看文件 /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:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:92:5e:f2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100e (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:5a:00:b2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

记住eth1 中的mac地址 "08:00:27:5a:00:b2"

然后编辑文件 vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth1
HWADDR=08:00:27:5a:00:b2
TYPE=Ethernet
#UUID=62b19c7b-4fbd-45ef-b73f-73d9bf664f69
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.102.6
NETMASK=255.255.255.0
GATEWAY=192.168.102.1

将原来的eth0,改为eth1,并将HWADDR修改该为上面文件里的mac地址

保存退出后

重启网络

service network restart

即可完成内网的联通

测试输入ifconfig回车,如果能看到刚才文件里设置的ip,标示设置成功!