Linux virtual machine copy can not access the Internet

  

After the Linux virtual machine copy is started, use the ifconfig command to display:

[root@localhost ~]# ifconfig

lo Link encap:Local Loopback< Br>

inet addr:127.0.0.1 Mask:255.0.0.0

inet6 addr: ::1/128 Scope:Host

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions: 0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

[root@localhost ~]#

Using the service network restart command Display:

[root@localhost ~]# service network restart

Shutting down interface eth0: [ OK ]

Shutting down loopback interface: [ OK ]
< Br> Bringing up loopback interface: [ OK ]

Bringing up interface eth0:device "eth0" does not see m to be present, delaying initialization.

[root@localhost ~]#

This means that the new NIC that was virtualized when booting without a virtual machine copy does not work properly.

Here is a description:

Every virtual opportunity has a network card. When we first create a virtual machine and then install the Linux system, the system will detect the current machine during the installation process (the system does not know this). Whether it is a virtual machine or a physical machine) and automatically initialize the configuration. The configuration at this time is generally correct. When we copy this virtual machine with the system installed, copy it to another location and then open it. This is equivalent to taking the original computer to another place, but it is a bit different. When the copied virtual machine runs on the new host, it automatically virtualizes a new NIC from the virtual machine software. This time is equivalent to changing the original computer to a network card, and the system is still the original, so the system's network configuration file is saved in the previous network card information. So it appears in the above situation.

So what can we do?

We can find 70-persistent-net.rules in the /etc/udev/rules.d/directory

We can see at cat 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 0x1022: 0x2000 (pcnet32)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29: 78:86:e9", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

This file is automatically generated. The mac of this device is 00:0c:29:78:86:e9, and our cat /etc/sysconfig/network-scripts/ifcfg-eth0 can see the mac and 70-persistent-net.rules Different.

So when we booted up and configured the network, we used the /etc/sysconfig/network-scripts/ifcfg-eth0 script. This script uses a non-existent network card that cannot access the Internet. So we only change the mac to the mac that is automatically detected.
zh-CN"],null,[0.75012666],zh-CN"]]]

Copyright © Windows knowledge All Rights Reserved