Three methods and principles of vmwarevm networking

Source: Internet
Author: User

I. brigde -- bridging: vmnet0 is used by default.

1. Principle:

Bridge "is a host. This machine has two NICs, which are located in two local networks and run programs on the bridge, let all data packets in Lan a flow into B intact, and vice versa. In this way, lan A and B are seamlessly connected to the link layer.
The connection is established. When bridging, the VMware nic and the physical Nic should be in the same IP segment.

Of course, ensure that there are no conflicting IP addresses in the two LAN.

The same is true for VMware's bridge, except that, as a hardware Nic, it is now virtualized by VMware software! When bridging is used
VMware will Virtualize a network card and a real physical network card to bridge, so that all data packets sent to the physical network card will be sent to the vmwarevm, and the data packets sent by VMware will also
The bridge is sent from the end of the physical network card.

Therefore, if the physical network card can access the Internet, there is no problem with the soft network card that is bridging the Internet. This is the principle of bridging the internet.

2. Networking:

This is the easiest way to connect to the Internet. In the LAN, how is your host connected to the Internet and how is it connected to a virtual machine. Think of a virtual machine as another computer in the LAN!

Tip: the host Nic is in a LAN that can access the Internet
The VM can access the Internet through bridge.

 

 

 

 

 

 


2. Nat-Network Address Translation: vmnet8 is used by default.

1. Principle:

Nat is a network address.
The abbreviation of translate. NAT technology is applied to Internet gateways and routers. For example, the IP address 192.168.0.123 needs to access the Internet and its data
The package must pass through a gateway or vro, And the gateway or vro has an IP address that can access the Internet. Such a gateway and vro must change the IP protocol layer data of the Data Packet when sending and receiving data packets.
(NAT), so that hosts in the private network segment can access the Internet smoothly. This technology solves the problem of scarcity of IP addresses.
The same private IP address can be used by the gateway to access the Internet through NAT.

VMware also uses Nat to access the Internet. It uses software to forge a network card between the host and the virtual machine. The IP address of this network card and the virtual machine is in an address segment. At the same time, the network interface between this Nic and the host is Nat. Each packet sent by the Virtual Machine passes through the virtual network card, and then Nat is sent by the host interface.

The virtual network card and virtual machine are in the same address segment. The virtual machine and the host have different address segments. The host is equivalent to the gateway of the virtual machine.
So the virtual machine can ping the host's IP address, but the host cannot ping the virtual machine's IP address.
    
2. Networking:

Method 1: Dynamic IP address.


It doesn't matter if the host is a static IP address or dynamic IP address. Set the VM to use DHCP to access the Internet. In Windows, select "automatically obtain IP Address". In Linux, enable the DHCP service
Yes. (This method is the simplest and does not require too many settings, but you need to "Edit> Virtual Network Settings" in VMware to enable both Nat and DHCP. Generally, Nat is enabled by default.
Close)
  
Method 2: static IP address.

If you do not want to use DHCP, you can also set it manually:
  
The IP address is set to the same network segment as vmnet8. The Gateway is set to the vmnet8 Gateway (the gateway can be found on the Net tab in "Virtual Network Settings"), which is usually XXX. XXX. xxx.2.
  
The subnet mask is set to the same as that of vmnet8 (after the IP address is set, the subnet mask is automatically generated)

The DNS settings are the same as those of the host.

For example, if the host IP address is 10.70.54.31 and the virtual machine IP address is 10.70.54.22. Netmask, gateway, and DNS are all the same as the host to implement Internet communication between virtual machines <---> host virtual machines <---->.

Tip: using NAT technology, the host can access the Internet, and the virtual machine can access the Internet.

 

 

 

 


3. Host-only -- shared private network host: vmnet1 is used by default.

1. Principle:

Provides network mutual access between hosts and virtual machines. This setting is required if you only want to allow data exchange between the VM and the host, but do not want the VM to access the Internet.

With host-only, VMWare creates a soft Nic In a real Windows system.
. This network card can be seen in the network connection, generally vmnet1, the role of this network card is to make windows see the virtual machine IP.

2. Networking method:

Method 1: Dynamic IP address.

After DHCP is enabled as above, the virtual machine automatically obtains the IP address and DNS. You can connect to the host. Of course, some local area network sharing operations are required.

Method 2: static IP address.

 

You can also manually set the Virtual Machine IP address to the same network segment as vmnet1 and the gateway to the IP address of vmnet1. the other settings are the same as vmnet1. the DNS settings are the same as those of the host.

Example: vmnet8 IP: 172.16.249.1 Gateway: 172.16.249.2
  
Then the Virtual Machine IP address is 172.16.249.100 Gateway: 172.16.249.2
  
  
In this way, the VM <---> can communicate with the host

However, virtual machines <---> cannot communicate with the Internet

Tip: the host-only technology is only used for mutual access between hosts and 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.