- 时间:2021-07-22 11:51 编辑: 来源: 阅读:
- 扫一扫,手机访问
摘要:CentOS虚拟机克隆后无法上网(网卡信息不一致)问题的解决方法
[b]一、问题描述[/b]
虚拟机克隆后,由于网卡信息不一致的问题,导致不能上网或者执行“sercice network restart”命令失败
[root@lyy 桌面]# ifconfig //查看当前网卡信息
[root@lyy 桌面]# cd /etc/sysconfig/network-scripts //进入网卡配置文件目录
[root@lyy network-scripts]# ls //查看网卡配置文件中的网卡信息
[img]http://files.jb51.net/file_images/article/201704/201704240920408.png[/img]
[b]二、原因分析[/b]
由于克隆后的系统,系统只是修改了虚拟机的名字和MAC等,并在/etc/udev/rules.d/70-persistent-net.rules文件中增加了一行名为eth1的设备名
[img]http://files.jb51.net/file_images/article/201704/201704240920409.png[/img]
[b]三、解决方法[/b]
1、修改文件/etc/udev/rules.d/70-persistent-net.rules和/etc/sysconfig/network-scripts/ifcfg-eth0,使得两个文件中的设备名和MAC地址相对应
[root@lyy ~]# gedit /etc/udev/rules.d/70-persistent-net.rules /etc/sysconfig/network-scripts/ifcfg-eth0
[img]http://files.jb51.net/file_images/article/201704/2017042409204010.png[/img]
[img]http://files.jb51.net/file_images/article/201704/2017042409204011.png[/img]
2、修改完之后保存,然后重启虚拟机,再次查看网卡信息,发现已经正常
[img]http://files.jb51.net/file_images/article/201704/2017042409204012.png[/img]
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持编程素材网。