Host cannot access virtual machine for Linux Apache

Source: Internet
Author: User

In the virtual machine Linux installed httpd, that is, Appache, after booting, according to normal situation in the host can be accessed by the browser by accessing the virtual machine Linux IP. In the event of an unreachable situation, the workaround can be as follows:
Here my virtual machine is connected to a physical connection, and the IP is different from the host, but in the same network segment.
1, first determine whether the virtual machine can access the external network, ping www.baidu.com test, if not, first Baidu or reference other information or Setup to configure IP-related information (of course, if you host network)
2, the host and the virtual machine through their respective IP ping, if the host can ping the virtual machine, and the virtual machine can not ping the host, consider whether the host computer firewall is not off, many cases is this reason, the firewall can be resolved.
3, if the above are not a problem, or can not be resolved, it may be iptable restrictions. Configure TCP port 80 with the following command to allow any IP access.
Command:

 -j ACCEPT

Note that the Linux commands are case-sensitive

However, the method of the third step is only temporary, as long as you restart the virtual machine or restart the Linux, it must be reset to access, the solution is as follows:
At the command line, enter:

Vi/etc/selinux/config

will open the VI editor
To modify a file:
Will be SELINUX=enforcing
This line is commented out, and a line is added as follows:

#SELINUX =Enforcingselinux=disabled

Save again, and then continue to enter the command:

3  5  iptables off

Then restart Linux, take effect, it's ready.
At this point the host can access the virtual machine to open Apache (here is just the Apache example, it should be said that the host browser can access the virtual machine IP)

Host cannot access virtual machine for Linux Apache

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.