The ubuntu network between the host and the virtual machine cannot be pinged

1. The host and the virtual machine cannot be pinged

In embedded development, the process will involve network issues. The most commonly used one is that the development board is mounted on the virtual machine (ubuntu) to ubuntu through the NFS service, which involves whether the network can be pinged.

The prerequisite for the development board to ping the ubuntu virtual machine system is to first ensure that the host can ping the ubuntu virtual machine system.

This article mainly summarizes the possible factors that cause the network between the host and the virtual machine to fail to ping.

2. Solution to the problem

1. Environment

Physical connection: The development board needs to be powered on, and the network cable needs to connect the network port of the development board to the laptop.

The host is set with a fixed IP address, and the ubuntu virtual machine system is also set with a fixed IP address. At the same time, the IP addresses of the host and the ubuntu virtual machine belong to the same network segment (the IP addresses here include: IP address + subnet mask + gateway).

The host cannot ping the ubuntu virtual machine, and the ubuntu virtual machine cannot ping the host either.

 The host IP address is set as follows:

 

Confirm the IP address set by the host, the operation is as follows:

Enter cmd in the search bar to bring up the Windows 10 console, and enter the ipconfig command in the console, as shown below:

C:\Users\WangTian\ipconfig
Windows IP 配置

以太网适配器 以太网 2
    连接特定的 DNS 后缀 . . . . . . .  :
    本地链接IPv6 地址 . . . . . . . .  : fe80::2cf5:bfcd:8183:de88%44
    IPv4 地址. . . . . . . . . . . .  :  192.168.1.65
    子网掩码 . . . . . . . . . . . .  :  255.255.255.0
    默认网关 . . . . . . . . . . . .  :  192.168.1.1
    .
    .
    .         

The IP address of the ubuntu virtual machine is set as follows:

Confirm the IP address set by ubuntu, the operation is as follows:

The hardware and software environment configuration is as above, but the host and the ubuntu virtual machine system cannot ping each other, that is, the host cannot ping the ubuntu virtual machine, and the ubuntu virtual machine cannot ping the host either.

2. The host and ubuntu cannot be pinged

There may be the following reasons why the network between the host and the ubuntu virtual machine system cannot be pinged . It will be described in detail below .

(1) The host does not close the firewall

Enter "firewall" in the search bar of windows 10 (in the lower left corner of the computer) to open the firewall settings. Here I have turned off all network firewall switches.

(2) The network card of the virtual machine is not set correctly

Open the virtual machine, namely Vmware-Workstation. First, shut down the ubuntu system.

Shut down the ubuntu system pointed by the shear head, as follows:

Open "Compile" ---> "Virtual Network Editor", click "Change Settings".

The operation is as follows:

After opening the "Change Settings" option, it will enter a new network configuration interface, if "Bridge Mode" is selected.

Then you need to select the network card in bridge mode. The name of the network card is the same as the name of the wired network card used by the host. It can be confirmed by checking the name of the wired network card of the host.

 

Therefore, the selection here is consistent with the name of the host network card. As follows:

   

If the virtual machine uses "NAT mode", set the IP address under "NAT mode".

Select "VMnet8 NAT Mode", and set the "Subnet IP" and "Subnet Mask" in the red box in the figure below. The network segment of the subnet IP must be the same network segment as the ubuntu system (or host).

Then set the IP address in the "NAT Settings" in the direction of the cut head in the figure below.

As follows:

"NAT Settings" interface to set "Gateway IP". The IP address also needs to be on the same network segment as ubuntu. The settings are as follows:

Determine the network mode used by the ubuntu system

Open the virtual machine and open "Virtual Machine" ---> "Settings" in the top menu bar.

Open the "Network Adapter" option, you can see the network connection mode in the red box in the figure below. You can choose "Bridge Mode" or "NAT Mode". As follows:

Summarize

 There are three main network configurations for Ubuntu:

(1) Bridge mode : Ubuntu and the host each have an IP address. (emphasis)

(2) NAT mode: Ubuntu and the host share the IP address.

(3) Host mode: Ubuntu can only communicate with the host.

The ubuntu virtual machine prefers "bridge mode", tested. In ubuntu's "NAT mode", the development board sometimes fails when pinging the ubuntu system.


 

Guess you like

Origin blog.csdn.net/wojiaxiaohuang2014/article/details/131533204