CentOS 6.4 克隆出来的虚拟机网卡无法使用问题解决

今天我们在VMWare下安装Linux系统, 之后又克隆了2套系统, 在克隆出来的系统内我们发现网卡如何都起不来
$ service network restart
Shutting down loopback interface:                                     [   OK  ]
Bringing up loopback interface:                                          [   OK  ]
Bringing up interface eth0:     Device eth0 dose not seem to be
present, delaying initialization                                            [ FAILED]
 
造成这个问题的原因是 我们是通过 create a full clone 实现的复制虚拟系统的工作
 
在原本的虚拟机里的/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:43:4a:e8", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

我们在看一下克隆出来的虚拟机里 /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:43:4a:e8", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:93:d8:5c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
 
正是由于上面那2行红字, 克隆出来的设备号是一致的, 系统默认的eth mac是克隆出来的eth0, 而新生成的eth mac 则被标示为eth1
 
解决办法1:
我们直接修改/etc/sysconfig/network-scripts/ifcfg-eth0 修改下面红色部分
1 将DEVICE 改为 eth1
2 将IPADD 改为新的IP地址
3 之后重启network服务
 
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.253.130
NETMASK=255.255.255.0
GATEWAY=192.168.253.1
 
$ service network restart
Shutting down interface eth0:                                          [   OK  ]
shutting down loopback interface:                                    [   OK  ]
Bringing up loopback interface:                                        [   OK  ]
Bringing up interface eth0:                                              [   OK  ]
 
解决办法2:
我们直接修改 /etc/udev/rules.d/70-persistent-net.rules 删除下面红色部分, 修改下面蓝色部分
1 删除设备名字为 eth0的那2行
2 将新生成的MAC地址的设备名字改为eth0
3 保存退出后需要重启服务器
 
# 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:43:4a:e8", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:93:d8:5c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
$ reboot

转载于:https://www.cnblogs.com/patton199/p/3318711.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值