Nat network configuration, network segment modification, solve the problem of no network

Environment description: native window10 system, VMware virtual machine installed, centOS8 installed in VMware, everything is normal after using nat to connect, modify the vm network adapter, modify the network segment, the virtual machine can communicate with the physical machine, the virtual machine cannot be networked in the morning, check found Caused by the inconsistency between the virtual machine gateway and vm8ip

Open the Network and Sharing Center, click Change adapter settings, you can see that these two virtual network cards appear

VMnet8 is a virtual network card created for NAT mode. If you are not sure whether it is VMnet8, you can also check it in VMware. Check the method:

In the VMware menu bar: Edit -> Virtual Network Editor. Will find to open a window as shown in Figure 2

Insert picture description here
In this window, you can see which virtual network card is used in NAT mode.

The next step is to check the DNS of the machine. It is useful when configuring the DNS of the virtual network card VMnet8.

View method.cmd — ipconfig /all. Windows10 will query the following information after executing the command

Insert picture description here
You can know DNS 114.114.114.114, 202.99.192.66

Now configure: virtual network card VMnet8
right click VMnet8 virtual network card, Properties -> ipv4 configuration as shown in the figure,
Insert picture description here
double-click Internet Protocol Version 4 (TCP/Pv4)

The DNS must be the same as the DNS of the local connection. The IP address can be set to a commonly used IP. The IP address set here is: 192.168.0.1 Subnet mask: 255.255.255.0.

Step by step to configure the virtual network editor of the virtual machine in NAT mode:

First open Figure 2 and configure the subnet IP and subnet mask below. Of course, DHCP is not turned on here, because I don't want to change the IP after the virtual machine restarts. Therefore, the "Use local DHCP service to assign IP addresses to virtual machines" is not checked.

Insert picture description hereNote that vmnet1 and vmnet8 should not be on the same network segment, that is, the first three "." numbers should not be the same.
Insert picture description here
Click net to set the gateway IP to be consistent with the static address of vmnet8 above

The NAT in Figure 6 sets the IP address of the gateway set in Figure 4.

After this step is configured, you can configure the relevant configuration of the centOS system in VMware.

Open the network configuration interface. Of course, you can also use commands to configure and edit the network file /etc/sysconfig/network-scripts/ the corresponding file you use the network name.

Insert picture description here
BOOTPROTO =static is to use statically allocated addresses instead of automatically assigning addresses,

IPADDR= Yes as long as it is on the same network segment as vmnet8

NETMASK=255.255.255.0 is the netmask

GETEWAY=192.168.0.1 is the address of vmnet8, which must be exactly the same

DNS=114.114.114.114 is DNS, just write one here

Finally open
Insert picture description here
and restart the network card service nmcli c reload ens33

Guess you like

Origin blog.csdn.net/weixin_44192389/article/details/108757476