In-depth understanding of VMware Virtual Machine Network communication principles

Source: Internet
Author: User
Tags network troubleshooting

There are three ways to access VMware Virtual machines: NAT, bridging, host-only mode, this article describes bridging mode and 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 system: CentOS 6.5

    • Virtual machine Operating system access mode: Bridging 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. In fact, which operating system the virtual machine uses is not affected, in order to facilitate test validation, you should use your familiar operating system.

For Internet mode settings, refer to the following illustration:

2. Theoretical knowledge of bridging mode

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

In fact, the above schematic diagram can be equivalent to the following network topology diagram:

Therefore, when the virtual machine uses bridge mode to surf the Internet, you can treat this virtual machine as a real host in the local domain of the host computer, which uses the same network address information as the host.

It is important to note, however, that since there may be multiple NICs in our host, in VMware Workstation, we can set our virtual machines to bridge to which network card:

, Bo Master is the current virtual machine bridge to the host's wireless card, so the virtual machine network address information should be with the host on the wireless card on the network address information obtained on the same network segment, that is, they are located in the same LAN.

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

Check the network address information on our host first:

You can see the host local area network IP address segment is 192.168.1.0/24, because my host is connected to the WiFi to the Internet, and the use of DHCP to obtain the IP address, so we can set the use of DHCP on the virtual machine to obtain the IP address, The DHCP configuration for CentOS is as follows:

1234567891011121314151617 [[email protected] ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0HWADDR=00:0c:29:3b:4c:6dTYPE=EthernetUUID=5ae16ecc-0149-487e-8dab-51afc75bd265ONBOOT=yesNM_CONTROLLED=yes#BOOTPROTO=staticBOOTPROTO=dhcpIPADDR=10.0.0.101NETMASK=255.255.255.0GATEWAY=10.0.0.2DNS1=202.96.128.86DNS2=202.96.128.166IPV6INIT=noUSERCTL=noPEERDNS=yes

Web Services to restart CentOS:

1234567 [[email protected]  ~] # /etc/init.d/network restart SHUTTING DOWN INTERFACE ETH0:  [  OK  ] shutting down loopback interface:  [  ok   ] bringing up loopback interface:  [   ok  ] bringing up interface eth0:   determining ip information  For  eth0...  done [  ok  ]

Then view the IP address information:

123456789101112131415161718 [[email protected] ~]# ifconfig eth0      Link encap:Ethernet  HWaddr 00:0C:29:3B:4C:6D            inet addr:192.168.1.106  Bcast:192.168.1.255  Mask:255.255.255.0          inet6 addr: fe80::20c:29ff:fe3b:4c6d/64Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:31386 errors:0 dropped:0 overruns:0 frame:0          TX packets:15738 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:14467018 (13.7 MiB)  TX bytes:1726371 (1.6 MiB)lo        Link encap:Local Loopback            inet addr:127.0.0.1  Mask:255.0.0.0          inet6 addr: ::1/128Scope:Host          UP LOOPBACK RUNNING  MTU:16436  Metric:1          RX packets:239 errors:0 dropped:0 overruns:0 frame:0          TX packets:239 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:0           RX bytes:23198 (22.6 KiB)  TX bytes:23198 (22.6 KiB)

You can then test the host's connectivity with the virtual machine and ping the virtual machine's IP address on the host:

Or ping the host on CentOS:

1234567891011121314 [[email protected] ~]# ping 192.168.1.100PING 192.168.1.100 (192.168.1.100) 56(84) bytes of data.64 bytes from 192.168.1.100: icmp_seq=1 ttl=128 time=0.530 ms64 bytes from 192.168.1.100: icmp_seq=2 ttl=128 time=0.482 ms64 bytes from 192.168.1.100: icmp_seq=3 ttl=128 time=0.508 ms64 bytes from 192.168.1.100: icmp_seq=4 ttl=128 time=0.579 ms64 bytes from 192.168.1.100: icmp_seq=5 ttl=128 time=0.447 ms64 bytes from 192.168.1.100: icmp_seq=6 ttl=128 time=0.448 ms64 bytes from 192.168.1.100: icmp_seq=7 ttl=128 time=0.552 ms64 bytes from 192.168.1.100: icmp_seq=8 ttl=128 time=0.220 ms^C--- 192.168.1.100 pingstatistics ---8 packets transmitted, 8 received, 0% packet loss, time7352msrtt min/avg/max/mdev= 0.220/0.470/0.579/0.107 ms

Because the virtual machine and host are all in the same LAN, so they certainly can be interoperable, when the communication is not normal, you need to pay attention to see whether it is because the firewall is turned on the data discarded, so in these tests, are recommended to turn off the firewall.

The above IP address information corresponds to the previous schematic diagram, as follows:

It is then represented by a network topology diagram, which is equivalent to:

So it's clear that when VMware VMS use bridging mode to surf the internet, it's a complete process behind the network communication principle and details.

4. What to do next

The above for the virtual machine uses the DHCP assigned address, the actual use of manual allocation is also possible, then it can and host network communication, you can test it yourself.

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.

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:

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:

In fact, after reading the above diagram analysis, the overall network topology is very clear, in the next step, through our experimental environment to verify.

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:

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:

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:

As you can see from above, the network segment we set up here 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:

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:

So in fact, when our host communicates with the virtual machine's operating system, it uses the source address of the 10.0.0.1 to send packets to the operating system of the virtual machine. We can ping this address on the virtual machine operating system, and we will find that communication is not a problem:

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:

In this way, the overall network information is very clear, and the above can be seen, the host physical network card address is 192.168.1.100/24, which is my notebook local area network assigned to my IP address.

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:

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.

In-depth understanding of VMware Virtual Machine Network communication principles

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.