VMware runs Ubuntu Three network connection modes: Bridge, NAT, host-only difference "turn"

Source: Internet
Author: User
Tags switches virtual environment

Original: http://villasy1989.iteye.com/blog/956746


My host is Windows7, installing a VMware virtual machine, loading the Ubuntu10.04 in the virtual machine, first introducing several virtual devices under VMware:
Vmnet0:vmware is used for Virtual switch under virtual bridging network;
Vmnet1:vmware is used for Virtual switch under virtual Host-only network;
Vmnet8:vmware is used for Virtual switch under virtual NAT network;
VMware Network Adapter VMnet1: This is the virtual network card that host uses to communicate with host-only virtual networks;
VMware Network Adapter VMnet8: This is the virtual NIC that host uses to communicate with the NAT virtual network;

I. Relationships between virtual machines and virtual network cards
When you create a virtual machine using VMware Workstation, you can include network cards in the virtual machines that you create. You can choose which virtual network card to use depending on your needs, indicating that you want to connect to that virtual switch. In VMware Workstation, there are 3 virtual switches by default, VMNET0 (using bridged networks), VMNET1 (Host network only), and VMnet8 (NAT network). You can also add 7 virtual machine switches, such as VMNET2~VMNET7 and VMnet9, as needed, and in later versions of VMware Workstation 5, you can also use the virtual switches provided in the team.

Bridging Network (bridge)
In bridging mode, VMware's virtual operating system is like a separate host in a local area network that can access any machine in the network.     However, you need more than one IP address, and you need to manually configure the virtual system IP address, subnet mask, and the host machine in the same network segment, so that the virtual system can communicate with the host machine. 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. Virtual machines can be emulated to the local area network where the host is located.

Third, Nat network
In a NAT network, a VMnet8 Virtual switch is used, and the VMware network Adapter VMnet8 virtual network card on host is connected to the VMNET8 switch to communicate with the guest, but the VMware network Adapter VMnet8 Virtual network card is only used for communication with the VMNET8 network segment, it does not provide the routing function for the VMNET8 network segment, the guest under the virtual NAT network is connected to the Internet using Virtual NAT server.
At this point, your guest and host will be able to exchange visits, and if your host is connected to the Internet at this time, your guest will be able to connect to the Internet. So what role does the VMware network Adapter VMnet8 virtual network card play here? It simply provides an interface for guest communication under the host and NAT virtual networks, so even if the disable off the virtual network card, guest is still able to surf the internet, but host can no longer access the VMNET8 network segment.
This way, the host needs to turn on the VMDHCP and Vmnat services.
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.

Iv. host-only
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. You can take advantage of the Internet Connection Sharing that comes with Windows XP (which is actually a simple routing nat) to allow the virtual machine to access the network through the host's real network card. 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.

In the Host-only network, the Host-only network is designed to be a network isolated from the outside world, in fact Host-only Network and NAT network very similar, the only difference is in the Host-only network, no use of NAT service, There is no server for VMnet1 to route, of course, there is no way to access the Internet, but if my host to communicate with guest? What to do? That's right! Of course, the VMware network Adapter VMnet1 This virtual network card is used.
As you can see, under the Host-only network, the default gateway of guest is set to NULL, because the virtual NAT server is not used, but even if you use the route add command to add an address to make its route, It still does not have access to the Internet (in fact there is no address to add). In this way, my guest has no way to access the Internet, but can still communicate with my host. Implementation, if we are enough BT, can also be on the host for the VMware Network Adapter VMnet1 virtual network card to do the route, for example, we can use the Windows 2000 RRAS to do so, Guest on the Host-only network will be able to surf the internet again, they just need to use the route add command to change their default gateway to the VMware Network Adapter VMNET1 network card, but this is not recommended, nor necessary. If you just want the virtual machine to access the Internet, the NAT method is the simplest, basically do not need to do anything, you can automatically connect. This is also the default setting parameter.
As developers, we usually need hosts, virtual machines, boards with separate addresses and access to each other. Then we can use the following two network configuration methods, Bridge and Host-only.

Bridging is the simplest way, generally you have a gateway, your Windows host and your VMware's various unix/linux systems, all through this gateway to communicate.
In the case of hosts, the Windows host operating system can communicate properly with the guest operating system on VMware virtual machines without a network. As we can see from VMware's Virtual Network edit, Vnet0 is used to implement bridging mode, and Vnet1 is used to implement host mode. The host and client are communicating directly through VNET1.
In the host mode, the Windows host operating system does not need to configure what, we open cmd.exe, enter ipconfig, we know VMNET1 IP address is what, because this IP is the VMware virtual machine on the client operating system gateway IP address. My VMware virtual machine is generally loaded with Redhat, because the Linux family Redhat is the most common, the company with SuSE, Slaceware,unix use Solaris,freebsd. Then we configure the network on the guest operating system, the main note is that the IP of the gateway is the IP address of the VMNET1 that you see in the Windows host operating system with the ipconfig command.
For example: I in the windowsxp host under the ipconfig see VMNET1 IP address is 192.168.159.1, that I in Redhat in the gateway IP is configured to 192.168.159.1, configure the Redhat IP to 192.168.159.2. We ping 192.168.159.2 from the windowsxp host Cmd.exe, if Redhat start the sshd server, we can telnet 192.168.159.2 22, if the connection is successful all installation OK, Indicates that we have no problem connecting the Redhat system from the WindowsXP host. Conversely, how we connect the windowsxp host from the Redhat system, from the Redhat system point of view, VMnet1 IP address is the address of the WindowsXP host, Ping Redhat in the 192.168.159.1 system, and then Telnet 192.168.159.1 139, if the connection is successful, everything is installed OK, indicating that we have no problem connecting the WindowsXP host from the Redhat system.
A good way to learn about Unix/linux on C/D + + development or something else is to install VMware on a Windows system, and then mount a variety of unix/linux systems in the WMware to connect unix/through shell tools such as CRT, WINSCP, etc. Linux system, so that it is not easy to do other things without Windows system, but also to install a variety of unix/linux systems on a single PC machine. Original:http://blog.163.com/sys_suweixiao/blog/static/1653515020130444836771/

It can be seen that the host in addition to the installation of multiple physical network cards, inWindowsSystem, you can also have up toTenHost virtual network card. This host physical network card and virtual network card is not directly connected to the virtual machine, but directly withVmnet0~vmnet9this connects up to a maximum of ten virtual networks (virtual switches). In a Windows Host system, the number of virtual devices that a virtual network can connect to is unrestricted, and in a Linux host system, a virtual switching network can connect up to a virtual device. And the virtual machine's virtual network card is not directly connected with the physical network card in the host, or the virtual NIC connection, but also directly connected to the corresponding virtual networks. The host and virtual machine can be configured up to A maximum of ten virtual network cards, not only the host can be connected to multiple virtual networks, the same virtual machine can also be connected to a number of different virtual networks (the virtual network card creation method on the host will be in the following section of the The host virtual adapter tab is described, and the virtual network card creation method on the virtual machine is described later in this chapter. )。

VMware runs Ubuntu Three network connection modes: Bridge, NAT, host-only difference "turn"

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.