The instance explains three network modes (bridging, nat, and Host-only) of virtual machines)

Source: Internet
Author: User


The following describes three network modes (bridging, nat, and Host-only) of virtual machines. Many people often encounter problems when installing virtual machines, but vmware has three network modes, it is also a bit confusing for beginners. Today I am going to use three virtual machine-based network models to help you popularize the background of Virtual Machine Internet access.
Virtual Machine Network Mode: vmware, virtual box, virtual pc, and other virtual machine software. Generally, virtual machines have three network modes: 1. bridge www.2cto.com 2. NAT3.Host-Only beginners can see that the virtual machine has three types of networks. It is estimated that they will be in a panic. So do I. Which network is suitable for your own virtual machine? A bridge between a local physical network card and a virtual network card is a bridge between the local physical network card and the virtual network card through the VMnet0 virtual switch. The physical network card and the virtual network card are in the same position on the topology, the physical and virtual NICs are equivalent to the same network segment, and the virtual switch is equivalent to a switch in a real network. Therefore, the IP addresses of the two NICs must be set to the same network segment. Therefore, when we want to use virtual machines in the LAN to provide services to other PCs in the LAN, such as ftp, ssh, and http services, we need to select the bridge mode.
For example, if there is a vro in the dormitory and four people in the dormitory connect to the vro, The wanip address of the vro will be ignored. The ip address is dynamically obtained, and the lanip address is 192.168.1.1 by default, the subnet mask is 255.255.255.0. The other four automatically obtain the ip addresses. Assume that the ip addresses of the four are: A: 192.168.1.100/255.255.255.0, B: 192.168.1.101/255.255.255.0, C: 192.168.1.102/255.255.255.0, and D: if 192.168.1.103/255.255.255.0 is used, the ip addresses of virtual machines can be set to 192.168.1.2-192.168.1.99, 192.168.1.104-192.168.1.254 (except for all network addresses 0 and 1, and the ip addresses of four people in ABCD are removed) the Virtual Machine IP address can be set to 192.168.1.98/255.255.255.0. With this IP address set, the four members of ABCD can access the virtual machine through 192.168.1.98. If the virtual machine needs to go to the Internet, you also need to configure the route address of the virtual machine, namely 192.168.1.1, so that the virtual machine can be connected to the Internet. However, we usually access the Internet through Domain name to access the Internet, so we also need to configure a dns server for the virtual machine, we can simply configure the dns server address as google's dns server: 8.8.8.8.8, here, the virtual machine can access the Internet.
In NATNAT mode, the virtual machine is allowed to access the public network through the network of the host machine through the NAT (Network Address Translation) function. In NAT mode, the network of the virtual machine's Nic and physical NIC are not in the same network. The NIC of the virtual machine is a virtual network provided by vmware. Comparison of www.2cto.com NAT and bridge: (1) Both the NAT mode and bridge mode can be over the Internet. (2) because the NAT network is in a virtual network provided by vmware, other hosts in the LAN cannot access the virtual machine, while the host can access the virtual machine, virtual machines can access all hosts in the LAN, because the real LAN is the Internet of the NAT Virtual Network relative to the NAT virtual network. People who do not know the NAT can check the NAT knowledge. (3) In the bridge mode, multiple virtual machines can access each other. In the NAT mode, multiple virtual machines can also access each other. If you create a virtual machine for your own purposes and do not need to use it for others on the LAN, you can select NAT, after all, the TCP/IP configuration information of the Virtual System in NAT mode is provided by the DHCP server of the VMnet8 (NAT) virtual network, as long as the network configuration of the virtual machine is DHCP, you do not need to configure any other configurations. You only need to allow the host machine to access the Internet to connect the virtual machine to the Internet. For example, if you want to build multiple virtual machine clusters for testing, and the host machine may be a notebook, the ip address is not fixed. In this application scenario, we need to adopt the nat mode, but we need to consider a problem where mutual access is required between virtual machines. dhcp is used by default, and the ip address of the virtual machine is restarted each time, ip addresses are not fixed, so we need to manually set the ip address of the virtual machine. However, we do not know any information about the virtual network where the Virtual Machine network card is located, such as the Virtual Machine network routing address and subnet mask. Therefore, we need to first check the nat virtual network information.
Using vmware, After configuring the Virtual Network information in Edit-> Virtual Network Editor, you can see that, pay attention to VMnet8, which is equivalent to a local route, after the Virtual Machine Sets NAT, it will use this route to access the Internet. You can view its network address, route address, and subnet mask. Next, you can set the ip address, subnet mask, and route address on the corresponding virtual machine to go to the Internet. As for dns, you can set it to 8.8.8.8.8. www.2cto.com Host-Only in Host-Only mode, the virtual network is a fully closed network, and the Only access to it 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. 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 the Network Mode of VMware 3, the NAT mode is the simplest, And there is basically no 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.

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.