虚拟机克隆后遇到的网络相关的问题

0、错误信息:

[root@hadoop101 network-scripts]# service network restart
关闭环回接口:                                             [确定]
弹出环回接口:                                             [确定]
弹出界面 eth0: 错误:没有找到合适的设备:没有找到可用于连接 'System eth0' 的设备。

1、查看系统是否识别相应网卡(发现没有eth0网卡存在):

[root@hadoop101 network-scripts]# ifconfig
eth1      Link encap:Ethernet  HWaddr 00:0C:29:A8:21:63  
          inet addr:192.168.184.134  Bcast:192.168.184.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fea8:2163/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:162 errors:0 dropped:0 overruns:0 frame:0
          TX packets:51 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11995 (11.7 KiB)  TX bytes:4798 (4.6 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4416 (4.3 KiB)  TX bytes:4416 (4.3 KiB)

根据显示信息我们可以初步判定系统网卡信息有问题,没有eth0网卡信息。

2、查看当前MAC地址相关信息:

[root@hadoop101 桌面]# 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:01:26:11", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:0b:a3:b2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a8:21:63", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

发现多出一块eth1网卡信息。

3、删除多余mac地址信息,并修改网卡配置文件:

/etc/udev/rules.d/70-persistent-net.rules 文件下记录着网卡对应mac地址信息:

# 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:01:26:11", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:0b:a3:b2", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:a8:21:63", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

删除 所有eth0的网卡信息,留下eth1。并且记录下eth1对应的MAC地址,将eth1改成eth0 ;

将/etc/sysconfig/net-script/ifcfg-etho的mac地址替换掉

4、重启网络服务service network restart或者重启虚拟机reboot,完成 ~

猜你喜欢

转载自www.cnblogs.com/simon-1024/p/11747228.html