VMware Internet Settings

Source: Internet
Author: User
VMware three network connections, qemu two network connections to achieve Virtual Machine <---> host Virtual Machine <---> Internet communication method.
By the way, I wrote how to not re-compile the entire kernel to support a certain function, which has no impact on the system. The compilation speed is faster than compiling the entire kernel.
If your XXX card is not supported by the kernel, and you are afraid that the compiled kernel will cause system damage, you can try this method. ^_^

Three network connection settings for VMware:

1. Bridge:
Vmnet0 is used by default.
Set the IP address of the Virtual Machine and the IP address of the host in the same network segment, and the rest are the same as those of the Host:
For example, if the host IP address is 10.70.54.31, set the Virtual Machine IP address to 10.70.54.22. Netmask, broadcast, gateway, and DNS are all the same as the host to implement Internet communication between virtual machines <---> host virtual machines <---->.

2. NAT:
Vmnet8 is used by default.
Set the VM to use DHCP to access the Internet. In Windows, select "automatically obtain IP Address". In Linux, enable the DHCP service.
You can also set it manually:
The IP address is set to the same network segment as vmnet8, And the gateway is set to the Gateway (/etc/vmware/vmnet8/NAT) of vmnet8. conf) to check the vmnet8 gateway, which is usually XXX. xxx. xxx.2.
The netmask and broadcast settings are the same as those of vmnet8, And the DNS settings are the same as those of the host.
For example, 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:
Vmnet1 is used by default.

Set the Virtual Machine IP address to the same network segment as vmnet1 and gateway to the IP address of vmnet1. the other settings are the same as vmnet1, And the DNS settings are the same as those of the host.
For example, vmnet1 IP: 172.16.245.1
Virtual Machine Settings: IP: 172.16.245.100 Gateway: 172.16.245.1
In this way, the VM <---> host communication is realized, but the VM <---> the Internet still cannot communicate.

Communication between virtual machines and the Internet:
1. Enable Host Routing
2. Set iptables to make the host a NAT Server
1. Echo 1>/proc/sys/NET/IPv4/ip_forward so that the host has the routing function
2. iptables-T Nat-A postrouting-O eth0-s 172.16.245.0/24-J Masquerade
This rule is used to disguise the source IP address from 172.16.245.0/24 packets as an eth0 IP address to implement communication between virtual machines and the Internet.
If the network interface is PPP + or pppoe, you need to change it to-O pppoe.
Of course,-s 172.16.245.0/24 should also be modified according to the actual situation.

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.