How to implement virtual machine Internet with several ways of networking in VMware

Source: Internet
Author: User

My PC has an IP address that can access the network, then how to let the VM can share my IP address, also can surf the internet. Today in groping implemented, detailed configuration such as the following:

1, first the VM's Nic Net8 is enabled:

2, then set the NIC for the VM to VMnet8 (NAT):

3, the PC can be connected to the Internet network card sharing: The last time this did not cause the Internet

To hook up with other network users connect via this computer's intenet connection and select VMnet8.

4, set the default gateway for the VMNET8 network card to the IP address of the network card that the local PC can access:

The IP address of the network card that I can surf the internet is 172.18.216.77,vmnet8 address is 192.168.0.1

5, set the address of the network card in the VM to 192.168.0.* network segment, the default gateway is 192.168.0.1, and configure DNS.

This way, if the setup is complete, when you visit the network in the VM, First, according to the default gateway 192.168.0.1, found the VMNET8 network card, and then based on the VMNET8 network card default gateway 172.18.216.77 found a network card, and the network card has been shared online, so the VM shared host IP address to the Internet.

Noun explanation VM: Virtual machines are now embodied in a product called Vm/esa, which is widely installed in IBM's host operating system, including MVS and session monitoring systems (CMS), so each operating system looks like it has its own complete software and hardware resource system (data storage, communication, processor, and so on). This means that the VM gives each operating system its own "virtual machine". VMS and CMS are popular in many large companies as a system that enables large numbers of interactive users to communicate or develop and execute programs at the same time. Many companies use MVS for commercial applications and the VM as a program development and user communication environment.

Fundamental differences in VMware three network modes

Virtual machine technology In recent years has been widely developed, some large network service providers have started to adopt virtual machine technology, not only to save investment costs, but also save energy consumption. Today, a lot of friends use VMware to solve the 32-bit XP memory interview problem, and we will talk about the features and communication rules of VMware 3 network modes.

We know that there are several versions of VMware, the most commonly used by ordinary users is workstation, but regardless of which version number to use, we can send the installation process now let us choose the network mode. Bridge mode is selected by default, but real users ask what other modes are used for? Sometimes you can't surf the internet after choosing another mode.

Network mode

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.

Network connection

I. Bridging network (bridged Networking)

Bridging 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 (virtual network card is neither Adepter VMnet1 nor Adepter VMnet8).

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.

Physical network card IP address

Virtual network card IP address

We see that the IP address of the physical network card and the virtual network card are in the same network segment, and the subnet mask, gateway, DNS, and so on are the same. Two network cards are relatively independent in the topology.

Ping results

We ping192.168.15.96 on the 192.168.15.111 and the results show that two NICs can communicate with each other. Assuming there is dhcpserver in the network, the same virtual network card can get the IP address from the dhcpserver. So bridging network mode is the simplest and most straightforward mode in VMware virtual machines. It is the default option when you install a virtual machine.

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, which does not provide routing capabilities to the VMNET8 segment, so virtual machines are virtual one natserver, enabling the virtual network card to connect to the Internet. In such cases, we are able to use the port mapping feature to map requests for access to host 80port to 80port on the virtual machine.

The IP address of the VMware network adepter VMnet8 Virtual network card is specified by the system when installing VMware, we do not change this value, otherwise the host and the virtual machine will not be able to communicate.

NAT Virtual network card IP address

Physical network card IP address

Virtual network segment and NAT mode virtual network card network segment is the same, all 192.168.111.X, including Natserver IP address is also this network segment. After installing VMware the same will generate a virtual dhcpserver that assigns an IP address to the natserver.

The VMware Network adepter VMnet8 Virtual network card is called when the host and the virtual machine are communicating, so communication is not a problem because they are in a network segment.

In fact, the role of the VMware network adepter VMnet8 Virtual network card is to provide an interface for the communication between the host and the virtual machine, even if the host's physical network card is turned off and the virtual machine is still able to connect to the Internet, but the host and virtual machine cannot access each other.

Three. Host-only mode

In host-only mode, the virtual network is a fully enclosed network, and the only thing that can be visited is the host. In fact, the Host-only network is very similar to a NAT network, and the difference is that the Host-only network does not have a NAT service, so the virtual network cannot 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

As with NAT, the IP address of the VMware network adepter VMNET1 Virtual network card is also specified by the VMware system, and the IP addresses of the virtual DHCPServer and virtual network cards generated at the same time are in the same network segment, but the IP address of the physical network card is not the same network segment.

Host-only Virtual network card IP address

Physical network card IP address

Host-only's aim is to create an internal network that is isolated from the outside world to improve the security of the intranet. This feature may not make much sense to ordinary users, but large service providers often take advantage of this feature. Assuming you want to provide routing for the VMnet1 network segment, you need to use RRAS instead of XP or 2000 ICS. Because ICS will change the IP address of the intranet to 192.168.0.1, but the virtual machine will not assign this address to the VMNET1 virtual network card, then the host and the virtual machine will not be able to communicate.

Review

In VMware's 3 network mode, the NAT mode is the simplest, and basically does not need to manually configure the IP address and other related parameters. As for the bridging mode requires an additional IP address, assuming that in the intranet environment is also very easy, assuming that ADSL broadband is more troublesome, ISPs are usually not generous to provide more than a public network IP.

1.bridge:
Use Vmnet0 by default
The IP settings of the virtual machine are not used with the host network segment, and the rest is the same as the host:
For example, the host IP is 10.70.54.31, set the virtual machine IP to 10.70.54.22. Netmask,broadcast,gateway,dns can also be implemented with the host virtual machine <---> Host virtual machine <----> Internet communications.

2.nat:
Use Vmnet8 by default
Set the virtual machine to use DHCP to surf the Internet, under Windows Select "Take the initiative to obtain the IP", Linux open DHCP service can be
can also be set manually:
IP settings and vmnet8 same network segment, Gateway set to VMNET8 Gateway (/etc/vmware/vmnet8/nat/nat.conf) can be found in the Vmnet8 gateway, generally xxx.xxx.xxx.2.
Netmask,broadcast settings and vmnet8 the same, DNS settings are the same as for hosts.
Like Vmnet8 ip:172.16.249.1 gw:172.16.249.2.
Virtual machine settings: ip:172.16.249.100 gw:172.16.249.2

3.host-only:
Use Vmnet1 by default

Set the virtual machine IP settings to the same network segment as the VMNET1, the gateway is set to Vmnet1 IP, the rest of the settings are the same as the Vmnet1, the DNS settings are the same as the host
Like Vmnet1 ip:172.16.245.1.
Virtual machine settings: ip:172.16.245.100 gateway:172.16.245.1
This enables virtual machine <---> host communication, but virtual machines <---> The Internet is still unable to communicate

Virtual machines communicate with the Internet:
1. Turn on the host routing feature
2. Set the iptables so that the host becomes a NAT server
1. Echo 1 >/proc/sys/net/ipv4/ip_forward so that the host has a routing function
2. Iptables-t nat-a postrouting-o eth0-s 172.16.245.0/24-j Masquerade
This rule means that the source IP from the 172.16.245.0/24 packet is disguised as a eth0 IP, enabling the virtual machine to communicate with the Internet
Suppose the network interface is ppp+ or PPPoE needs to be changed to-O PPPoE
Of course,-s 172.16.245.0/24 also to change according to the actual situation

How to implement virtual machine Internet with several ways of networking in VMware

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.