In-depth understanding of VMware Virtual Machine Internet mode in practice: Nat mode

Source: Internet
Author: User
Tags network troubleshooting

0. Description


This blog post is one of the "in-depth understanding of the Internet mode for VMware virtual machines in Practice" series: Nat mode.

VMware virtual machines are essential in our learning process, whether it is to install a Linux operating system to learn, build a variety of network services, or to do cluster testing, cloud computing platform OpenStack, and so on, we can say that VMware virtual machine brings us great convenience, The most intuitive benefit is that we can save a lot of money to buy a variety of equipment, but also can achieve the purpose of learning various technologies.

However, as long as it involves communicating with the operating system in the VMware virtual machine through the host, or the various operating systems installed in the VMware virtual machine, it is inseparable from the contents of the computer network, the fact that the various operating systems in the virtual Machine network communication, or let our host and virtual machines communicate with each other, is the common use of VMware virtual machines for a variety of service testing can not be separated from the topic.

Therefore, it is necessary to understand the VMware virtual machine to provide us with a variety of Internet access methods of the more in-depth computer network communication principle, so that we need to build a variety of environments, network problems can be solved, and no longer need to look for a variety of data everywhere, And this will be built in the future involving more than one device to communicate the experimental environment would be very helpful.

Bloggers have learned more deeply about Huawei's and Cisco's knowledge of the relevant level of certification, and last year passed the Huawei ICT highest level certification Hcie-rs, so Ben Boven's writing is a network engineer's perspective to understand the various Internet modes in VMware Virtual machine communication principles, Although it is difficult to really thoroughly understand some of the details, but I believe that you can bring a lot of friends to help.

This blog is written in the form of theory as the main line, the actual operation, in practice, in-depth understanding of VMware Virtual machine in various ways of surfing.

There are three ways to access VMware Virtual machines: NAT, bridging, host-only mode, this article describes Nat mode.



1. Experimental environment


The main experimental environment for bloggers is as follows:

    • Host operating system: Windows 7

    • VMware Workstation version: 12.5.2 build-4638234

    • Virtual machine operating systems: Windows 7

    • Virtual machine Operating system access mode: NAT mode

Note: For the following test to work, be sure to turn off the firewall features of the host and virtual machine's operating system.

For Internet mode settings, refer to the following illustration:

How to set up the Internet in Windows 7:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/EE/wKiom1ivpqiBcyE0AAZI7Km5pRc381.png "title=" Windows7.png "alt=" Wkiom1ivpqibcye0aazi7km5prc381.png "/>



Theoretical knowledge of 2.NAT models


When we set the Internet mode of our virtual machine to NAT mode, the connection relationship between virtual machine, host and Nic can be expressed as follows:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/EB/wKioL1ivpTXhXCLbAALG94naNuk950.jpg "title=" VMware Internet mode principle. jpg "alt=" wkiol1ivptxhxclbaalg94nanuk950.jpg "/> In fact, after looking at the above schematic analysis, the overall network topology is very clear, in the next steps, It is validated through our experimental environment.



3. In-depth understanding of the network principle of NAT mode in practice


In the experimental environment, we can see that we are using NAT to surf the internet, when the NAT mode is set, in the virtual machine operating system Windows 7, view the IP address information:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/8D/EE/wKiom1ivqNjx0VbrAAcv6FSEnUs387.png "title=" IP address information. png "alt=" Wkiom1ivqnjx0vbraacv6fsenus387.png "/>

And this time, you will find that the host and the virtual machine communication is not a problem:

To ping a virtual machine on a host:

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/8D/EC/wKioL1ivqkvCIRjbAACfMVAYhts241.png "title=" Host ping virtual machine. png "alt=" Wkiol1ivqkvcirjbaacfmvayhts241.png "/>

So why is it possible to communicate normally? and the IP address network segment in the virtual machine why is it 10.0.0.0/24?


When using NAT mode to surf the Internet, VMware automatically assigns IP addresses to our virtual machine operating systems, where there is a DHCP server within the virtual machine, and its assigned address segments can be set in VMware.

Select "Edit"-"Virtual network editor" in VMware Workstation, which can be set up:

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/EE/wKiom1ivq8PD6khDAAcxD3MUL7o784.png "title=" Virtual network settings. png "alt=" Wkiom1ivq8pd6khdaacxd3mul7o784.png "/> from the above can be seen, here we set the network segment is 10.0.0.0/24.

In addition, our host is VMnet8 this virtual network card to communicate with the virtual machine operating system, you can see the host's network settings in the virtual network card:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8D/EC/wKioL1ivrFXDsM-_AAF20Qgljds267.png "title=" The host's virtual network card. png "alt=" Wkiol1ivrfxdsm-_aaf20qgljds267.png "/>

Because this virtual network card is used to communicate with the virtual machine operating system, so it is assigned the address is also 10.0.0.0/24, can look at its address:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/8D/EC/wKioL1ivrN2zvqZbAAH_hZwqsZw171.png "title=" Virtual network card address. png "alt=" wkiol1ivrn2zvqzbaah_hzwqszw171.png "/> So actually, when our host is communicating with the virtual machine operating system, is to send a packet to the operating system of the virtual machine using the 10.0.0.1 source address. We can ping this address on the virtual machine operating system, and we will find that communication is not a problem:

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8D/EC/wKioL1ivrt6A1LysAAciH66DjMo017.png "title=" The virtual machine ping host. png "alt=" Wkiol1ivrt6a1lysaacih66djmo017.png "/>

So what is the address of the gateway 10.0.0.2 for the virtual machine operating system?

In fact, the address of the virtual network card corresponding to the NAT server in the network diagram above, just this address we can only see through the virtual machine operating system.

So the address we mentioned above and the network segment information correspond to our diagram, as follows:

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/8D/EC/wKioL1ivr5PzQxNdAAMSz2NTYXk509.jpg "title=" VMware Internet Mode principle (Actual). jpg "alt=" wkiol1ivr5pzqxndaamsz2ntyxk509.jpg "/> This way, the overall network information is very clear, the other above can be seen, The address of the host physical NIC is 192.168.1.100/24, which is the IP address assigned to me by the local area network where my notebook resides.

Through the above diagram analysis, for the virtual machine operating system network communication can have a very clear understanding of:


    • When the virtual machine and the host to communicate: In fact, 10.0.0.1/24 and 10.0.0.132/24 These two addresses to communicate;

    • When the virtual machine communicates with the external network: the virtual machine sends the data to the gateway 10.0.0.2/24, then translates the address to 192.168.1.100/24 through the NAT server, and then communicates with the external network;

    • If the Vmnet8 this virtual network card is disabled, or does not affect the virtual machine access to the Internet, but the host and virtual machine communication will be affected, from the above diagram is not difficult to see.


In this way, the process of communication is very clear! In addition, if we have many virtual machines, and the Internet is NAT mode, it is actually the equivalent of these virtual machines are located in the same LAN, then the virtual machine and host communication, virtual machine access to the network and the above process is the same, and the virtual machine and the communication between the virtual machine is the same local area network communication, so there is no problem, corresponding to the above diagram, this will become a lot clearer.


It should be added that for the DHCP service and NAT service provided by the virtual machine, these services are actually visible on the host where we install the VMware Workstation:

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8D/EC/wKioL1ivsX7yR7JRAAJqsckaXuk569.png "title=" Host-enabled services. png "alt=" wkiol1ivsx7yr7jraajqsckaxuk569.png "/> This can also be a certain correspondence with our theory.



4. What to do next


Consider the case of multiple virtual machines, as mentioned above, and try to test their connectivity to verify the above diagram (especially important), but only if you must have some knowledge of the network.



5. Application in Practice


First of all, the 1th is, when our virtual machine network problems, it is necessary to understand the network topology and then network troubleshooting, so the above content for us to provide a very good theoretical and practical knowledge.

In addition, if you can understand these network knowledge under the premise of building a variety of services, do a variety of tests, can let us do a state of confidence, and is no longer "mirrors, water in the moon," the corresponding in such a constant attempt, our comprehensive operation ability will become stronger.

However, it is still necessary to note that the above diagram is still a reference, many of the details of the need to understand the VMware Workstation network virtualization details to really understand, but anyway, the above for the network communication above, Still can bring us a lot of help, sincerely hope can help everyone!

Due to the limited capacity and time, if you find a problem, hope to point out in time.


Add:

For the network troubleshooting, you can refer to the blogger wrote a blog post: "Network troubleshooting big explanation."


This article is from the "fragrant fluttering leaves" blog, please make sure to keep this source http://xpleaf.blog.51cto.com/9315560/1900870

In-depth understanding of VMware Virtual Machine Internet mode in practice: Nat mode

Related Article

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.