Centos7 communicates with the host over the Internet through NAT

Source: Internet
Author: User

Centos7 communicates with the host over the Internet through NAT

Previously, Centos7 was recorded to implement Host-only communication between hosts and virtual machines.

In Host-Only mode, virtual machines do not seem to be able to connect to the Internet (some people on the Internet say yes, some say no, and I am not very clear about this)

But in NAT mode, at least I tried it. The virtual machine can not only communicate with the host, but also connect to the Internet.

Why do I need to connect to the internet? When installing some software, you may need to install the dependent package environment required by these software. In many cases, you can directly connect to the yum source through yum to download and install the software from the Internet, therefore, it is necessary to connect the VM to the Internet.

Previously, we mentioned that Host-Only is related to VMnet1, while NAT is related to VMnet8.

First, find VMnet8 in the host network link.

Set it like this (I don't seem to have set it. Open it like this. Of course, the ip addresses of each computer are different)

Continue to open here:

Well, record this: GATEWAY =

Then confirm the DHCP address segment:

Well, record the following:



Remember the starting IP address and ending IP address. When you set IPADDR = XXX. XXX in the future

Set the virtual machine:

OK, go to Virtual Machine Settings

Open the console: cd/etc/sysconfig/network-scripts/

The configuration is as follows:

NETMASK, NETWORK, and GATEWAY have been recorded.

IPADDR is also mentioned above. It can be done between DHCP and DHCP.

HWADDR is the mac address. If you do not know it, Baidu.

The key is this DNS1. What is this?

Open the host. Note that the host is not a virtual machine. Open cmd, ipconfig/all.

This is

After saving, remember the following command:

Service network start

If this command is not executed, the configuration does not take effect.

Finally, let's see if you can access the Internet:

Everything OK

Reference link: http://www.iyunv.com/thread-54435-1-1.html

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.