• iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
  • iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  • iptables -A OUTPUT -j ACCEPT
  • iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  • iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  • iptables -A INPUT -p tcp --dport 443 -j ACCEPT
  • iptables -A OUTPUT -p icmp -j ACCEPT
  • iptables -A INPUT -p icmp -j ACCEPT
  • iptables -A INPUT -j REJECT
  • iptables -A FORWARD -j REJECT
  • - - cat > /etc/network/if-post-down.d/iptables /etc/iptables.rules
  • EOF
  • chmod +x /etc/network/if-post-down.d/iptables
  • - cat > /etc/network/if-pre-up.d/iptables 复制代码

重启后 所有端口都不能通了

以前都是这么操作的 有没相同问题的