Three network connection modes on vmwarevm: bridged, host-only, and NAT

Source: Internet
Author: User

Three network connection modes on vmwarevm: bridged, host-only, and NAT
VMWare provides three working modes: bridged (bridging mode), NAT (network address translation mode), and host-only (host mode ). To apply them properly in network management and maintenance, you should first understand the three working modes.

1. bridged (Bridging Mode)

In this mode, the Virtual Operating System of VMWare is like an independent host in the LAN, which can access any machine in the network. In the bridge mode, you need to manually configure the IP address and subnet mask for the virtual system, and also need to be in the same network segment as the host machine, so that the virtual system can communicate with the host machine. At the same time, because the virtual system is an independent host system in the LAN, You can manually configure its TCP/IP configuration information to access the Internet through the LAN gateway or router.

The relationship between a virtual system in the bridge mode and the host machine is like connecting two computers on the same Hub. If you want them to communicate with each other, You need to configure the IP address and subnet mask for the virtual system. Otherwise, the communication will fail.

If you want to use VMWare to create a virtual server in the LAN to provide network services for LAN users, you should select the bridge mode.

2. host-only (host Mode)

In some special network debugging environments, you must isolate the real environment from the virtual environment. In this case, you can adopt the host-only mode. In host-only mode, all virtual systems can communicate with each other, but the virtual system and the real network are isolated.

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

In host-only mode, the TCP/IP configuration information of the virtual system (such as the IP address, gateway address, and DNS server) is created by VMnet1 (host-only) DHCP servers in the virtual network are dynamically allocated.

If you want to use VMWare to create a virtual system isolated from other machines in the network and perform some special network debugging, you can select the host-only mode.

3. NAT (network address translation mode)

The NAT mode enables the virtual system to use the NAT (Network Address Translation) function to access the public network through the network of the host machine. That is to say, you can use the NAT mode to access the Internet in a virtual system. In NAT mode, the TCP/IP configuration information of the virtual system is provided by the DHCP server of the VMnet8 (NAT) Virtual Network and cannot be modified manually, therefore, the virtual pseudo-system cannot communicate with other real hosts in the local area network. The biggest advantage of using the NAT mode is that it is very easy for the virtual system to access the Internet. You don't need to configure anything else, just need the host machine to access the Internet.

If you want to use VMWare to install a new virtual system, you can directly access the Internet without manual configuration in the virtual system. We recommend that you use the NAT mode.

Tip: The VMnet8 virtual network mentioned above in NAT mode, the VMnet1 Virtual Network in host-only mode, and the VMnet0 Virtual Network in bridged mode, they are all generated based on the automatic configuration of the vmwarevm and do not need to be set by the user. VMnet8 and VMnet1 provide DHCP services, while VMnet0 does not.

Based on the information provided above, I chose "bridged (Bridge Mode )".

Resolve the fundamental differences between the three network modes of virtual VMware

When talking about VMware, we think of virtual machine technology. In recent years, virtual machine technology has been widely developed. Some large network service providers have begun to adopt virtual machine technology, which not only saves investment costs, this reduces energy consumption.

We know that VMware has several versions. The most common version is Workstation. However, no matter which version is used, we can choose the network mode during the installation process. The bridge mode is selected by default, but some users will ask what other modes are used? Sometimes you cannot access the Internet after you select another mode. Today, I will discuss with you the functions and communication rules of VMware's three network models.

Network Mode

Let's talk about several VMware Virtual Devices.

VMnet0: used for Virtual Switches in a virtual bridge network

VMnet1: used for Virtual Switches under the virtual Host-Only Network

VMnet8: used for vswitches in a virtual NAT Network

VMware Network Adepter VMnet1: Virtual Network Card used by the Host to communicate with the Host-Only virtual Network

VMware Network Adepter VMnet8: Virtual Network Card used by the Host to communicate with the NAT Virtual Network

After the vmwarevm is installed, two more virtual NICS will be displayed in the network connection dialog box,

  

  1. Bridged Networking)

A bridge network is a bridge between a local physical network card and a virtual network card through a VMnet0 virtual switch, the physical and virtual NICs are in the same position on the topology (the virtual Nic is neither Adepter VMnet1 nor Adepter VMnet8 ).

  

Bridging Network Topology

The physical and virtual NICs are equivalent to the same network segment, and the virtual switch is equivalent to the switch in a real network. Therefore, the IP addresses of the two NICs must be set to the same network segment.

  

Physical Nic IP Address

  

Virtual Nic IP Address

We can see that the IP addresses of physical and virtual NICs are in the same network segment, and the subnet mask, gateway, DNS, and other parameters are the same. The two NICs are relatively independent in the topology.

Ping result

On 192.168.15.111, ping192.168.15.96 is displayed. The two NICs can communicate with each other. If a DHCP server exists in the network, the virtual Nic can also obtain the IP address from the DHCP server. Therefore, the bridge network mode is the simplest and most direct mode in the vmwarevm. It is the default option when you install a virtual machine.

 Ii. NAT Mode

The VMware Network Adepter VMnet8 virtual Nic is used in the NAT Network. The VMware Network Adepter VMnet8 virtual Nic on the host is directly connected to the VMnet8 virtual switch to communicate with the virtual Nic.

  NAT Network Mode

The VMware Network Adepter VMnet8 virtual Nic is only used to communicate with the VMnet8 CIDR block. It does not provide the routing function for the VMnet8 CIDR block. Therefore, the virtual machine virtualizes a NAT server so that the virtual Nic can be connected to the Internet. In this case, we can use the port ing function to map requests that access port 80 of the host to port 80 of the VM.

The IP address of the VMware Network Adepter VMnet8 virtual ENI is generated by the system when VMware is installed. Do not modify this value. Otherwise, the host and virtual machine cannot communicate.

NAT virtual Nic IP Address

  

Physical Nic IP Address

The CIDR block is the same as that of the NAT network adapter. The CIDR block is 192.168.111.X, And the IP address of the NAT server is the same as that of the NAT server. After VMware is installed, a virtual DHCP server is generated to assign an IP address to the NAT server.

When the host communicates with the virtual machine, it will call the VMware Network Adepter VMnet8 virtual Network card, because they are all in a Network segment, so the communication is not a problem.

In fact, the role of the VMware Network Adepter VMnet8 virtual Nic is to provide an interface for communication between the host and the virtual machine. Even if the host's physical Nic is disabled, the virtual machine can still connect to the Internet, however, there is no mutual access between the host and the virtual machine.

Iii. Host-Only mode

In Host-Only mode, the virtual network is a fully closed network, and the Only access to the virtual network is the Host. In fact, the Host-Only network is similar to the NAT network. The difference is that the Host-Only network does not have a NAT service, so the virtual network cannot connect to the Internet. Communication between hosts and virtual machines is achieved through the VMware Network Adepter VMnet1 virtual Network card.

  

Host-Only mode

Like NAT, the IP address of the VMware Network Adepter VMnet1 virtual Nic is also specified by the VMware system. the IP address of the virtual DHCP server and the virtual NIC are located in the same Network segment, but it is not in the same CIDR block as the IP address of the physical ENI.

  

Host-Only virtual Nic IP Address

  

Physical Nic IP Address

The purpose of Host-Only is to establish an internal network isolated from the outside to improve the security of the Intranet. This feature may be of little significance to common users, but it is often used by large service providers. If you want to provide the routing function for the VMnet1 CIDR block, you need to use RRAS instead of XP or 2000 ICS, because ICS will change the Intranet IP address to 192.168.0.1, but the virtual machine does not allocate this address to the VMnet1 virtual Nic, so the host and virtual machine cannot communicate.

  Summary

In VMware 3, the NAT mode is the simplest, and you do not need to manually configure IP addresses and other related parameters. As for the bridge mode, additional IP addresses are required. If it is easy to use in the Intranet environment, it is more difficult to use ADSL bandwidth, generally, the ISP does not provide a public IP.

Vmwarevm network details (including multiple NICS) (original)Most people use virtual machines as single NICs, and the network settings are relatively simple. Once multiple NICs are used, I don't know how to set them. The following article describes the network settings of a vmwarevm including multiple NICs, for your reference.
The host is a Windows XP system, and the Linux operating system is installed in the vmwarevm.

After installing VMware, there are two new connections in the Network connection of the host, namely VMware Network Adapter VMnet1 and VMware Network Adapter vmnet8. The systems installed in virtual machines are connected by these two virtual network cards. (For example)
The host must be shut down or the virtual machine cannot access the Internet.


There are several optional methods:
1. Bridged (BRIDGE) mode:
If the host accesses the Internet through the LAN, the VM can use the same settings as the host network segment, gateway, and DNS, and select a valid lan ip address.

Bridging allows Internet communication between Vm instances and virtual machines (hosts and virtual machines can be considered as two machines in the same LAN ). However, bridging requires another independent IP address different from the original host, which is difficult for some cases (IP and MAC binding, network management does not agree. In addition, the VM cannot communicate with the host through the network after the network cable is unplugged from the host. This problem does not occur in the next few cases. Therefore, the bridge mode is not used.

1) Host IP information

2) set the VMware network connection to Bridged.

3) Virtual Machine System Network Settings

Multi-nic bridging
When I have dual NICs, 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 the "local connection" (VIA Nic), not the "local connection 2" (Realtek Nic)

On the Virtual Network Editor-> Automatic Bridging tab

If we want to bridge the "local connection 2" (Realtek Nic), we need to add "VIA nic" in "Exclude adapters" (local connection ), in this way, "Local Connection 2" can be bridging. However, "Local Connection" (VIA Nic) is not acceptable, even if you Remove "VIA nic" in "Exclude adapters, I guess VMware only supports one originally excluded Nic bridging!

You can choose Realtek Nic from VMnet2 on the Virtual Network Editor-> Host Virtual Network Mapping tab.

At this time, we went back to the Virtual Network Editor-> Automatic Bridging tab and found that VMnet0 excluded the Realtek Nic.

When bridging the "local connection" (VIA Nic), VMware selects VMnet0,

When bridging "local connection 2" (Realtek Nic), VMware selects VMnet2

Set the network on the virtual machine.

2. NAT mode:
Using the NAT and DHCP services provided by VMware, the virtual machine uses the virtual network card VMnet8 in the host as the gateway, and the TCP/IP Settings must follow the DHCP and NAT settings of vmnet8 in the program, if the IP address must be between the StartIP and EndIP set by DHCP, the Gateway must use the Gateway IP address set by NAT.
NAT can implement VM host communication, but virtual machine ---> Internet can only access the Internet from virtual machines. However, if you want to use virtual machines as servers, you cannot access the Internet.
However, if multiple NICs exist, the virtual machine can access the Internet connected to multiple NICs at the same time without changing the settings.
1) set the VMware network connection mode to NAT

2) in a virtual machine, for linux network settings, you only need to select to automatically obtain the IP address!

You can also set it manually:
The IP settings are the same as that of vmnet8, gateway, netmask, and broadcast, and the dns settings are the same as those of vmnet8.
The following figure shows the network connection of the host. No Gateway (for example) is displayed)

Don't worry, there is something in VMware's Edit-> Virtual Network settings.

These tabs contain many advanced settings of VMware, which can be studied if you are interested.


3. host-only mode:
Vmnet1 is used by default. Virtual Machine ip is set to the same network segment as vmnet1, gateway is set to the ip address of vmnet1. other settings are the same as vmnet1, and dns settings are the same as those of the host.
For example, vmnet1 ip Address: 192.168.101.1
Virtual Machine Settings: ip: 192.168.101.100 gateway: 192.168.101.1
In this way, the VM host communication is realized, but the VM Internet still cannot communicate.
1) Select VMware Host-only

2) Local Connection of the host

3) in Virtual Machine linux, set the network

4. Internet connection of the shared host (if the host is a Win98 system, it may not be applicable ):
Share the Internet connection in the "local connection" attribute of the host. If VMnet1 is selected, Host-only is required for the Ethernet settings of VMware. If VMnet8 is selected, NAT is required for the Ethernet settings. After the shared connection, the IP address of the selected virtual network card will be set to 192.168.0.1 by default (if the host accesses the Internet through the 192.168.0.1 gateway of the LAN, you need to set this virtual network card to a different IP address segment, such as 192.168.1.1) at this time, the virtual network card can be used as a gateway to access the Internet. It is actually a simple route NAT, so we will not discuss the NAT method. We only use Host-only as an example.
The shared host-only mode enables communication between Vm hosts. However, virtual machines ---> Internet can only access the Internet by virtual machines. However, if you want to use virtual machines as servers, you cannot access the Internet.
1) Select VMware Host-only

2) set the local connection attribute of the host

The IP address of the selected virtual network card is set to 192.168.0.1 by default, which can also be changed. After the shared connection is canceled, the network settings before the shared connection are returned.

In virtual machine linux, set the network:

Summary:

Both the shared connection mode and the NAT mode can implement VM host, Vm ---> Internet communication. The NAT mode is easy to set, and multiple physical NICs can be accessed at the same time.
The bridging method can achieve Internet communication between Vm instances and virtual machines. If the virtual machine acts as a server, this method is only feasible. However, an independent IP address is required for the VM. If the physical Nic is disconnected, the VM and the host cannot be connected.
The host-only method only implements VM host communication, which is generally not used separately.

The above is the vmwarevm network settings including multiple NICs. Through this article, the virtual machine network can be unobstructed, so that you can better use the virtual machine.

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.