Three network mode configurations under VMware virtual machines

Source: Internet
Author: User
Tags virtual environment

VMware virtual machines have three network modes, namely bridged (bridge mode), NAT (network address translation mode), Host-only (host mode).

VMware Workstation is installed with two more network connections, the VMware network Adapter VMnet1 and VMware network Adapter VMnet8, both of which can be viewed in the host's network connection , and one is VMnet0, which can be seen in Virtual network editor. These three virtual networks are automatically generated after VMware is installed and do not require manual modification. Where VMnet0 is used for bridged mode, VMnet1 for host-only mode, Vmnet8 for NAT mode. VMnet8 and VMNET1 provide DHCP services, which are not provided by default VMnet0.

1, bridged (bridge mode)

In this mode, VMware virtual operating system is like a separate host in the LAN, it can access any machine in the network, you need to manually configure the virtual system IP address, subnet mask, but also with the host machine in the same network segment, so that the virtual system to communicate with the host machine, The relationship between a virtual system and a host machine is like two computers connected to the same hub. Understanding the network technology is equivalent to adding a virtual switch on the front end of the host, and then sharing the switch with the host and all virtual machines.

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.

1.1. Network settings in bridge mode

The following shows the network settings in bridge mode, the virtual software VMware Workstation 9, the host system is WIN8, and the virtual machine system is CentOS 6.4.

(1) Check whether the Vmwarebridge protocol option in the local network connection properties is checked, and VMware is automatically checked when installed by default, as shown in.

Figure (1)

(2) The virtual machine network is set to bridged:

Figure (2)

(3) query the host network parameters , enter ipconfig on the command line , the parameters are as follows:

Figure (3)

(4) in the CentOS virtual machine to modify the network configuration is mainly in the /etc/sysconfig/network-scripts/ifcfg-eth0 file, modified as follows:

Figure (4)

Each parameter has the following meanings:

Device is the NIC name

Bootproto is the IP address type that gets, static address and none, and DHCP gets the IP address dynamically

HWADDR is the MAC address

MTU is the maximum transmission unit

nm_controlled whether the NetworkManager graphical interface Configuration tool is enabled

Onboot set whether the NIC is activated when the Linux system starts, this is usually set to Yes

IPAddr is the native IP address

Netmask is a subnet mask

Gateway is a set of gateways

DNS1 is the preferred DNS server

DNS2 When a secondary DNS server

There are also a few parameters that are generally not configured:

Broadcast is the broadcast address.

Network is the subnet address

In the above parameters ipaddr to the host IP in the same network segment, Gatewaydefault gateways to be consistent with the host.

After modifying the network parameters file to restart the Network service, the command is service network Restart as follows:

After modifying the network parameters file to restart the Network service, the command is service network Restart as follows:

Figure (5)

such as the above configuration after the general situation between the host and the virtual machine can communicate, the configuration of DNS (DNS is added in the /etc/resolv.conf: nameserver 8.8.8.8), the virtual machine can also access the extranet.

If the host cannot ping the virtual machine, you can view whether the ICMP protocol-related configuration file is enabled in the inbound rules for the host's firewall.

2. NAT (network address translation mode)

Using NAT mode, the virtual system uses the NAT function to access the public network through the host's network. In this mode, the host becomes a dual-NIC host, while participating in the existing host LAN and the new virtual local area network, but because of the addition of a virtual NAT server, the virtual local area network in the virtual machine in the external access, the use of the host's IP address, so from the external network, can only see the host, The newly created virtual local area network is completely invisible.

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.

2.1. Network settings in NAT mode

(1) Check whether VMware DHCP service and Vmwarenat Service two services for the host are started:

Figure (6)

(2) The virtual machine network settings are as follows:

Figure (7)

(3)Virtual Network Editor Settings

After the installation of VMware, you can click Virtual Network Editor in the menu bar of edit to make configuration changes.

Figure (8)

You can see that there are three default virtual network cards, while NAT mode uses the VMNET8 network card, you can also add and remove the network card itself.

The VMNET8 default is to provide DHCP services, so the virtual machine does not need to manually set the IP. NAT and DHCP services can also be modified in the Virtual Network editor interface, but in general we do not need to modify the configuration.

(4) Network configuration in virtual machine

Because NAT has a DHCP service, we only need to set the Bootproto parameter to DHCP, and the DHCP server assigns the IP address. The default parameters are as follows:

Figure (9)

By default, VMware and virtual machine configurations do not need to be modified, so the NAT mode is the simplest.

PS: I configure the NAT mode, the virtual function ping the host, the host can not ping the virtual machine, this temporarily do not understand, or NAT mode host can not access the virtual machine?

3, Host-only (host mode)

In some special network debugging environment, it is required to isolate the real environment and the virtual environment, then you can adopt the Host-only mode, in which all virtual machines on the host can communicate with each other, but the virtual machine and the real network are isolated.

In this mode, a new network composed of all virtual machines and hosts, but the LAN and the host itself in the existing LAN is independent of each other, if no additional routing settings, the two LAN is not connected, so the new LAN can be considered as a separate from the current host private network, Its members are the current host and all associated virtual machines.

From the network technology is equivalent to the host to add a virtual network card, so that the host becomes a dual-NIC host (Host network card + virtual network card). At the same time, a virtual switch is added to the host backend to allow the host and all virtual machines to become another virtual LAN. Because of the dual network card, host can participate in two LAN (existing host LAN + new virtual local area network), but by default, two LAN is not connected.

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.

3.1. Network settings in host-only mode

(1) The Virtual machine network settings are as follows:

Figure (10)

(2)Virtual Network Editor Settings

Figure (11)

In the Virtualnetwork editor interface we can see that host-only mode is responsible for the VMNET1 network card, VMNET1 provide DHCP services, so the virtual machine we do not need to manually set the IP.

Host-only Mode network configuration is also very simple, in general, the network settings in the virtual machine do not need to be modified, automatically get it.

Configured after the host can ping the virtual machine, but the virtual machine ping the host is to pay attention to, not to ping the host network card generated IP address, but by the virtual network card VMNET1 generated IP address, host command line input ipconfig can see VMNET1 generated IP address, As shown in the following:

Figure (12)

Virtual machine Ping Host:

Figure (13)

Host ping virtual machine:

Figure (14)

Three network mode configurations under VMware virtual machines

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.