我今天早上刚刚应用了一堆推荐的更新(似乎将内核升级到了 3.8.0-32.47),突然间我无法通过端口 80(http)或 22(ssh)连接到计算机。Ping 仍然有效。此外,我的 syslog 和 kern.log 中充满了类似这样的消息
Oct 22 10:43:27 mu kernel: [ 4041.036862] Inbound IN=eth0 OUT= MAC=6c:62:6d:c8:b0:d3:18:03:73:34:81:b8:08:00 SRC=192.168.212.43 DST=192.168.212.56 LEN=48 TOS=0x00 PREC=0x00 TTL=128 ID=17389 DF PROTO=TCP SPT=59502 DPT=80 WINDOW=8192 RES=0x00 SYN URGP=0
我可以本地连接到 Web 服务器,所以对我来说这像是防火墙问题。我尝试过:
- 从 GUFW 内部执行“重置防火墙”
- 从命令行执行“sudo ufw allow 80”和“sudo ufw allow 22”
但这样不起作用。所以我去查看了“sudo iptables -L”,我得到了这个,但我不明白输出是什么(我用“example.com”隐藏了我雇主的域名)
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- ad1.example.com anywhere tcpflags:! FIN,SYN,RST,ACK/SYN
ACCEPT udp -- ad1.example.com anywhere
ACCEPT tcp -- ad2.example.com anywhere tcpflags:! FIN,SYN,RST,ACK/SYN
ACCEPT udp -- ad2.example.com anywhere
ACCEPT tcp -- ad3.example.com anywhere tcpflags:! FIN,SYN,RST,ACK/SYN
ACCEPT udp -- ad3.example.com anywhere
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere limit: avg 10/sec burst 5
DROP all -- anywhere 255.255.255.255
DROP all -- anywhere 192.168.212.255
DROP all -- base-address.mcast.net/8 anywhere
DROP all -- anywhere base-address.mcast.net/8
DROP all -- 255.255.255.255 anywhere
DROP all -- anywhere 0.0.0.0
DROP all -- anywhere anywhere state INVALID
LSI all -f anywhere anywhere limit: avg 10/min burst 5
INBOUND all -- anywhere anywhere
LOG_FILTER all -- anywhere anywhere
LOG all -- anywhere anywhere LOG level info prefix "Unknown Input"
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ufw-before-logging-input all -- anywhere anywhere
ufw-before-input all -- anywhere anywhere
ufw-after-input all -- anywhere anywhere
ufw-after-logging-input all -- anywhere anywhere
ufw-reject-input all -- anywhere anywhere
ufw-track-input all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp dpt:http
知道我做错了什么吗?或者如何解决它?(我想我即将学到很多有关 iptables 的知识。)
更新
不出所料,机器上的其他服务(MySQL)也没有响应。nmap 告诉我端口是开放的,
chris@mu:/var/log$ nmap 192.168.212.56
Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-22 10:55 EDT
Nmap scan report for sentry (192.168.212.56)
Host is up (0.00030s latency).
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
139/tcp open netbios-ssn
445/tcp open microsoft-ds
3306/tcp open mysql
5666/tcp open nrpe
答案1
我终于找到了可以清除所有防火墙规则的命令sudo iptables -F
(这是一台开发机,所以我不太在意),并使用了它。现在一切都可以访问了。