Virtual machine network (NAT mode detailed version)

After the virtual machine is created, we set our corresponding physical machine

(1) First, some configuration of our own physical machine: a network adapter found in our physical machine
Here Insert Picture Description

Click Change adapter option to enter the following interface
Here Insert Picture Description
at this time we use the virtual machine network is the second icon VMnet8, right-click Properties to enter the following
Here Insert Picture Description
double-click to enter the next chart hit IPV4
Here Insert Picture Description

Here Insert Picture Description
Here is what we want to set the focus on the physical machine! We do not want to use automatic IP under my custom. Here I talk about why so configured.
First, this is IPV4 my own physical machine network, look at IP (windows + R, type cmd and then enter ipconfig / all to see) is 192.168.219.104
then my VMnet use is 192.168.219.1 , the default gateway is 192.168.219.2 ( Note here that the default gateway is not set to the virtual machine network ip Oh, we will discuss below)
in addition to IP address and default gateway similar to you with all my other like me on it.

Next, enter the virtual machine configuration official

After the virtual machine is created. Click Reboot to start this setup

Here Insert Picture Description
This is the installation interface restart the virtual machine, and then we enter our root account and password into the login XXX

First, we need to change (uppercase A to enter editing mode) entry into a static dhcp fourth row into the sixth row yes yes changed the last line
item then need to add the following:
IPADDR = 192.168.219.102
NETMASK = 255.255.255.0
= 192.168.219.2 the GATEWAY
the DNS1 = 223.5.5.5
DNS2 = 223.6.6.6

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=fcc18852-431d-472c-9d0d-cd3ca9d4f33a
DEVICE=ens33
ONBOOT=yes

#添加参数
IPADDR=192.168.219.102
NETWASK=255.255.255.0
GATEWAY=192.168.219.2
DNS1=223.5.5.5
DNS2=223.6.6.6

The IP physical machine and then set VMnet8 is 192.168.219.1 so I will set the 102 became, of course, you can set other (1 to 100 can be oh), but never set to 192.168.219.2 is the default so do not be confused gateway.

Here Insert Picture Description
Then press esc enter:! Wq to save and exit
Now enter the command to restart the networkservice network restart
Here there is a description of the command to restart the network issystemctl restart networ butcan not be used! ! ! If we follow this exhausted after walking do not know why the conflict and ping nowhere, so to remind If you have previously by this command to restart, re-create the virtual machine it.
Here Insert Picture Description
If systemctl restart network of virtual machines running OK too you are not displayed but failure. OK display even better then we try to ping Baidu

Eau even if this configuration was successful!

Published 113 original articles · won praise 4 · Views 1568

Guess you like

Origin blog.csdn.net/weixin_39868387/article/details/103939304
Recommended