Host cannot access virtual machine Linux Apache__linux

Source: Internet
Author: User
Tags iptables

In the virtual machine Linux installed httpd, that is, Appache, after the boot, according to the normal situation in the host can be accessed by the browser through the virtual machine Linux IP to access. If an inaccessible situation occurs, the solution can refer to the following:
Here my virtual machine networking mode for the physical connection, and the IP is different from the host, but on the same network segment.
1, first determine whether the virtual machine can access the extranet, through ping www.baidu.com test, if not, first Baidu or reference other information or setup their own IP-related information (of course, the prerequisite is your 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 host, consider whether the host computer firewall is not off, many cases is this reason, the firewall can be closed to solve.
3, if the above is no problem, or can not be resolved, it may be iptable restrictions. Configure TCP's 80 port to allow any IP access by using the following command
Command:

Iptables-i input-p TCP--dport 80-j ACCEPT  

Note that Linux commands are case-sensitive

However, the third step above is only a temporary effect, as long as you restart the virtual machine or restart Linux, you must 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 selinux=enforcing
This line is commented out, and one line is added, as follows:

#SELINUX =enforcing
selinux=disabled

Save again, and then continue to enter the command:

Root@fedora6 ~]# chkconfig--level 3  iptables off
[Root@fedora6 ~]# chkconfig--level 5  iptables off

Then restart Linux, and it will take effect.
Then 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)

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.