zep*_*aut 1 debian iptables web-server port nmap
我在让 Debian 网络服务器为 HTTP 流量打开端口 80 时遇到了一些麻烦。在我的 iptables 中,我使用以下命令打开了端口 80:
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p udp --dport 80 -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
运行 iptables -L 然后显示以下规则:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:www
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
然而,在这一切之后,我运行了 nmap -sS 127.0.0.1 并发现端口 80仍然没有打开。结果如下:
Nmap scan report for localhost (127.0.0.1)
Host is up (0.0000080s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
22/tcp open ssh
25/tcp open smtp
111/tcp open rpcbind
3306/tcp open mysql
8080/tcp open http-proxy
Run Code Online (Sandbox Code Playgroud)
规则如何可能在 iptables 中打开一个端口,但在 Nmap 中仍然关闭相同的端口?有没有人有任何想法?
从 的输出来看netstat -lnp | grep 80,您的 apache 服务器似乎正在侦听端口 8080,而不是默认的 80。
此外,该行:
8080/tcp open http-proxy
Run Code Online (Sandbox Code Playgroud)
从 nmap 输出证实了这一事实。
总之,端口 80 在您的机器上没有打开,因为 apache 正在监听 8080。