Note: The host machine and the virtual machine cannot ping each other

Software used: VMware Workstation, Windows10, Centos7
Reason (everyone’s problems are not necessarily the same, here is a description of the situation I encountered): My virtual machine’s network connection mode is "NAT mode", and my laptop is in a different LAN , the ip automatically assigned to the host machine and the virtual machine will change, but the configuration of the "virtual network editor" of the virtual machine has not changed. The host machine and the virtual machine are in different network segments, resulting in a failure to ping each other.
(Note: Commands to view ip in different environments, windows: ipconfigor ipconfig/all, linux: ifconfig)

Solution:

  1. The network connection mode of the virtual machine is , and vmware will generate a virtual network card VMware Network Adapter VMnet8NAT模式 on the host accordingly , and find this virtual network card through the following path: Control Panel => Network and Internet => Network and Sharing Center => Change Adapter Settings
    Internet connection

  2. Run VMware as an administrator (because modifying network settings requires administrator privileges), find the "Virtual Network Editor" page through the following path: Edit => Virtual Network Editor , generally switch LAN, you need to click "Restore Default Settings" To reassign the gateway and subnet ip to the virtual machine
    insert image description here

  3. Open the virtual network editor => VMnet8 => NAT settings , view the gateway assigned by the virtual machine, configure the ipv4 protocol in the virtual network card VMware Network Adapter VMnet8 according to this gateway , and then confirm to save. It is best to restart the virtual network card to be safe. You can try whether the host machine and the virtual machine can communicate with each other (Note: the custom ip address and gateway must be on the same network segment as the virtual machine)


    insert image description here

If you encounter a virtual machine that cannot connect to the network, you can click this link

Guess you like

Origin blog.csdn.net/qq_40406380/article/details/116056575