Linux Internet access settings in VMware

Source: Internet
Author: User

The host is a Windows XP system, and the Linux operating system is installed in the vmwarevm. After installing VMWare, there are two new connections in the network connection of the host, namely VMware network adapter vmnet1 and VMWare network adapter vmnet8. The systems installed in virtual machines are connected by these two virtual network cards. (For example)

The host must be shut down or the virtual machine cannot access the Internet.

There are several optional methods:
1. bridged (BRIDGE) mode:
If the host accesses the Internet through the LAN, the VM can use the same settings as the host network segment, gateway, and DNS, and select a valid lan ip address.

The bridging mode can implement Internet communication between virtual machines <---> host virtual machines <----> (hosts and virtual machines can be viewed as two machines in the same LAN ). However, bridging requires another independent IP address different from the original host, which is difficult for some cases (IP and Mac binding, network management does not agree. In addition, the VM cannot communicate with the host through the network after the network cable is unplugged from the host. This problem does not occur in the next few cases. Therefore, the bridge mode is not used.

1) Host IP information

2) set the VMware network connection to bridged.

3) Virtual Machine System Network Settings


Multi-nic bridging
When I have dual NICs, although vmnet0: bridged to an automatically chosen adapter (in VMware's edit-> virtual network settings... open virtual network editor)

However, I tried, the virtual machine can only bridge the "local connection" (via Nic), not the "local connection 2" (RealTek Nic)

On the virtual network Editor-> automatic bridging tab

If we want to bridge the "local connection 2" (RealTek Nic), we need to add "via nic" in "exclude adapters" (local connection ), in this way, "Local Connection 2" can be bridging. However, "Local Connection" (via Nic) is not acceptable, even if you remove "via nic" in "exclude adapters, I guess VMware only supports one originally excluded Nic bridging!

You can choose RealTek Nic from vmnet2 on the virtual network Editor-> host virtual network mapping tab.

At this time, we went back to the virtual network Editor-> automatic bridging tab and found that vmnet0 excluded the RealTek Nic.

When bridging the "local connection" (via Nic), VMWare selects vmnet0,

When bridging "local connection 2" (RealTek Nic), VMWare selects vmnet2

Set the network on the virtual machine.

2. Nat mode:
Using the NAT and DHCP services provided by Vmware, the virtual machine uses the virtual network card vmnet8 in the host as the gateway, and the TCP/IP Settings must follow the DHCP and Nat settings of vmnet8 in the program, if the IP address must be between the startip and endip set by DHCP, the gateway must use the gateway IP address set by Nat.
Nat can achieve VM <---> host communication, but virtual machine ---> the internet can only access the Internet by virtual machines. However, if you want to use virtual machines as servers, you cannot access the Internet.
However, if multiple NICs exist, the virtual machine can access the Internet connected to multiple NICs at the same time without changing the settings.
1) set the VMware network connection mode to Nat


2) in a virtual machine, for Linux network settings, you only need to select to automatically obtain the IP address!

You can also set it manually:
The IP settings are the same as that of vmnet8, gateway, netmask, and broadcast, and the DNS settings are the same as those of vmnet8.
The following figure shows the network connection of the host. No Gateway (for example) is displayed)

Don't worry, there is something in VMware's edit-> virtual network settings.

These tabs contain many advanced settings of VMware, which can be studied if you are interested.

3. Host-only mode:
Vmnet1 is used by default. Virtual Machine IP is set to the same network segment as vmnet1, Gateway is set to the IP address of vmnet1. other settings are the same as vmnet1, and DNS settings are the same as those of the host.
For example, vmnet1 IP Address: 192.168.101.1
Virtual Machine Settings: IP: 192.168.101.100 Gateway: 192.168.101.1
In this way, the VM <---> host communication is realized, but the VM <---> the Internet still cannot communicate.
1) Select VMware Host-only

2) Local Connection of the host

3) in Virtual Machine Linux, set the network

4. Internet connection of the shared host(If the host is a Win98 system, it may not be applicable ):
Share the Internet connection in the "local connection" attribute of the host. If vmnet1 is selected, host-only is required for the Ethernet settings of VMware. If vmnet8 is selected, Nat is required for the Ethernet settings. After the shared connection, the IP address of the selected virtual network card will be set to 192.168.0.1 by default (if the host accesses the Internet through the 192.168.0.1 gateway of the LAN, you need to set this virtual network card to a different IP address segment, such as 192.168.1.1) at this time, the virtual network card can be used as a gateway to access the Internet. It is actually a simple route Nat, so we will not discuss the NAT method. We only use host-only as an example.
The shared host-only mode allows virtual machines to <---> communicate with the host, but virtual machines ---> the Internet only allows virtual machines to access the Internet. However, if you want to use virtual machines as servers to allow Internet access, no.
1) Select VMware Host-only

2) set the local connection attribute of the host

The IP address of the selected virtual network card is set to 192.168.0.1 by default, which can also be changed. After the shared connection is canceled, the network settings before the shared connection are returned.

In virtual machine Linux, set the network:

Summary:

Both the shared connection mode and the NAT mode can implement virtual machines <---> hosts, virtual machines ---> Internet communication. The Nat mode is easy to set and allows simultaneous access to multiple physical NICs.
The bridging method can implement Internet communication between virtual machines <---> host virtual machines <---->. This method is only feasible if virtual machines are used as servers. However, an independent IP address is required for the VM. If the physical Nic is disconnected, the VM and the host cannot be connected.
The host-only method only implements VM <---> host communication, which is generally not used separately.

For example, if I develop an embedded system under a virtual machine, the virtual machine uses bridging to connect to an embedded Nic to provide NFS services for the Development Board. If you want to download some software and check the information, you can use the NAT method, which is very convenient.

Related Article

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.