Settings for connecting to virtual machines in VM NAT mode

In the past, the bridge method was used to connect the virtual machine, but because the company filtered the ip of the Internet, the virtual machine could not access the external network, so I could only use the NAT method to connect, and record the simple steps.

1 View the virtual network editor of vm, and select vmnet8, nat mode, as shown below

Because you want to set a fixed ip, do not check dhcp, record the subnet mask, and click nat settings to view the default gateway



 2 Set the network connection of vmnet8, mainly to modify the subnet mask and gateway. The gateway ip and subnet mask should be modified to the ip in the above figure, the host ip and the gateway ip segment are the same, followed by 0-255, not the gateway ip repeat



 
 3 Set the ip of the linux system


Mainly modify the following parts

BOOTPROTO=static

ONBOOT=yes

IPADDR=192.168.249.71

GATEWAY=192.168.249.2

NETMASK=255.255.255.0

DNS1=202.96.128.166

DNS2=202.96.128.86

4 Restart the linux network

service network restart

5 test

ssh can connect to the virtual machine, and the virtual machine can also access the external network
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326524594&siteId=291194637