Home >Operation and Maintenance >CentOS >How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

WJ
WJOriginal
2020-06-02 16:24:323282browse

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine?

1. Problem Description

After cloning the CentOS virtual machine, due to inconsistent network card information, the Internet cannot be accessed or the "sercice network restart" command fails

[root@linuxidc 桌面]# ifconfig  //查看当前网卡信息
[root@linuxidc 桌面]# cd /etc/sysconfig/network-scripts  //进入网卡配置文件目录[root@linuxidc network-scripts]# ls  //查看网卡配置文件中的网卡信息

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

2. Cause analysis

Due to the cloned system, the system only modified the name and MAC of the virtual machine, etc., and in / A line of device name named eth1 is added to the etc/udev/rules.d/70-persistent-net.rules file

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

3. Solution

1. Modify the files /etc/udev/rules.d/70-persistent-net.rules and /etc/sysconfig/network-scripts/ifcfg-eth0 to make two The device name in the file corresponds to the MAC address

[root@linuxidc ~]# gedit /etc/udev/rules.d/70-persistent-net.rules /etc/sysconfig/network-scripts/ifcfg-eth0

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

2. Save after modification, then restart the virtual machine and check the network card information again , found to be normal

How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine

Related reference:centOS tutorial

The above is the detailed content of How to solve the problem of being unable to access the Internet after cloning a CentOS virtual machine. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn