Acquaintance NAT, bridging, and Host-Only

When using VMware to build a linux virtual machine, there are three ways to choose network connection, especially with respect to such multi-Bowen, combined with their own understanding of the simple record.

Virtual Device

First virtual network adapter, is shown below in view Win7 → Control Panel → Network and Internet → network connection, the first two is the virtual NIC.

(1) VMware Network Adapter VMnet1: Under Host-Only mode virtual NIC

(2) VMware Network VMnet8 Adapter: NAT mode virtual network adapter

(3) Local connection: Use this card in bridge mode?

Followed by the virtual switch, the following is to open the Virtual Network Editor presented at VMware.

(1) VMnet0: bridging mode virtual switch

(2) VMnet1: Host-Only mode, the virtual switch

(3) VMnet8: NAT mode virtual switch

Bridge Mode

As shown below, a physical bridge mode the card is a card machine and the virtual machines connected by a virtual switch VMnet0, the status of the virtual and physical machines rather, only the virtual machine virtualized out of it, and they enjoy physical machine network section, so the use of this mode requires the virtual machine to configure the gateway card, and a subnet mask, DNS and the same physical machine. In this mode, you can easily use the physical machine to access a virtual machine, the virtual machine to access the Internet network resources through host network, if the host is not connected to the Internet, a virtual machine can not be accessed outside the network.

 

Also between the physical and virtual switch VMnet0 connected by the virtual bridge, VMware Bridge Protocol need to open the local connection.

 

NAT mode

Will use virtual network adapter VMware Network Adapter VMnet8 and virtual machine switch NAT mode on the host VMnet8 connection, the virtual network adapter on the host just let the virtual and physical machines can be connected, Xshell on to make the physical machine connected to the virtual machine, you need to activate this card . And access the Internet, the need to use NAT address translator, NAT virtual machine access the network packet converter will add a special marker, and the virtual machine ip ip is converted to a physical machine, the access network will be considered to be received access to the physical machine, when the return packet, the NAT address converter according to the special mark on the packet transmission request is forwarded to the virtual machine.

Virtual role of the DHCP server in NAT mode, when the physical machine is the virtual machine to access, it can be performed by the address resolution, the following physical machine ping virtual machine direct access directly by the virtual machine configuration of hosts address.

Virtual machine host configuration

192 168 145 128 node01 
192 168 145 129 node02

Node01 or node02 physical machine to a virtual machine ping, OK.

C: \ the Users \ Administrator> of ping amdha02 

are Ping node02 [192.168.145.129] having 32 bytes of data: 
Reply from the 192.168.145.129: bytes = 32 time <1ms TTL = 64 
reply from 192.168.145.129: Byte = 32 time <1ms TTL = 64  from the reply 192.168.145.129: bytes = 32 time <1ms TTL = 64  from the reply 192.168.145.129: bytes = 32 time <1ms TTL = 64 
 192.168.145.129 the Ping statistics: packet: sent = 4, received 4 = loss = 0 (0% loss), the estimated round trip time (in milliseconds): minimum = 0ms, the longest = 0ms, average = 0ms

By default another physical machine is unable to access the virtual machines in NAT mode, but can also be achieved by setting WMware NAT port forwarding.

After setting the physical machine will have access to a virtual machine NAT mode, the figure shows the successful connection.

# Physical machine access the virtual machine, using the interface to forward 
[@ amdha02 the root / Home] # SSH -p 44444  176.222 . 10.84 
Last Login : Thu On Oct . 17  . 17 : 32 : 05  2019 from 176.222 . 10.251 
[amdha01 the root @ ~] # hostname 
amdha01 
[amdha01 the root @ ~] # CD / home 
# shows the rear view discovery forwarding virtual machines home directory 
[@ amdha01 the root / home] # LL 
Total 9776 
-rw-R & lt -. r--    . 1 the root the root            0 On Oct 14  . 11 :32 book
drwx------.   4 clyang   clyang      4096 Oct 11 18:44 clyang
drwxr-xr-x. 116 root     root       12288 Oct 15 10:56 etc
-rw-r--r--.   1 root     root     9896069 Oct 15 10:48 etc.tar.gz
-rw-r--r--.   1 root     root          94 Oct 15 14:37 sql.txt
drwx ------.    . 4 STU1 with BigData      4096 On Oct 12 is  14 : 09 STU1 
drwx ------.    . 4 STU2 with BigData      4096 On Oct 12 is  14 : 09 STU2 
# Sign 
[@ amdha01 the root / Home] # Zimbabwe Logout 
Connection to 176.222 . 10.84 Closed. 
[the root @ amdha02 / home] # CD / home 
# view the discovery shows that the present machine home directory, this machine is to use a bridge cross-mode connection, so the effect is similar to the actual physical connect test 
[the root @ amdha02 / home ] # LL 
Total . 8 
drwxr -XR-X. . 3 root root 4096 Oct 14 17:27 1907
-rw-r--r--. 1 root root    0 Oct 14 17:29 book

Host-Only mode

Host-Only mode and NAT mode is similar, but less NAT Address Translator, virtual machines can not access the external network, only through virtual switches and virtual network card VMnet1 VMware Network Adapter VMnet1 access to the physical machine.

The above is the NAT, bridging and Host-Only three modes initial understanding, there are three modes of different application scenarios, the subsequent experience.

 

Reference Hirofumi:

(1) https://www.jianshu.com/p/9a9d8280f068

(2)https://blog.csdn.net/wuhuimin521/article/details/80033378

Guess you like

Origin www.cnblogs.com/youngchaolin/p/11692187.html
NAT