Understanding VMware Virtual Networks

Source: Internet
Author: User
Tags switches domain name server vmware server

Description: VMware Virtual network overview, virtual network access

Part0

Subnet mask, DHCP, NAT, these points please self-Baidu, Baidu Encyclopedia is very clear.

Part1

Reprint: This article is from "Wang Chunhai blog" blog http://wangchunhai.blog.51cto.com/225186/381225

Note: In the reprinted article for each kind of network has added the example

3.1 VMware Virtual Network overview

VMware Workstation (or VMware Server) is installed on a physical computer, which is called a "host", assuming that the host has a physical network card and is connected to a switch in the network, as shown in network topology 3-1.

Figure 3-1 Host physical Network

VMware Workstation and VMware Server, support Vmnet0~vmnet9 a total of 10 (virtual) network card, for each virtual network card (VMNET0~VMNET9), at the same time can only select one Network properties: or use the host physical network card, Or use a virtual network card.

In the VMware virtual network, there are two types of networks: one is "host-only Network" and the other is "NAT network". For VMware Workstation (or VMware Server) hosts, there can be multiple virtual network cards with the "host network only" feature, but only 1 virtual network cards have the NAT network attribute at the same time.

When installing VMware Workstation or VMware Server on the host, the default is to install 3 virtual network cards, the 3 virtual network card names are VMnet0, VMnet1, VMnet8, where the network property of VMnet0 is "physical network card", The network properties of VMnet1 and VMnet8 are "virtual network cards". in the default case, VMnet1 virtual network cards are defined as "host-only virtual networks", VMnet8 the virtual network card is defined as "NAT Network ", at the same time, the host physical network card is defined as" Bridge network ", the host physical network card can also be called VMnet0.

By default, VMware workstation virtual network topology relationship 3-2 is shown.

Figure 3-2 Virtual Machine network topology

In Figure 3-2, there are 3 virtual switches, 2 virtual network cards, 1 physical network cards, and a virtual router, which makes up the entire structure of the default virtual network. When VMware Workstation (or VMware Server) is installed, it randomly selects 2 address segments from the address of 192.168.x.0/24 (in a previous version, which also used the 172.16.0.0/12 address segment, but is soon discarded). The 1th address of each segment is assigned to the corresponding virtual network card (VMNET1 and VMNET8) for use.

In Figure 3-2, VMnet1 used 192.168.10.0/24, VMnet8 used the 192.168.80.0/24 address segment, which I used to use the address segment, you can according to their hobbies and habits set. If you want to modify these IP addresses, it will be described later in this article.

In Figure 3-2, there are 1 virtual DHCP servers that are not marked, the virtual DHCP server that is used to automatically assign IP addresses, subnet masks, and virtual machines that use VMnet1, VMnet8 (or other) virtual network cards (or connections to VMnet1, VMNET8 virtual switches). Parameters such as gateways and DNS. 3.2 Virtual machines and virtual network cards, Network properties

In VMware Workstation, each virtual machine can support up to 10 virtual network cards, which can be connected to different virtual networks (as needed), VMnet1, VMnet8, or VMnet0 virtual switches in example 3-2. There are two situations where you can choose a virtual network, one when you create a virtual machine, and then you modify the virtual network properties in virtual machine settings after you create the virtual machine.

(1) When creating a virtual machine, on the network Type page, in the Network Connection option group, select the virtual network to which the current virtual machine is connected, as shown in 3-3.

Figure 3-3 Network Properties

(2) After the virtual machine is created, modify the virtual machine settings, or you can modify the virtual network properties, as shown in 3-4.

Figure 3-4 Modifying virtual machine settings

Whether you are creating a virtual machine, choosing a network attribute, or on the Virtual machine Settings page, there are 3 choices for each virtual network card, namely, VMnet0 (Bridged network), VMNET1 (Host network only) and VMnet8 (NAT network), and one of the three connection properties that do not use network connectivity "is to indicate that the virtual network card is not connected to any network. The following describes the network properties when connecting to the VMnet1, VMnet8, VMnet0 virtual switches.

Note

(1) After VMware Workstation 6.0, the new "team" feature was added, and the team Virtual Switch was added to the team. Virtual machines in the team can use virtual switches in the team, in addition to virtual switches such as VMnet0, VMnet1, VMnet8, and so on.

(2) VMware Workstation (or VMware Server), in addition to VMnet0, VMNET1, VMnet8 virtual switches, can also create (or add) Vmnet2~vmnet7, VMNET9 and other virtual switches, The properties of these virtual switches can be selected between "host-only Network", "Bridging Network", and "Nat network". 3.3 VMnet1, VMNET8, VMnet0 virtual network card relationship

In VMware Workstation or VMware Server virtual machines, the network relationship between virtual machines and hosts can refer to the network topology shown in Figure 3-5.

Figure 3-5 Virtual machine vs. host network topology

In Figure 3-5, virtual machines A11, A12, ~, virtual machine A03, and so on, are virtual machines created by VMware Workstation (or VMware Server). Virtual machine A11, A12, A13 use VMNET1 (Host network only) virtual network card, in the network topology in Figure 3-5, "equivalent" to connect to the VMNET1 Virtual Switch, virtual machine A81, A82 use VMNET8 Virtual network card (NAT network, is equivalent to connecting to a VMnet8 Virtual switch), virtual machines A01, A02, A03 use VMnet0 virtual network cards (bridging networks, which are equivalent to connecting to VMnet0 virtual switches). Physical Host B, which represents one or more computers in the same LAN as the physical host A. This is the "same local area network" that represents a computer that can be the same subnet (VLAN) or a different subnet. Internet Computer Z, which represents another computer or server on an Internet network, can be one or more computers. The relationship of Figure 3-5 is drawn as a network topology, as shown in 3-6.

Figure 3-6 Simplified network topology

The following describes the network relationships between each virtual machine and the host.

3.3.1 Virtual machine using VMNET1 virtual network card

When the virtual machine chooses to use the VMNET1 virtual network card, it indicates that the virtual machine is connected to the VMNET1 virtual switch.

VMNET1, the official definition of "host network only", its default network behavior, only with the host or other virtual machine using VMNET1 virtual network connection. Virtual machines that use the VMNET1 virtual network card cannot access other computers than the physical host.

In Figure 3-5 (Figure 3-6), the virtual machine A11, A12, and A13 use the VMNET1 virtual network card to indicate a connection to the VMNET1 virtual switch. In the network topology of Figure 3-5 (Figure 3-6), virtual machines A11, A12, A13, and physical host a can communicate with each other . The computer associated with VMnet1 in Figure 3-5 (Figure 3-6) is simplified into the topology shown in Figure 3-7.

Figure 3-7 VMnet1 Virtual network topology

1. How can a computer on the same switch communicate

In-depth understanding: "Can communicate with each other", this sentence means that when A11, A12, A13, A are connected to the VMNET1 virtual switch, these 4 computers can communicate with each other, but not necessarily can communicate. Why is it? If A11, A12, A13, a do not set the IP address of the same subnet, this cannot communicate with each other (access to each other), or although set the address of the same network segment, but A11, A12, A13, A has a firewall, prohibit other computer access, this is also unable to communicate. Communication is possible only if A11, A12, A13, A are connected to the same virtual switch, and the network segment (IP address does not conflict), and there are no firewalls (or firewalls, but allow other computers to access them). 2. Computers using the VMNET1 virtual network card do not have access to the extranet by default

Computers that use the VMNET1 virtual network card cannot access the extranet, and the network cannot access the VMNET1 virtual network card. In the network of Figure 3-5 (Figure 3-6), virtual machines A11, A12, A13 and B, z have no network relationships and they cannot access each other. 3.host-only Way to implement host and virtual machine communication

Assume that the host's VMnet1 uses a network segment address of 192.168.64.1, the IP address of the virtual machine can be set to 192.168.64.128 (that is, with VMNET1 in the same network segment) using the Host-only method.

Verify:

1. The virtual machine ping host, that is, ping 192.168.64.1

2. Host ping virtual machine, ping 192.168.64.128

Note: After vi/etc/sysconfig/network-scripts/ifcfg-eth0 on Linux, to service network restart make the setting take effect 3.3.2 Virtual machine use VMNET0 virtual network card

If the virtual machine uses bridge mode, which is VMnet0, the virtual machine is equivalent to a computer in the host network, and if the virtual machine chooses VMnet0 (or bridging the network), it connects to the host network through the VMNET0 Virtual Switch, and the host "VMnet0 the virtual network card" Whether to set IP address-independent.

As can be seen in the network topology of Figure 3-5 (Figure 3-6), if the virtual machine A01, A02, A03 use VMnet0 Virtual Switch, regardless of the host VMnet0 virtual network card, whether the correct IP address, subnet mask and gateway are set, as long as A01, A02, A03 sets the correct IP address, subnet mask, gateway, and other parameters to access other computers on the network other than the host (for example, b), and other computers on the Internet network (such as Z). VMnet0 virtual machine, virtual network topology 3-8, as shown.

Figure 3-8 VMnet0 Virtual Network

where B and Z, which can be physical computers, can also be virtual machines that use the VMNET0 virtual network card. In Figure 3-8, virtual machines (A01, A02, A03) that use VMnet0 can access each other with physical hosts A and b. 1. Bridge mode for host and virtual machine communication

Assume that the host's VMnet0 uses a network segment address of 10.254.188.112, the IP address of the virtual machine can be set to 10.254.188.128 (that is, with VMNET0 in the same network segment) using the Bridging method.

Verify:

1. The virtual machine ping host, that is, ping 10.254.188.112

2. Host ping virtual machine, ping 10.254.188.128

3.3.3 Virtual machine using VMNET8 virtual network card

If the virtual machine uses VMNET8, the virtual machine can access the network outside the physical host through the host network, one-way (from the virtual machine to the host, the extranet), and the network outside the host cannot access the virtual machine using VMNET8. But this premise is that the host to be able to access the external network (or other computers on the network), if the host can not access the external network, is configured to VMNET8 virtual network card virtual machine, also cannot access the extranet.

The virtual network and virtual machines in Figure 3-5 (Figure 3-6) with VMnet8 are simplified into figure 3-9.

Figure 3-9 VMnet8 Virtual Network

Host A's VMnet8 virtual network card, connected to the VMNET8 virtual Switch, the VMNET8 virtual switch connected to the "virtual router", "virtual router" connected to the "VMnet0 Virtual network card (also known as the host physical network card)", and through the "VMnet0 virtual network card" connected to the " VMnet0 Virtual Switch "," VMnet0 Virtual Switch "connects to the host physical network. This also indicates that the computer (virtual machine or host) connected to the "VMnet8 Virtual Switch" needs to be connected to the host physical network in the direction of the "virtual router" → "VMnet0 virtual network card" → "VMnet0 virtual Switch". 1.NAT approach for host and virtual machine communication

Assume that the host's VMnet0 uses a network segment address of 192.168.230.1, using NAT, the virtual machine's IP address can be set to 192.168.230.128 (that is, with VMNET0 in the same network segment)

Verify:

1. The virtual machine ping host, that is, ping 192.168.230.1

2. Host ping virtual machine, ping 192.168.230.128

Part2

The following article is written in short and concise, also quoted.

Reprinted from: http://www.cnblogs.com/HondaHsu/archive/2013/05/30/3107793.html

Let's start by talking about several VMware virtual devices

VMNET0: Virtual Switch for virtual bridging network

VMNET1: Virtual Switch for Virtual Host-only network

VMNET8: Virtual Switch for virtual NAT network

VMware Network adepter vmnet1:host Virtual network card for communication with host-only virtual networks

VMware Network adepter vmnet8:host Virtual network card for communication with NAT virtual networks

When a VMware virtual machine is installed, two more virtual network cards are created in the Network Connections dialog box.

I. Bridging network (bridged Networking)

Bridge network refers to the local physical network card and the virtual network card through the VMNET0 Virtual switch for bridging, physical network cards and virtual network cards on the topological map on the same status.

Bridge network topology diagram

Then the physical network card and the virtual network card are equivalent to the same network segment, the virtual switch is the equivalent of a real-world switch. Therefore, the IP address of the two network card should also be set to the same network segment.

two. Nat Mode

The VMware Network adepter VMnet8 Virtual network card is used in the NAT networks, and the VMware network adepter VMnet8 virtual network card on the host is connected directly to the VMNET8 virtual Switch to communicate with the virtual network card.

NAT Network mode

The VMware network adepter VMnet8 Virtual network card is limited to communicating with the VMNET8 segment, and it does not provide routing capabilities to the VMNET8 segment, so the virtual machine is virtual to a NAT server so that the virtual network card can connect to the Internet. In this case, we can use the port mapping feature to map the requests that access the host 80 port to the 80 port on the virtual machine.

three. Host-only mode

In host-only mode, the virtual network is a fully enclosed network, and the only access to it is the host. In fact, Host-only Network and NAT network is very similar, the difference is that the Host-only network does not have NAT service, so the virtual network can not connect to the Internet. Communication between the host and the virtual machine is achieved through the VMware Network adepter VMnet1 virtual network card.

Host-only mode

Part3 Realize virtual network Internet

Way one: Nat Way Online

Use NAT mode to surf the Internet. First select the network connection as NAT mode, such as.

Then tick the DHCP service in the edit-and-virtual network editor, such as.

Then execute the following command:

Vi/etc/sysconfig/network-scripts/ifcfg-eth.kevin

Set the Bootproto to DHCP, as follows:

device=eth0hwaddr=xx: 0c:: EC::b7type=ethernetonboot= Yes Bootproto=DHCP

Then restart the network service as follows:

Service Network restart

Ping Baidu again, as follows:

 [[email protected] ~]# ping Www.baidu.comPING www.a.shifen.com ( 220.181 . 112.244 ) 56  ( 84  ) bytes of data.  64  bytes from  220.181 . 112.244 : Icmp_seq=1  ttl=128  time=5.39   Ms  Span style= "COLOR: #800080" >64  bytes from   220.181 . 112.244 : Icmp_seq=2  ttl=128  time=17.6  Ms 


Method Two: share the host network

Select the sharing option in the wireless connection (or local area connection, which I am connected to in the wireless network), allowing VMnet1 to share an Internet connection, such as.

Note: After this step, the IP address of the VMNET1 is automatically set to 192.168.137.1

View the VMNET1 network adapter configuration, as you can see the vmnet IP automatically changes to 192.168.137.1

In the virtual machine settings, change the network connection to host-only mode, such as.

Execute the following command:

[Email protected] ~]# Vi/etc/sysconfig/network-scripts/ifcfg-eth.kevin

Device=eth0
Hwaddr=00:0c:29:ec:80:b7
Type=ethernet
Onboot=yes
Bootproto=dhcp
ipaddr=192.168.137.128
netmask=255.255.255.224
gateway=192.168.137.1

Note: IP is set to the same network segment as VMNET1 (set to 192.168.137.10 here), the subnet mask is the same as VMNET1, and the gateway is set to the IP address of VMnet1

Restart the network, i.e.:

[Email protected] ~]# service network restart

Ping Google's public DNS server, as follows:

[[email protected] ~]# Ping8.8.8.8PING8.8.8.8(8.8.8.8) About( -) bytes of data. -bytes from 8.8.8.8: icmp_seq=1Ttl= +Time=221Ms -bytes from 8.8.8.8: icmp_seq=2Ttl= +Time=218Ms

Explain the success of networking

Note: If we ping Baidu, the following:

[Email protected] ~]# Ping Www.baidu.comping:unknown host www.baidu.com

At this point the PINGIP address is OK, but the ping domain name is not, this indicates that the virtual machine's domain name server has the problem. Execute the following command:

[Email protected] ~]# vi/etc/resolv.conf

Add Google's public DNS server to the/etc/resolv.conf file

# Generated by NetworkManager
Search Linux


# No nameservers found; Try putting DNS servers into your
# ifcfg files in/etc/sysconfig/network-scripts like so:
#
# dns1=xxx.xxx.xxx.xxx
# dns2=xxx.xxx.xxx.xxx
# domain=lab.foo.com Bar.foo.com
NameServer 8.8.8.8

Ping Baidu again

[Email protected] ~]# ping Www.baidu.comPING www.a.shifen.com (61.135. 169.125  About (+) bytes of data.  -  from 61.135. 169.125: icmp_seq=1 ttl= time=1.97 ms

Method Three: Bridging network

The reason to put the bridge network in the final, because I use the bridge network and do not network, guess why later.

Set the virtual machine network as a bridged network, such as.

Execute the following command:

[Email protected] ~]# Vi/etc/sysconfig/network-scripts/ifcfg-eth.kevin
device=eth0hwaddr=xx: 0c:: EC::b7type=ethernetonboot= Yesbootproto=staticipaddr=10.8. 167.128 NETMASK=255.255. 224.0 GATEWAY=10.8. 160.1

Note: The IP address is the same as the host network segment, the subnet mask and the gateway are the same as the host

Restart Network

[Email protected] ~]# service network restart

Ping the host Gateway

[[email protected] ~]# Ping10.8.160.1PING10.8.160.1(10.8.160.1) About( -) bytes of data. -bytes from 10.8.160.1: icmp_seq=1Ttl=254Time=253Ms -bytes from 10.8.160.1: icmp_seq=2Ttl=254Time=9.31Ms

Normally this should be able to connect the outside network, but ping Baidu can not ping, guess should be the school's network level live, specific circumstances I do not build ...

Understanding VMware Virtual Networks

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.