我现在需要设置 iptables 为:允许 22 端口访问,然后禁止外网的访问+允许局域网访问,iptables 如下:
iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:ssh ACCEPT tcp -- localhost/8 anywhere ACCEPT tcp -- 10.0.0.0/8 anywhere ACCEPT tcp -- 172.16.0.0/12 anywhere ACCEPT tcp -- 192.168.0.0/16 anywhere DROP tcp -- anywhere anywhere Chain FORWARD (policy DROP) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination Chain DOCKER (0 references) target prot opt source destination Chain DOCKER-ISOLATION-STAGE-1 (0 references) target prot opt source destination Chain DOCKER-ISOLATION-STAGE-2 (0 references) target prot opt source destination Chain DOCKER-USER (0 references) target prot opt source destination
netstat -anp | grep wget tcp 0 0 172.23.54.173:34670 52.216.134.43:443 ESTABLISHED 7727/wget 可以看到 wget 的 source 是 172.23.54.173 的内网私有 ip,而这个私有 ip 我在 iptables 里面的ACCEPT tcp -- 172.16.0.0/12 anywhere已经覆盖了啊,为啥我无法 tcp 访问外网啊?
