VMware Virtual Machine Network connection mode

Source: Internet
Author: User
Tags virtual environment

1 Differences and usage of VMware virtual machine bridged, host-only, and NAT network modes

VMware offers three modes of operation, which are bridged (bridged mode: corresponding Nic vment0), NAT (network address translation mode: corresponding Nic vment8) and Host-only (host mode: corresponding Nic vment1). Three network cards can be understood as three channels. To properly apply them in network management and maintenance, you should first look at these three modes of work.
(under Linux ifconfig display eth0 first network card IP, (ETH is Ethernet Ethernet, here refers to the network interface), but also vment0, installed VMware will appear vmnet0,vment1,vment8, The vment is the abbreviation for the VMware Network Adapter (either an Ethernet adapter or a NIC), and the results under Linux ifonfig similar to the results of VMware ipconfig under windows)

1.bridged (Bridging mode)

In bridged mode, VMware's virtual operating system is like a standalone host on a LAN that can access any machine in the network. In bridged mode, you need to manually configure the virtual system with an IP address, subnet mask, and a host machine in the same network segment so that the virtual system can communicate with the host machine. At the same time, because this virtual system is a separate host system in the LAN, it is possible to manually configure its TCP/IP configuration information to enable access to the Internet through a LAN gateway or router.

The relationship between a virtual system and a host machine using bridged mode is like two computers connected to the same hub. To make them communicate with each other, you need to configure the IP address and subnet mask for the virtual system, or you will not be able to communicate.

If you want to use VMware to create a new virtual server within the LAN, to provide network services for LAN users, you should choose bridged mode.

This is the simplest way to directly bridge the virtual network card to a physical network card, and the Linux next NIC binding two different address similar, in fact, the network card is set to promiscuous mode, so as to achieve the ability to listen to multiple IPs.

In this mode, the inside of the virtual Machine network card (for example, Linux under the eth0) directly connected to the network of physical network card, you can imagine that the virtual machine and host machine in a peer position, the network relationship is equal, no one who is behind the problem.

It's easy to use this approach, provided you get more than 1 addresses. For friends who want to do a variety of network experiments, because you can not control the network of virtual machines, it went directly out.

2.NAT (network address translation mode)

Using NAT mode, the virtual system uses the NAT (network address translation) function to access the public network through the network where the host machine resides. In other words, the use of NAT mode enables access to the Internet in virtual systems. The TCP/IP configuration information for a virtual system in NAT mode is provided by the DHCP server of the VMNET8 (NAT) virtual network and cannot be modified manually, so the virtual system cannot communicate with other real hosts on the local area network. The biggest advantage of using NAT mode is that virtual system access to the Internet is very simple, you do not need to do any other configuration, only the host machine can access the Internet.

This approach can also be implemented in the host OS with the guest OS two-way access . But other machines within the network cannot access the Guest OS(Can I add port mappings?). has not been tried), the Guest OS can access other machines within the network through the host OS with the NAT protocol. The NAT mode IP address configuration method is assigned an IP in VMware's virtual DHCP server, where the route is already set, which is pointing to

If you want to use VMware to install a new virtual system, you can directly access the Internet without any manual configuration in the virtual system, it is recommended that you use NAT mode.

In this way, there is a virtual network card Vmnet8 (by default), if you have a NAT server experience, the VMNET8 is equivalent to connect to the intranet network card, and the virtual machine itself is the equivalent of running on-line machine, The network card within the virtual machine (eth0) is independent of the vmnet8.

You will find that in this way, VMware's own DHCP is loaded into the Vmnet8 interface by default, so that the virtual machine can use the DHCP service. More importantly,VMware comes with a NAT service that provides address translation from Vmnet8 to extranet, so this situation is a real Nat The server is running, except for virtual machines . (This route IP also exists, is the gateway IP , the DNS Server IP it's the same. The IP found with host OS vmnet8 is within a network segment. For example, if you want to set the gateway statically, the DNS IP is, while the other is dynamically allocated or set to 192.168.2.X) Obviously, if you have only one extranet address, this approach is appropriate.

3 Host-only (host mode)

In some special network debugging environments, it is required to isolate the real environment from the virtual environment, then you can use the host-only mode. In host-only mode, all virtual systems can communicate with each other, but virtual systems and real networks are isolated.

Note: in host-only mode, the virtual system and the host machine system can communicate with each other , which is equivalent to the two machines connected by twisted pair wires.

In host-only mode, the TCP/IP configuration information (such as IP address, gateway address, DNS server, etc.) of the virtual system is dynamically allocated by the DHCP server of the VMNET1 (host-only) virtual network.

If you want to use VMware to create a virtual system that is isolated from other machines in the network, you can choose Host-only mode for some special network debugging work.

This should be the most flexible way to be interested in a variety of network experiments. Unlike NAT, the only difference is that, in this way, there is no address translation service, so, by default, the virtual machine can only be accessed by the host, which is also the meaning of the hostonly name.

By default, a DHCP service is also loaded onto Vmnet1. The virtual machine connected to the VMNET1 can still be set to DHCP, which facilitates the configuration of the system.

Is this the way there is no way to connect to the external network, of course not, in fact, this way more flexible, you can use your own way, so as to achieve the most ideal configuration, for example:

A. Use your own DHCP service: first stop VMware's own DHCP service and make DHCP service more uniform.

B. Use your own NAT to easily join a firewall. There are many ways that Windows host can do NAT, simple as Internet sharing with Windows XP, and complex NAT services such as WindowsServer.

C. Use your own firewall. Because you have complete control over the VMNET1, you can join (or experiment) the firewall between the VMNET1 and the extranet's network card.

As can be seen from the above, hostonly this mode is similar to the normal NAT server with the whole intranet, so you can easily carry out experiments related to it, such as fire-proof strong settings.

How to work with VMware Host only

In this way of working, the guest is assigned an IP address by the DHCP server. and can maintain communication between the 192.168.222.X. However, it is not possible to ping the address of host on the guest machine. Because the communication is limited to the host (so called host only). This looks like a NAT approach, but in this way the guest can only communicate with the host and not communicate with the local area computer unless it is forwarded or routed on the host.

Example: the VMNET8 virtual network in the NAT mode mentioned above, the VMNET1 virtual network in host-only mode, and the VMnet0 virtual network in bridged mode are all generated by the automatic configuration of VMware virtual machine and do not need to be set by the user. VMnet8 and MNET1 provide DHCP services, and VMNET0 virtual networks are not available. #P #

VMware three Internet connection settings


Use Vmnet0 by default

The IP settings of the virtual machine are not used with the host network segment, the rest is the same as the host:

For example, the host IP is, and the virtual machine IP is set to Netmask,broadcast,gateway,dns both with the host

The same is true for virtual machines <---> Host virtual machines <----> Internet communications.


Use Vmnet8 by default

DHCP: DHCP is the default state.

As long as the physical function is connected to the network, the virtual machine can be connected.

Manual settings:

(It is important that you view its default address by opening the Vmnet8 property under the network properties of the physical machine.) But do not change OH) IP settings with the VMNET8 segment, Gateway set to VMNET8 Gateway (xxx.xxx.xxx.2) can be found in the vmnet8 Gateway, usually edit->virtualnetwork editor->host Virtual Network Mapping, Find VMNET8 , click the left arrow icon, select Nat , you can see the gateway Netmask,broadcast Settings and Vmnet8 Same, DNS set the same as the host . (DNS province can also, he will automatically let the Gateway conversion parsing) For example Vmnet8 ip: here is the system default, can not change the OH.

Virtual machine settings: ip: gw: DNS: (empty) or: (in fact, you think, such a setting is actually the same as the DHCP assignment, nothing special, It doesn't make any sense.)

Note: NAT is similar to a router (like a router in a cloud computing lab, where the extranet accesses nodes of a cluster, except for NAT mapping), so VMware Workstation set up NAT after the virtual machine is available to the Internet, However, the extranet access is not available (except for port mappings, as explained below)


Use Vmnet1 by default

DHCP: DHCP is the default

Make up a virtual network isolated from the physical network

But one thing is that you can communicate with the host machine.

Of course you can specify the IP manually, but the network header to select VMNET1 IP OH


Host-only This mode is a standalone host mode, meaning is not able to communicate with the outside world . But we can understand that this pattern uses vmnet1, which is a virtual switch.

Analysis of reasons for not being able to surf the Internet:

The virtual machine itself is assigned an IP based on its own DHCP, and the physical machine is not within a segment. You have to ask, if manually assigned to the physical machine segment IP with the same DNS resolution is not OK?? But it's also not possible to tell people that. There is no bridging with NAT these modes of sharing and converting IP are also not connected (this is just my personal understanding.) Isn't it possible to surf the Internet? I'll see.


1, in the physical host's local connection set to the Vmnet1 share (must be Vmnet1 oh, why don't I say it ^_^) so Vmnet1 connected IP will become, which is the same as our usual physical machine sharing connection

2, manually set the same IP in the same segment as the physical machine, with the same DNS resolution (or the IP of the physical host), the gateway is set to


guest: NETMASK

Frankly speaking, we use the virtual machine as a physical machine to carry out the shared network settings, here to ask, then if the agent, think about it, do not ask me oh. I'm learning too.

Here we are mainly to understand the next virtual Machine connection and host connection of a tacit understanding. Wrong place everyone correct the supplement.

2 External Network access VMware Workstation through the NAT Networked virtual machines


Implement access to virtual machine resources from other hosts on the host or host network, such as accessing a Web site built within a virtual machine.


Host: Windows 7 (64bit)

Virtual Tools: Vmwareworkstation 7.1

Virtual machine: Ubuntulinux 10.4 (32bit)

Host ip:

Virtual Machine ip:


1. Virtual tools set up the virtual machine through the NAT network, as shown, if the host can surf the Internet, the virtual machine inside should also be able to surf the Internet.

2. The virtual machine inside the site is built, such as the default site Tomcat created: http://localhost:8080/, open as shown.

3. Open "Edit" → "virtualnetwork Editor", select the NAT mode of the virtual network card, as shown in.

4. Open "NAT setings" → "add" to increase the mapping result as shown.

The implementation process is as follows.

(1) Open "Add" as shown in.

(2) to "host port" for other machine access to the port number, such as the host IP is, if "host Port" is set to 332538859, the URL to access Tomcat is:/http This sets the "Host port" to 8080.

(3) Enter the IP address of the virtual machine (which can be seen with ifconfig-a), such as

(4) Enter the resource port number of the virtual machine into "vitual" port, for example, the Tomcat-built site default port number is 8080, then enter 8080. (It seems that if you are building something else, you need to get the default port number)

(5) Enter the annotation information for this port in "Description", for example, enter "Tomcat port mapping inside the virtual machine".

(6) After setting up, it is best to save and apply.

5. Access the Tomcat site of the virtual machine through this host , enter the URL:http://localhost:8080 can open the page as follows (???). is the input http://192.168. 1.100:8080 Bar ). to access the virtual machine from the host on the host network Tomcat site , you need to specify the host address, for example, the host address is, then the URL to access is:/http

Once configured successfully over the virtual machine port mapping, the sudden need to use this feature tonight, a moment to think about it, from the online search, took a lot of time to find the answer, one of their own search is not smart, and search engines are not smart enough, so wasted a lot of time.

It would be more meaningful for a successful event to be recorded for future reference. One can avoid making two mistakes, and the things you do to succeed can be shared with anyone else, and it's a fun thing to do.

-In the early hours of October 9, 2010

Apache is installed on the virtual machine, the IP address of the LAN can be accessed on the local computer, but the external network can not be accessed through the IP address of the extranet. Apache Port I have changed to 8000, the virtual machine with the Ubuntu9.10 operating system, the firewall is also turned off, do not know if there is no way to let the Internet access to my Apache AH.

1 The network of your virtual machine to use bridging mode . if it's not a bridging method but NAT to add port mappings to your virtual machine in the Virtual Machine network settings  .
(This indicates that the virtual machine does the server to provide external services, the simple method is bridging, if there is no IP , use it . nat+ port mapping to implement)
2 on your extranet router you want to map the port to the IP that your virtual machine obtains (this is the bridge mode), if it is not bridged. It is necessary to map the port of the extranet router to the port on your local computer.

3 Turn off the network firewall for the machine and the virtual machine. If you do not want to close, you have to add the rules in the network spinning firewall, so that the data can correctly reach the virtual machine.

See also: vmware_workstation instance two: virtual machine with single IP provides extranet access
2008, I wrote an article on how to set up a VMware Workstation virtual machine Dual network card to enable the external network access to the virtual machine, after a lot of friends sent me e-mail or message, ask the single network card LAN or single public network under the IP how to achieve similar functions. After my reply, I wanted to write an article to answer my friends ' questions. After more than two years, let's share the VMware Workstation virtual machine single-NIC single public network IP to enable the external network access to virtual machines.

    • Network topology

    • Clarity

    • NAT settings for single-Nic machine vmware Workstation

    • Port Forwarding

    • Set port mappings on a router or firewall

    • Network test

Network topology

First of all, in general, in addition to the machine room hosting machines, units or personal family and other network servers are generally less than the direct distribution of public IP, three types of network mode diagram is as follows:


Knowing the topology of the network above, the things we need to do are clear. First, find out where the differences between VMware three network models are. Second, use different VMware network settings depending on the network environment:

Home and company or unit, because the machine is in the internal LAN, can use more IP address, so you can use the default bridged mode,bridged mode generally do not need to set up a virtual machine when the next, the default is Bridged way. If you want to implement dual NIC mode, you can refer to my previous article: "VMware workstation Virtual machine instance: Let Extranet access virtual machine".

The focus of this article, but also many friends asked: the computer room in a single IP server installed virtual machine to provide services to the external network mode . That is, pattern 3 in the image above. In this mode, the bridged mode cannot be used because the IP address is unique. host-only mode is fully closed mode, only access to the host (host), and even the external network can not be connected, so the host-only mode is ruled out. So, we have the NAT mode left in our eyes.

NAT settings for single-Nic machine vmware Workstation

According to the above analysis, we have a clear idea. is to use the VMware NAT network mode. Then there are two main points to follow:

    • Adjust the network mode of the NIC that establishes the virtual machine, and select Use NAT mode. Such as:

    • Port forwarding is performed using the port Forwarding feature in VMware's NAT settings.

Port Forwarding

  1. After using the VMware NAT Network mode, locate the IP address of the virtual machine. The virtual machine's network card is the DHCP mode, please enter the virtual machine to find the IP address of the virtual machine, such as the example in this article is Ubuntu virtual machine, in the red circle is the virtual machine's IP address:

  2. Click "Edit"-"Edit virtual network" on the VMware Workstation main interface, such as:

  3. Open the Virtual network card editing interface for VMware Workstation.
    Find the virtual network card that the mode is NAT, after the point, then point the following Nat Settings ... such as red circle position:

  4. In the NAT Settings tab, locate the contents of Port Forwarding and start adding it as the Add button in the red circle as follows:

  5. In the pop-up tab, fill in and select the port on which the host listens, the Port protocol type, the IP address of the virtual machine, the port that the virtual machine listens to, and the description. Once set, press OK to return to the virtual machine main interface. It's my virtual machine. The 80-port Setup diagram for the HTTP service:

  6. It is important to note that when this is set, the port of host port must be a port that the host does not listen to, otherwise an error occurs.

  7. After the setting is successful, the netstat command is used to see that the host has listened to the ports we have filled out, and the program listening on the port is Vmnat.exe

  8. If you set it up, the rest is the test. If you are a home or business, you may also need to set the port mapping to the host on your router or firewall

  9. After Setup, when the extranet accesses port 80, the NAT port forward forwards the access request to the virtual machine, which is roughly as follows:

Set port mappings on a router or firewall

This is more difficult to understand, different brands of routers, firewalls are not set up the same way. Here I give the port mappings of D-Link DI-624:

About this part of the setup, you can go to Baidu and Google search to see, there are a lot of tutorials. As for firewalls, there are generally detailed instructions or manufacturers to provide technical support.

Network test

Once configured, network testing is also required.

    1. Know that the current network IP address (fixed IP users can be a little bit this step), open ip138 This site can be aware of their current IP address.

    2. Ask your friends on the Internet to help you test.

    3. Using some free website status detection services on the Web, this can be found in many search engines.

In conclusion, after two years, Wei Yu's own computer used in the virtual machine has changed from VMware Workstation6 to VMware Workstation7. Many friends ask is VMwareWorkstation7 virtual network card settings, in fact, we look at the picture, you will find that the virtual network card settings This part of the change is not small. In addition, this article is very superficial, the purpose is to help you in the shortest possible time to achieve the goal, can be said to be just a palliative approach. But Wei Yu personal ability is limited, the focus of work is not this, so the face of deep-seated things will be powerless. If you have any ideas about the content of the article, please leave a message or e-mail discussion.

3 the Internet of virtual machine NAT article

Virtual machine of the home of the original reprint please indicate the source thank you

Having spent so much time on the forums, the most frequently asked question was how the virtual machine went online.
I have a personal understanding of the virtual machine, the most convenient to use the virtual machine Internet is the most difficult to understand the NAT way and we chat, because is a big talk nat, so said will be wordy point, but mainly to take care of new people. :)
The veteran will fly quickly.

Say something else first, as a primer.

Suppose now R teacher with 3 classes of students, respectively, Class A, Class B, Class C. Now there are two ways of communication:

1th Mode of communication:
Exchange in this class, for example, a class A classmate want to communicate with another classmate, you can directly in the class to shout the name of the classmate. This is the way to communicate with computers in the same network segment of a computer-broadcast.

2nd Mode of communication:
Class and the student exchange between class, this time in Class A directly shout B class students name is no effect, because across the wall, it is not heard at all. This kind of computer with different network segments is not able to communicate. This time two classes of students want to communicate must pass R teacher to do the messenger. This is similar to a gateway in the network. Class A students to say the words told R teacher, R teacher to tell the words to Class B classmates.

We take this example to the network learning, easy to understand

School = Internet
class = Network Segment
Student = Computer
Teacher (Messenger) = virtual NAT server

Sorry, my girlfriend told me to go to the streets, first write this, next time to write
What else is the knowledge of the virtual machine, to my big talk, please keep abreast in the following description

I'm sorry, everybody, I'm late, and I wrote it last time.

The way virtual machines use NAT to surf the internet is similar to the 2nd type of communication I've given in my example.

The bridge is in good agreement with the 1th mode of communication.

For example, if you install a virtual system and choose Nat mode, the virtual NAT server acts like the R teacher. Responsible for virtual machines (Class A) and computers on the Internet (students in Class C) communicate.

Draw a little figure 1 to show you

It's a lot easier to say with a picture.

The features of Nat's Internet mode

1. The host's virtual network card is not set (default is auto-acquired)
2. The network card in the virtual system is not set (default is auto-acquired)
The premise of this two implementation is that the virtual DHCP server works for everyone Figure 2

Looking at a NAT Figure 3

After looking at this 3 figure, we basically understand. But this is not convincing, let me explain here.

Where quite with the position of R teacher, in Figure 1 is marked with a virtual NAT server

Figure 3 Specifies the IP address of the NAT.

Ipconfig of the host Figure 4

Ipconfig of virtual machines Figure 5

Now use a command Trcert to show that the virtual machine is surfing through the NAT server

The tracert command is used to display the path through which the packet arrives at the destination host and displays the time it takes to reach each node. The command function is similar to ping, but the information it obtains is much more verbose than the ping command, which displays the full path of the packet, the IP of the node, and the time spent. This command is more suitable for large networks.

We are now on the virtual machine trcert Baidu to see how the virtual Machine packet book arrives baidu.com
See if there are any (virtual NAT server)

Figure 6

VMware Virtual network-related knowledge

1. Virtual Bridge
A virtual network bridge connects the virtual machine's virtual network card to the host's physical network card. It allows you to connect a virtual machine to the external network on which the host resides. If there is more than one physical NIC on the host, a custom configuration is used to create additional virtual bridges to connect to other physical Internet cards on the host.

2. Host Virtual network card
After the virtual machine is installed, we right-click My Network Places/properties/See two NICs in the Open Networking window, by default "VMware network Adapter VMnet1" for host-only network use; "VMware NetworkAdapter VMnet8 "for use by the NAT network. Right-click the properties of these two network cards, we can see the full name of the virtual network card under the Regular tab. Of course we can also enter Ipconfig in the host's command prompt to learn more about the host virtual NIC

3.NAT Equipment
NAT is a shorthand for network address translation. When the host has only one IP on the outside, using the NAT device, the virtual machine can connect to the external network, we open the "management tool" in the host "service", we can find a "VMware NAT service" service, indicating that the system has installed it as a system service.

4.VMware DHCP Service
DHCP is a shorthand for Dynamic Host Configuration protocol. The DHCP service provides an IP address for a virtual machine that is not bridged to an external network. The IP address of a virtual machine using bridged network mode is provided directly by the DHCP server of the external network where the host hosts reside.

[ original ]vmware diagram of Virtual network card provided

Some beginners to the VMware Virtual Machine Bridge, VMnet1 (only host mode), VMnet8 (NAT mode), I put the meaning of the VMware Network card three map, I hope to be helpful to everyone.
Show not all, please save watch.

4 VMware Virtual machine NAT mode shared Internet access

This is where the virtual machine tutorial is described.

This article is from the "Stick to win" blog, please make sure to keep this source http://lilinji.blog.51cto.com/5441000/1264307

VMware Virtual Machine Network connection 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.