Virtual Machine Network Mode

Source: Internet
Author: User

Virtual Machine software, such as VMWare, virtual box, and virtual PC, generally has three network modes:

1. Bridging

2. Nat

3. Host-only

When a beginner sees that the virtual machine has three types of networks, it is estimated that they will be flustered. So is the author. Which network is suitable for your own virtual machine?

Bridging

A bridge network is a bridge between a local physical network card and a virtual network card through a 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 IP addresses. Assume that the IP addresses of the other 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, D: 192.168.1.103/255.255.255.0

The IP address of the virtual machine can be set to 192.168.1.2-192.168.1.99, 192.168.1.104-192.168.1.254 (except for all the network addresses 0 and 1, and the IP addresses of the four members of the ABCD)

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 access the Internet. However, we generally access the Internet through the domain name, therefore, 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. Now, the virtual machine can access the Internet.

Nat

In Nat mode, a virtual machine accesses 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 between NAT and bridge:

(1) Both the NAT mode and the bridge mode can be connected to 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 the primary machines in the LAN, because the real LAN is the Internet of the NAT virtual network compared with 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.

Select vmnet8-> Nat settings. The subnet IP address is 192.168.233.0 and the subnet mask is 255.255.255.0. The routing address is actually the gateway IP address. It is the same thing. Here it is 192.168.233.2.

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.

Host-only

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.

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.

Virtual Machine Network Mode

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.