Differences between Linux and other virtual machines such as VMWare, such as bridging, Nat, and host only

Source: Internet
Author: User

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

Fish annotation:

You only need to set the IP address in the VM to allow communication even if the IP address of the host is incorrect. However, if the physical network card is disabled, communication is not allowed.

Link:

Linux Virtual Machine-> physical Nic

Windows> physical Nic

Static IP addresses and dynamic IP addresses can be used for bridging. When dynamic IP addresses are used, the addresses of the same network segment as the physical NIC are returned (allocated by the gateway of the physical Nic ).

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 lan B are connected seamlessly at the link layer. When bridging, the VMware NIC AND THE PHYSICAL Nic should be in the same IP segment, of course, there must be 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 the network card. In this way, all data packets sent to the physical network card will be sent to the vmwarevm, data packets sent by VMware are also sent from the physical network card through the bridge.

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, and the VM can access the Internet through the bridge.

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

Fish annotation:

The Virtual Machine and the host machine can ping each other. Other hosts cannot ping the virtual machine.

Link:

Linux Virtual Machine-> vmnet8-> physical Nic

Windows> physical Nic

Nat can use static IP addresses and dynamic IP addresses. When using dynamic IP addresses, the addresses of the same network segment as vmnet8 in VMware are returned (set in the virtual network editor in the edit menu of VMware)

1. Principle:
Nat is short for network address translate. NAT technology is applied to Internet gateways and routers. For example, if the IP address 192.168.0.123 is used to access the Internet, its data packets must be transmitted through a gateway or vro, And the gateway or vro has an IP address that can access the Internet, such a gateway and router must modify the IP protocol layer (NAT) of the data packet when sending and receiving data packets so that the host 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 adapter 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. Therefore, the virtual machine can ping the IP address of the host, but the host cannot ping the IP address of the virtual machine.
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, select "automatically obtain IP Address" in windows, and enable the DHCP service in Linux. (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, and DHCP is disabled by default)

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 (See Virtual Network editor configuration), set the Virtual Machine IP address to 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, but the host cannot access the virtual machine.

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: vmnet1 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.

Detailed source reference: http://www.jb51.net/diannaojichu/68778.html

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.