Virtual Machine cross-network segment management by exploring the principle of VMware NAT mode

Source: Internet
Author: User
Tags switches

The VMware NAT Mode principle explores:

Understanding NAT Mode allows us to learn more about how hosts communicate with virtual machines and how virtual machines can achieve Internet access.

And it is easy for us to analyze the problem that the virtual machine cannot communicate with the host and cannot sisu the network.


The following through the actual combat: Virtual network topology, packet capture analysis.


Why explore NAT mode?

Starting from daily needs:

More and more virtual machines are used on our computers, which require fixed IP for easy management.

Network environment will often change, we may work at home and in the company office network segment is not the same, each time to change to the same network segment and then connect to use, more trouble.


First, understand the three modes of VMware:

    1. Bridge mode: Equivalent to a hub, the real host and the virtual machine network segment needs to be configured to communicate. Not suitable for places where the network environment is constantly changing.

    2. Host-only mode: Real host and virtual machine can be different network segments, and can surf the Internet. But can not allocate their own desired IP, found to modify the IP, will not be able to surf the Internet.

    3. NAT mode: Assigned IP, Gateway, DNS by VNET8 NIC, virtual machine can set itself desired IP, specified network segment.

The virtual machine does not need to be in the same network segment as the real host, also can communicate, surf the Internet, more flexible and convenient.


Conclusion: The above requirement is only the NAT mode to satisfy.


Practical Walkthrough:

1. Configure VMware First, open the edit-to-virtual Machine Network Editor--->vmnet8---->dhcp, assign network segment: 192.168.128.0/24.

To open NAT settings, the default gateway is 192.168.128.2 (no modification is recommended), and the gateway for the virtual machine needs to be set up to access the Internet.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s3.51cto.com/wyfs02/M00/07/3A/wKiom1nFLfTCJq90AAEBk0EgHtA048.png-wh_500x0-wm_3-wmp_4-s_1991583517.png " Title= "1.png" alt= "Wkiom1nflftcjq90aaebk0eghta048.png-wh_50"/>


2. Network card configuration for the virtual machine:

Manually configuring the fixed IP:192.168.128.204/24

Gateway: 192.168.128.2

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s4.51cto.com/wyfs02/M02/07/3A/wKiom1nFLiKTR0X-AAAf_NVhlYk111.png-wh_500x0-wm_3-wmp_4-s_3414874111.png " Title= "2.png" alt= "Wkiom1nfliktr0x-aaaf_nvhlyk111.png-wh_50"/>


3. Real-Machine physical NIC Ip:192.168.31.22/24

Gateway: 192.168.31.1


Virtual Network Connection diagram:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/A6/12/wKioL1nItP6Rrc7yAAETW_mBJCY083.png "title=" VMware NAT mode topology. png "alt=" Wkiol1nitp6rrc7yaaetw_mbjcy083.png "/>


Principle Analysis:

First understand the features that VMware software provides: NAT, gateways, Dhcp,dns, and more.

Think of Vmare as a simulation of the NAT device, gateway devices, switches, DHCP devices, DNS and other devices, the real machine and the virtual unit network to achieve mutual communication, virtual machine access to the function.


    1. Understand the role of VMware Network Adapter VMnet8

We found a network card with VMware network Adapter VMnet8 in the real machine, and in the NAT network, we used the VMNET8 switch, and the VMware Network Adapter VMNET8 on the real host connected to VMNET8 switches to communicate with virtual machines. Therefore , the VMware network Adapter VMnet8 is simply a (192.168.128.0/24) communication with the VMNET8 virtual machine switch network and does not provide routing capabilities. Disable the VMware network Adapter VMnet8 network card, the virtual machine is still able to surf the internet, but the real machine and the virtual machine can not communicate.


2. Understand the role of NAT devices

NAT device has two network card, one is the physical network card 192.168.31.22, and the other is the virtual network card 192.168.128.2

NAT will convert the source IP and also convert the destination IP to the NAT table created.


3. Virtual machine on-off network:

Traffic arrives at Gateway 192.168.128.2, theNAT device modifies the destination IP to the real machine physical NIC IP 192.168.31.22, and the physical NIC is then sisu through the router.


4: Virtual machine access to the real machine, that is, 192.168.128.204 access 192.168.31.22

The virtual machine forwards traffic to the Gateway 192.168.128.2, detects the NAT table, maps the destination IP192.168.31.22 to 192.168.128.1, and therefore the virtual network adapter 192.168.128.1 (VMware network Adapter VMNET8) to receive traffic.

The capture package shows that the VMware Network Adapter VMNET8 receives traffic, and the real-computer physical network card has no traffic.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>650 "this.width=650;" src= " Https://s3.51cto.com/wyfs02/M01/07/3A/wKiom1nFLpTQPRITAABTY66j9yE941.png-wh_500x0-wm_3-wmp_4-s_1685043595.png " Title= "4.png" alt= "Wkiom1nflptqpritaabty66j9ye941.png-wh_50"/>

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/A6/11/wKioL1nIrqai56pVAAGIQUP2Q9k068.png-wh_500x0-wm_ 3-wmp_4-s_1648279324.png "title=" 8.png "alt=" Wkiol1nirqai56pvaagiqup2q9k068.png-wh_50 "/>

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

Conclusion: The real machine and virtual machine exchange visits through the WMware provides the VMware network Adapter VMnet8 the net cartoon letter.


This article is from "Lao Cao's Blog" blog, please be sure to keep this source http://jin544642965.blog.51cto.com/1389736/1968425

Virtual Machine cross-network segment management by exploring the principle of VMware NAT mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.