Three modes--bridged, host-only, NAT for network connectivity on VMware virtual machines

Source: Internet
Author: User
Tags virtual environment

Three modes--bridged, host-only, NAT for network connectivity on VMware virtual machines

VMware offers three modes of operation, which are bridged (bridging mode), NAT (network address translation mode), and host-only (host mode). To properly apply them in network management and maintenance, you should first look at these three modes of work.

1.bridged (Bridging mode)

In this mode, the VMware virtual operating system is like a separate host in the LAN, which can access any machine in the network. In bridging 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 using bridging mode and a host machine 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 bridging mode.

2.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.

3.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.

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.

Hint: The above mentioned NAT mode VMnet8 virtual network, VMNET1 virtual network in host-only mode, and 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 VMNET1 provide DHCP services, and VMNET0 virtual networks do not provide

Based on the information provided above, I chose "bridged (bridging mode)".

Analysis of virtual VMware Three types of network mode fundamental differences

Referring to VMware people think of virtual machine technology, virtual machine technology in the recent years has been widely developed, some large network service providers have started to adopt virtual machine technology, not only saves the investment cost, but also saves energy consumption.

We know that there are several versions of VMware, and the common user is workstation, but regardless of which version we use, we can see that we choose the network mode during the installation process. Bridge mode is selected by default, but users will ask what other modes are used for? Sometimes you can't surf the internet after choosing another mode. Today, we will discuss with you the features and communication rules of VMware 3 network modes.

  

Network mode

Let's start by talking about several VMware virtual devices

VMNET0: Virtual Switch for virtual bridging network

VMNET1: Virtual Switch for Virtual Host-only network

VMNET8: Virtual Switch for virtual NAT network

VMware Network adepter vmnet1:host Virtual network card for communication with host-only virtual networks

VMware Network adepter vmnet8:host Virtual network card for communication with NAT virtual networks

When a VMware virtual machine is installed, two more virtual network cards are created in the Network Connections dialog box.

  

  I. Bridging network (bridged Networking)

Bridging network refers to the local physical network card and the virtual network card through the VMNET0 Virtual switch for bridging, physical network cards and virtual network cards on the topological map on the same status (virtual network card is neither Adepter VMnet1 nor Adepter VMnet8).

  

Bridge network topology diagram

Then the physical network card and the virtual network card are equivalent to the same network segment, the virtual switch is the equivalent of a real-world switch. Therefore, the IP address of the two network card should also be set to the same network segment.

  

Physical network card IP address

  

Virtual network card IP address

We see that the IP address of the physical network card and the virtual network card are in the same network segment, the subnet mask, gateway, DNS and other parameters are the same. Two network cards are relatively independent in the topology.

  

Ping results

We ping192.168.15.96 on the 192.168.15.111 and the results show that two NICs can communicate with each other. If a DHCP server exists in the network, the virtual network card can also obtain an IP address from the DHCP server. So bridging network mode is the simplest and most straightforward mode in VMware virtual machines. It is the default option when you install a virtual machine.

 Two. Nat mode

The VMware Network adepter VMnet8 Virtual network card is used in the NAT networks, and the VMware network adepter VMnet8 virtual network card on the host is connected directly to the VMNET8 virtual Switch to communicate with the virtual network card.

  

  NAT Network mode

The VMware network adepter VMnet8 Virtual network card is limited to communicating with the VMNET8 segment, and it does not provide routing capabilities to the VMNET8 segment, so the virtual machine is virtual to a NAT server so that the virtual network card can connect to the Internet. In this case, we can use the port mapping feature to map the requests that access the host 80 port to the 80 port on the virtual machine.

The IP address of the VMware network adepter VMnet8 Virtual network card is specified by the system when installing VMware, we do not modify this value, otherwise the host and the virtual machine will not be able to communicate.

  

NAT Virtual network card IP address

  

Physical network card IP address

Virtual network segment and NAT mode virtual network card network segment is the same, both 192.168.111.X, including the NAT server IP address is also this network segment. A virtual DHCP server is also generated after VMware is installed, assigning an IP address to the NAT server.

The VMware Network adepter VMnet8 Virtual network card is called when the host and the virtual machine are communicating, because they are in a network segment, so communication is not a problem.

In fact, the role of the VMware network adepter VMnet8 Virtual network card is to provide an interface for the communication between the host and the virtual machine, even if the host's physical network card is turned off, the virtual machine can still connect to the Internet, but the host and the virtual machine cannot exchange visits.

Three. Host-only mode

In host-only mode, the virtual network is a fully enclosed network, and the only access to it is the host. In fact, Host-only Network and NAT network is very similar, the difference is that the Host-only network does not have NAT service, so the virtual network can not connect to the Internet. Communication between the host and the virtual machine is achieved through the VMware Network adepter VMnet1 virtual network card.

  

Host-only mode

As with NAT, the IP address of the VMware network adepter VMNET1 Virtual network card is also specified by the VMware system, and the IP address of the virtual DHCP server and virtual network card generated is located in the same segment, but the IP address of the physical network card is not the same network segment.

  

Host-only Virtual network card IP address

  

Physical network card IP address

Host-only's aim is to create an internal network that is isolated from the outside world to improve the security of the intranet. This feature may not make much sense to ordinary users, but large service chambers often take advantage of this feature. If you want to provide routing for the VMnet1 network segment, you will need to use RRAS instead of XP or 2000 ICS, because ICS will change the IP address of the intranet to 192.168.0.1, but the virtual machine will not assign this address to the VMNET1 virtual network card. Then there is no communication between the host and the virtual machine.

  Review

In the VMware 3 network mode, the NAT mode is the simplest, basically do not need to manually configure the IP address and other related parameters. As for the bridge mode requires an additional IP address, if it is in the intranet environment is still very easy, if ADSL broadband is more troublesome, ISP is generally not generous to provide a public network IP.

VMware Virtual Machine network details (including multiple network cards) (original)

Most people use virtual machine is a single network card, networking settings is relatively simple, once the use of multi-card and blindfolded do not know how to set up, the following article is a VMware virtual machine including multi-NIC network settings for your reference.
The host is the WindowsXP system, and the Linux operating system is installed in the VMware virtual machine.

After VMware is installed, there are two new connections in the host's network connection, the VMware network Adapter VMnet1 and the VMware Network Adapter VMnet8. The system installed in the virtual machine is connected by these two virtual network cards. such as
Similar antiarp firewall on the host must be turned off or the virtual machine cannot surf the internet.


There are several options to follow:
1, bridged (bridge) mode:
If the host is connected via LAN, the virtual machine can use the same settings as the host network segment, Gateway and DNS, and choose a valid LAN IP.

The bridge mode can realize the virtual machine host virtual machine Internet communication (host and virtual machine can be regarded as two machines of the same LAN). However, bridging requires a separate IP address that differs from the original machine, which is difficult to do in some cases (IP and Mac bindings, network management does not agree). And the host unplug the network cable, the virtual machine can not communicate with the host over the Internet way. And the latter few do not have this problem. So we don't use bridging.

1) IP information of the host

2) Set the VMware network connection to bridged

3) Virtual machine system Network settings

Multi-nic Bridging
When I have a dual NIC, although vmnet0:bridged to an automatically chosen adapter (in VMware's edit->virtual network Settings ... Open Virtual Network Editor)

However, I tried, the virtual machine can only bridge "local connection" (via network card), cannot bridge "local Area Connection 2" (Realtek network card)

In the virtual Network Editor, Automatic bridging tab

If we want to bridge the "local Connection 2" (Realtek network card) need to "Exclude adapters" add "via Network card" (local connection), so that "local connection 2" can be bridged. However, "local connection" (via network card) is not possible, even in "Exclude adapters" remove "via network card" is not, I guess VMware only support a first not excluded Nic Bridge!

It's okay, we can select the Realtek network card in the virtual network Editor, Host Virtual Network Mapping tab, VMnet2

At this point, we go back to the virtual network Editor--Automatic bridging tab and found that VMnet0 removed the Realtek NIC

When bridging the "local Connection" (via network card), VMware chooses VMnet0,

When bridging "Local Area Connection 2" (Realtek NIC), VMware chooses VMnet2

Virtual machine on the network corresponding to the settings on it.


2. Nat Mode:
Using the NAT and DHCP services provided by VMware, the virtual machine uses the virtual NIC VMnet8 in the host as the gateway, and the TCP/IP settings follow the DHCP and NAT settings for VMNET8 in the program. such as IP must be between its DHCP settings StartIP and ENDIP, the gateway needs to use its NAT settings for the Gateway IP.
The NAT method can realize the virtual machine host communication, but the virtual machine---> The Internet is only able to access the Internet by the virtual machine, but if you want to use the virtual machine as a server, let the Internet access.
However, if you have more than one network card, the virtual machine can access multiple network cards connected to the Internet without changing the settings.
1) Set up VMware Network connections as Nat

2) in the virtual machine, Linux network settings, just choose to automatically get the IP, you can!

Of course, you can also set it manually:
The IP settings are the same as the Vmnet8, the Gateway,netmask,broadcast settings are the same as the VMNET8, and the DNS settings are the same as the host.
We are in the host network connection as follows, do not see the gateway (such as)

Don't worry, at VMware's edit->virtual Network settings ... , there are related content.

These tabs contain many of the advanced settings of VMware and are interested in research.


3.host-only Way:
By default, Vmnet1 is used to set the virtual machine IP settings to the same network segment as the VMNET1, the gateway is set to Vmnet1 IP, the rest is the same as the VMNET1, and the DNS settings are the same as the host
For example Vmnet1 ip:192.168.101.1
Virtual machine settings: ip:192.168.101.100 gateway:192.168.101.1
This enables the virtual machine host to communicate, but the virtual machine Internet is still unable to communicate
1) Select VMware's host-only

2) Local connection of the host

3) in virtual Machine Linux, set up the network

4. How to share the host's Internet connection (if the host is a Win98 system may not be applicable):
Share an Internet connection on the advanced level of the local Area Connection property of the host. If you choose the VMNET1 virtual network card, then the Ethernet settings in VMware need to choose Host-only, if you choose VMnet8, then the Ethernet setting requires NAT. After you share the connection, The selected virtual network card IP will default to be set to 192.168.0.1 (if the host is also through the LAN 192.168.0.1 gateway to the Internet, you need to set this virtual network card as a different network segment IP, such as 192.168.1.1) the virtual machine inside can be the virtual network card as a gateway to the Internet 。 is actually a simple route NAT, so the NAT mode is not discussed, we only take host-only as an example.
Share the host-only mode, can realize the virtual machine host communication, but the virtual machine---> Internet is only able to access the Internet virtual machine, but if you want to take the virtual machine as a server, let the Internet access, not.
1) Select VMware's host-only

2) Set local connection properties for the host

The IP of the selected virtual network card is set to 192.168 by default. 0.1, and of course it can be changed. And after the shared connection is canceled, it also changes back to the network settings before the shared connection.

In virtual machine Linux, set up the network:

Summarize:

Shared connection mode and NAT mode, can realize virtual machine host, virtual machine---> Internet communication, Nat mode is easy to set up, and can access multiple physical network card simultaneously.
Bridge mode can realize the virtual machine host virtual machine Internet communication, if the virtual machine as a server, only this way is feasible. However, a separate IP is required for the virtual machine, and if the physical network card is disconnected, the virtual machine and the host cannot connect.
The Host-only method only implements the virtual machine host communication, which is generally not used alone.

The above is the VMware virtual machine network settings including multiple network cards, through this article can realize the virtual machine network unimpeded, so as to facilitate better use of virtual machines.

Three modes--bridged, host-only, NAT for network connectivity on VMware virtual machines

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.