Three VM network Modes

Source: Internet
Author: User

VM technology has been widely developed in recent years. Some large network service providers have begun to adopt virtual machine technology, which not only saves investment costs, but also saves energy consumption. Many of my friends now use VMware to solve the 32-bit XP memory access problem. Today I will discuss with you the functions and communication rules of the three network models of VMware. 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. In network mode, let's first talk about several VMware Virtual Devices VMnet0: Virtual Switch VMnet1 for virtual Bridging networks: VMnet8 for Virtual Switches in Virtual Host-Only networks: VMware Network Adepter VMnet1: Virtual Network Adapter VMware Network Adepter vmepter VMnet8: host is the network connection of the virtual network card used to communicate with the NAT virtual network. bridged Networking 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 ). 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. The ping result is ping192.168.15.96 on 192.168.15.111. The result shows that 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. The bridging network mode is the simplest and most direct mode for VMware virtual machines. It is the default option when you install a virtual machine. II. in 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. In NAT Network mode, the VMware Network Adepter VMnet8 virtual Network card can only communicate with the VMnet8 Network segment. It does not provide the routing function for the VMnet8 Network segment. Therefore, the virtual machine virtualizes a NAT server, enable the virtual network card to connect 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. 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 also the CIDR block. 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. 3. In Host-Only mode, the virtual network is a fully enclosed network, and the Only thing that can be accessed is the Host. The Host-Only network is similar to the NAT network. The difference is that the Host-Only network has no NAT service and 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 Host-Only mode is the same as the NAT mode. the IP address of the VMware Network Adepter VMnet1 virtual Nic is also specified by the VMware system. the IP address of the generated virtual DHCP server and the virtual Nic is located in the same Network segment, however, the IP address of the physical network card is not in the same network segment as the IP address of the physical network card Host-Only. The purpose is to establish an internal network isolated from the outside to improve the security of the Intranet. This function may not make much sense for 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 will 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 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. 1. bridge: by default, vmnet0 is used to set the ip address of the virtual machine to be used in the same network segment as the host, and the rest to be the same as the host. For example, the Host ip address is 10.70.54.31 and the virtual machine ip address is 10.70.54. Netmask, broadcast, gateway, and dns are all the same as the host to implement Internet communication between virtual machines <---> host virtual machines <---->. 2. nat: by default, vmnet8 is used to set the virtual machine to use dhcp to access the Internet. In windows, select "automatically obtain ip addresses". In linux, you can also manually set the dhcp service: the ip address is set to the same network segment as vmnet8, And the gateway is set to the gateway (/etc/vmware/vmnet8/nat) of vmnet8. conf) to check the vmnet8 gateway, which is usually xxx. xxx. xxx.2. The netmask and broadcast settings are the same as those of vmnet8, And the dns settings are the same as those of the host. For example, vmnet8 ip: 172.16.249.1 gw: 172.16.249.2 VM settings: ip: 172.16.249.100 gw: 172.16.249.2 3. host-only: by default, vmnet1 is used to set the Virtual Machine ip address to the same network segment as vmnet1 and gateway to the ip address of vmnet1. other settings are the same as vmnet1. The dns settings are the same as those of the host, for example, vmnet1 ip: 172.16.245.1 Virtual Machine Settings: ip: 172.16.245.100 gateway: 172.16.245.1 to achieve VM <---> host communication, but virtual machines <---> the Internet still cannot communicate with virtual machines: 1. enable Host Routing 2. set iptables to make the host a nat server 1. echo 1>/proc/sys/net/ipv4/ip_forward so that the host has the routing function 2. iptables-t nat-a postrouting-o eth0-s 172.16.245.0/24-j MASQUERADE this rule means that the source ip addresses from 172.16.245.0/24 packets are disguised as eth0 ip addresses, implement communication between virtual machines and Internet. If the network interface is ppp + or pppoe, you need to change it to-o pppoe. Of course,-s 172.16.245.0/24 must also be modified according to the actual situation.

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.