我有一个与vhostconfiguration运行的apache实例,这里是httpd.conf:
#Listen {the_server_ip}:80 Listen 80 # <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/example.com ServerName example.com ServerAlias www.example.com ErrorLog logs/example.com-error_log CustomLog logs/example.com-access_log common </VirtualHost>
这是/ etc / hosts中的logging:
127.0.0.1 example.com www.example.com
服务器正在运行并正在侦听:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 :::80 :::* LISTEN 8756/httpd
这是来自服务器的CURL请求:
[root @ localhost示例]#curl -I http://example.com/index.html
HTTP/1.1 200 OK Date: Tue, 01 Mar 2016 11:12:47 GMT Server: Apache/2.2.15 (CentOS) Last-Modified: Tue, 01 Mar 2016 11:12:12 GMT ETag: "8aaa-5-52cfad64b4dbe" Accept-Ranges: bytes Content-Length: 5 Connection: close Content-Type: text/html; charset=UTF-8
这里是我的iptables规则INPUT链:
Chain INPUT (policy DROP 30 packets, 2242 bytes) pkts bytes target prot opt in out source destination 195 150K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 185 15126 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 37508 101M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 192 11152 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 64 3116 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
这里是我的输出链的iptables规则:
Chain OUTPUT (policy DROP 3 packets, 152 bytes) pkts bytes target prot opt in out source destination 199 151K ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0 16220 3289K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:22 692 47470 ACCEPT udp -- * * 0.0.0.0/0 8.8.8.8 udp dpt:53 107 8636 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0 14164 603K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 430 18880 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443
TCPDUMP:
[root@localhost iwanttobesysadmin.com]# tcpdump -v port 80 and host {home_ip} tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes 3 packets captured 3 packets received by filter 0 packets dropped by kernel
我也无法从服务器端口80上的Windows机器上远程login,但是它是可以ping通的。 我相信在INPUT链防火墙规则中有一些限制。
“ 我相信INPUT链防火墙规则有一些限制。 ”
你错误地相信。 然而,在OUTPUT链中存在一个问题,因为尽pipe你让人们与你的networking服务器通话,但是你不会让响应回来。
您添加了有状态的输出规则,以允许该stream量
iptables -A OUTPUT -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
现在所有的工作。