Three network connection modes of Vmware

Source: Internet
Author: User
VMWare In Linux, Network Bridge is used to share a physical network card with windows to access the Internet. This time, it was taken home and changed to ADSL to access the Internet. The result showed that Linux could not access the network, how can this problem be solved?

Three Network Modes

Bridged:


BridgeIt means "bridge". When talking about bridging, you can't leave the LAN alone. For example, we have two local networks with their IP segments at 192.168.0. *. At the same time, we want to link these two networks. In this case, we can adopt bridging. At this time, the "bridge" is a host, which has two NICs in two local networks and runs on the "bridge"ProgramSo that all data packets in lan a can flow into B, and vice versa. In this way, lan A and B are connected seamlessly at the link layer (of course, there must be no conflicting IP addresses between the two LAN ). This is the role of the Bridge. Two local networks can be seamlessly communicated at the link layer.

The same is true for VMware's bridge. However, as a hardware Nic, VMware software virtualizes it! 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 VMware Virtual Machine, the data packets sent by VMware are also sent from the physical network card through the bridge. In this way, if the physical network card can access the Internet, there is no problem with the soft network card, this is the principle of bridging the internet.

When bridging, the VMware nic and the physical Nic should be in the agreed IP segment. Therefore, ping the IP address of the physical Nic In the VM or ping the IP address of the NIC in the VM.

Nat:

NatIs the abbreviation of network address translate. Network Address Translation is developed to allow private IP segments such as 192. 168. *. * to access the Internet. Private IP segments can be used by any company or individual. Therefore, countless computers in the world use addresses like 192.168.0.111, which cannot appear on the Internet, because this will definitely cause a route failure. However, the scarcity of IP addresses makes it necessary for us to use this shared IP address scheme and allow these machines to access the Internet. Under such circumstances, Nat came into being.

NAT technology is applied to Internet gateways and routers. For example, if the IP address 192.168.0.111 is used to access the Internet, its data packets must be transmitted through a gateway or router, and the gateway or router 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.

The most typical example is my college dormitory. The Intranet segment of the dormitory is 192.168.1. ×. Enter the campus LAN 10.10.110. × through the router, and then enter the Internet through the school gateway. In this process, the dormitory Router performs a NAT, and the school gateway performs a nat.

VMware's NAT technology is the same. 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 one 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.

Under such conditions, the virtual machine and the host are not in the same IP segment, but 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.

Host-only:

As the name suggests, this technology provides network mutual access between hosts and virtual machines, rather than Internet access by virtual machines. If you only want to allow data exchange between the VM and the host, but do not want the VM to access the Internet, you must use this setting.

With host-only, VMWare creates a soft Nic In a real Windows system. This network card can be seen in the network connection. The function of this network card is to enable Windows to see the IP address of the virtual machine.

Because this technology connects the host and virtual machine through an IP segment Nic, both parties can ping each other.

Actual Problems

If you want to understand the above problems, then you can observe the problems in practice. At school, I used bridge technology to allow virtual machines to access the Internet. When I got home, I used ADSL to access the Internet, but it didn't work.

The problem is that bridge uses the network card and physical network card of the virtual machine to access the Internet, which requires that the actual physical network card must be able to access the Internet. The school uses a LAN, which can be satisfied, but the home uses ADSL. The pppoe technology is used to establish a PPP connection on the network card. In this condition, all data packets are sent after PPP encapsulation. Although they are also sent from the network adapter, the packet format is different from that of common Internet data packets. That is to say, the physical network card does not have the ability to directly access the internet. Only packets encapsulated by the PPP interface can access the Internet.

To enable the virtual machine to access the Internet, we must enable the virtual machine's data packets to be sent from the PPP interface, that is, from the ADSL connection. At this time, the NAT technology can be used. As long as Nat is used to send and receive virtual machine data packets through the ADSL connection, the Internet access problem can be solved. In theory, the actual operation is as follows:

For example, select a virtual network card as the network card used by Nat. In addition, set the virtual network segment (to be in the same network segment as the system IP address in the virtual machine ).

For example, bind the configured Nic for Nat to the virtual Nic of the virtual machine.

Then, go to the virtual machine and set the IP address to access the Internet.

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.