Differences between VMware's "bridge", "NAT", and "Host-only" access methods

Source: Internet
Author: User
Tags virtual environment

Before talking about the VMware network model, let's talk about several VMware Virtual Devices:
Vmnet0: This is the virtual switch used by VMware for virtual Bridging networks;
Vmnet1: This is the virtual switch used by VMware in the Virtual Host-only network;
Vmnet8: This is the virtual switch used by VMware for virtual Nat networks;
VMware network adapter vmnet1: This is the virtual Nic used by the host to communicate with the host-only virtual network;
VMware network adapter vmnet8: This is the virtual Nic used by the host to communicate with the NAT virtual network;
I. Bridging network:
In the bridge mode, the Virtual Operating System of VMware is like an independent host in the LAN, which can access any machine in the network. However, you need more than one IP address, and 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 with the host machine, so that the virtual system can communicate with the host machine. 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.
The VM can be simulated to access the LAN of the host.
 
Ii. Nat network:
In a NAT network, the vmnet8 virtual switch is used. The VMware network adapter vmnet8 virtual Nic on the host is connected to the vmnet8 switch to communicate with guest, however, the VMware network adapter vmnet8 virtual network card is only used to communicate with the vmnet8 network segment. It does not provide routing functions for the vmnet8 network segment, the guest in the virtual Nat network is connected to the Internet using the virtual Nat server.
At this time, your guest and host can achieve mutual access, and if your host has been connected to the Internet, then your guest can be connected to the Internet. So what role does the VMware network adapter vmnet8 virtual Nic play here? It only provides an interface for the communication between the host and the guest in the NAT virtual network. Therefore, even if the virtual network card is disable, the guest can still access the internet, only the host cannot access the vmnet8 CIDR block.
In this way, the host needs to enable the vmdhcp and vmnat services.
 
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 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 do not need to configure any other configurations, but only 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.
Iii. Host-only
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. You can use Internet Connection Sharing (in fact, a simple route Nat) in Windows XP to allow virtual machines to access the Internet through the real Nic of the host. The TCP/IP configuration information (such as the IP address, gateway address, and DNS server) of the virtual system is dynamically allocated by the DHCP server of vmnet1 (host-only) virtual network. 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.

In the host-only network, the host-only network is used to design a network isolated from the outside. In fact, the host-only network is very similar to the NAT network, the only difference is that there is no NAT service in the host-only network, and no server routes vmnet1. Of course, it cannot access the Internet, but what if my host needs to communicate with guest? What should I do? Right! Of course, we need to use the VMware network adapter vmnet1 virtual Nic.
As you can see, in the Host-only network, the default gateway of guest is set to null because the virtual Nat server is not used. However, even if you use the route add command to add an address for its routing, it still cannot access the Internet (actually no address can be added ). In this way, although my guest cannot access the Internet, it can still communicate with my HOST:
In implementation, if we have enough BT, we can also route the VMware network adapter vmnet1 virtual network card on the host. For example, we can use RRAS of Windows 2000, the guest in the host-only network can access the Internet again. They only need to use the route add command to change their default gateway to the VMware network adapter vmnet1 Nic. However, this is not recommended, it is not necessary.
If you only want virtual machines to access the Internet, the NAT method is the simplest and can be automatically connected without any operation. This is also the default setting parameter.
As developers, we usually need hosts, virtual machines, and development boards with independent addresses for mutual access. We can use the following two network configuration methods,
Bridge and host-only.
Bridging is the simplest method. Generally, you have a gateway. Your Windows Host communicates with various Unix/Linux systems in VMware through this gateway.
In the host mode, the Windows host operating system can communicate with the customer operating system on the vmwarevm without a network. We can see from VMware's Virtual Network edit that vnet0 is used to implement the bridging mode, and vnet1 is used to implement the host mode. The host and client communicate directly through vnet1.
In simplified format, the Windows OS does not need to be configured. Open cmd.exe and enter ipconfig to know what the IP address of vmnet1 is, because this IP address is the gateway IP address of the customer's operating system on the vmwarevm. In my vmwarevm, RedHat is usually installed, because RedHat is the most common in the Linux series. Companies use Suse, slaceware, Unix use Solaris, And FreeBSD. In this case, we configure the network on the customer's operating system. The gateway IP address is the vmnet1 IP address you can view in the Windows host operating system using the ipconfig command.
For example, if I use ipconfig on a Windows XP host and see that the IP address of vmnet1 is 192.168.159.1, configure the gateway IP address as 192.168.159.1 in RedHat and configure the RedHat IP address as 192.168.159.2. Ping 192.168.159.2 from Windows XP cmd.exe. If RedHat is used to start the sshd server, Telnet 192.168.159.2 22. If the connection is successful, install OK. This means that we have no problem connecting to the RedHat system from the Windows XP host. On the contrary, how can we connect to a Windows XP host from the RedHat system? From the RedHat system perspective, the vmnet1 IP address is the address of the Windows XP host. In the RedHat system, Ping 192.168.159.1 and telnet 192.168.159.1 139, if the connection is successful, everything is installed. It means that we have no problem connecting to the Windows XP host from the RedHat system.
to learn about C/C ++ development on Unix/Linux or other systems, install VMWare on Windows and install various Unix/Linux systems in wmware, use shell tools such as CRT and winscp to connect to the Unix/Linux System for operations, so that it is not inconvenient to do other things because there is no windows system, it can also install various Unix/Linux systems on a PC 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.