外部网访问httpd要关掉iptables吗?
Release: 2016-06-06 20:22:00
Original
1346 people have browsed it
实验环境:win8主机,虚拟机CentOS 6.7,桥接方式连接
-
主机网络配置:ipaddr: 192.168.1.100
虚拟机网络配置:
<code> bootproto: static
ipaddr: 192.168.1.101
netmask: 255.255.255.0</code>
Copy after login
Copy after login
-
虚拟机iptables配置
<code>开放80端口: iptables -A INPUT -p tcp --dport 80 -j ACCEPT</code>
Copy after login
Copy after login
-
虚拟机lamp配置
<code>httpd: 根目录<directory>可访问</directory></code>
Copy after login
Copy after login
实验步骤及结果
-
root@cent# service iptables start
<code> 防火墙服务正常,CentOS内部可通过访问127.0.0.1访问httpd服务, 但不能在win8外部网通过192.168.1.101:80访问该虚拟机上的httpd服务。</code>
Copy after login
Copy after login
-
root@cent# service iptables stop
<code> 防火墙关闭,CentOS和win8中均可访问httpd服务</code>
Copy after login
Copy after login
请问虚拟机该如何配置iptables规则?
回复内容:
实验环境:win8主机,虚拟机CentOS 6.7,桥接方式连接
-
主机网络配置:ipaddr: 192.168.1.100
虚拟机网络配置:
<code> bootproto: static
ipaddr: 192.168.1.101
netmask: 255.255.255.0</code>
Copy after login
Copy after login
-
虚拟机iptables配置
<code>开放80端口: iptables -A INPUT -p tcp --dport 80 -j ACCEPT</code>
Copy after login
Copy after login
-
虚拟机lamp配置
<code>httpd: 根目录<directory>可访问</directory></code>
Copy after login
Copy after login
实验步骤及结果
-
root@cent# service iptables start
<code> 防火墙服务正常,CentOS内部可通过访问127.0.0.1访问httpd服务, 但不能在win8外部网通过192.168.1.101:80访问该虚拟机上的httpd服务。</code>
Copy after login
Copy after login
-
root@cent# service iptables stop
<code> 防火墙关闭,CentOS和win8中均可访问httpd服务</code>
Copy after login
Copy after login
请问虚拟机该如何配置iptables规则?
允许80端口开放
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
-
2024-10-22 09:46:29
-
2024-10-13 13:53:41
-
2024-10-12 12:15:51
-
2024-10-11 22:47:31
-
2024-10-11 19:36:51
-
2024-10-11 15:50:41
-
2024-10-11 15:07:41
-
2024-10-11 14:21:21
-
2024-10-11 12:59:11
-
2024-10-11 12:17:31