CentOS7 network settings in VMware

After installing CentOS7 using VMware, many small partners found that there is no network function. Ping shows that the ping command is not recognized. The next article will explain how to configure the network after installing CentOS7.

1. There are three network connection modes under VMware

1. Birdged (bridged)

Bridged network means that the local physical network card and virtual network card are bridged through the VMnet0 virtual switch. The physical network card and the virtual network card are in the same position in the topology diagram. Then the physical network card and the virtual network card are equivalent to the same network segment, and the virtual switch is equivalent to A switch in a real network, so the IP addresses of the two network cards should also be set to the same network segment.

2. NAT (Network Address Translation)

In the NAT mode, the virtual machine uses the NAT (Network Address Translation) function to access the public network through the network where the host machine is located. In the NAT mode, the network card of the virtual machine and the network of the physical network card are not in the same network, and the network card of the virtual machine is a virtual network provided by VMware.

3. Host-only (host only)

In the Host-Only mode, the virtual network is a fully enclosed network, and the only thing it can access is the host. In fact, the Host-Only network is very similar to the NAT network. The difference is that the Host-Only network does not have a NAT service, so the virtual network cannot be connected to the Internet. The communication between the host and the virtual machine is realized through the VMware Network Adepter VMnet1 virtual network card.

Mainly discuss bridging and NAT mode

4. Comparison of NAT and bridging:

(1) Both NAT mode and bridge mode virtual machines can access the external network.

(2) Since the NAT network is in a virtual network provided by VMware, other hosts on the LAN cannot access the virtual machine, while the host machine can access the virtual machine, and the virtual machine can access all hosts on the LAN, because the real LAN is relative to The virtual network of NAT is the external network of the virtual network of NAT. Those who do not understand can look up the relevant knowledge of NAT.

(3) In bridge mode, multiple virtual machines can access each other; in NAT mode, multiple virtual machines can also access each other.

Two, NAT mode configuration network

1. Open the virtual machine settings

2. Enter NAT mode

Next, let’s take a look at how to configure the network after entering the CentOS7 system in NAT mode:

Preparation: Find the gateway address in NAT mode (if the partner who enters this step does not have these settings, you can directly refer to the configuration)

Note: The subnet IP and subnet mask in Figure 2 can be set according to your own situation

Note: The gateway IP in Figure 3 can be modified by yourself, but it must be in the same network segment as the subnet IP

Record the gateway ip 10.51.10.2 in Figure 3

Enter the system and automatically assign an ip to the system

Record the IP address assigned by the dh service: 10.51.10.132

Set a static ip for the system to facilitate the use of remote connection tools (xftp&xshell) in the future

Note: The specific name of the file ifcfg-ens* in the second red box corresponds to the ens displayed by ifconfig in Figure 1.

Note: mac address generation: (not necessary to set)

To restart the network service CentOS7 use the following command systemctl restart network.service (very important)

If there is no problem with the above configuration, it is recommended to do the following checks

  1. Whether VMware NET Service and VMware DHCP Service are enabled
  2. Whether the VMware NET Adapter virtual network card is enabled

Verify that the network configuration is successfully pinged to www.baidu.com. If the ping is successful , the network configuration in NAT mode is successful !

 

Guess you like

Origin blog.csdn.net/l_liangkk/article/details/105002758