全球主机交流论坛

标题: debian 9 iptables 你们有没遇到问题 [打印本页]

作者: 大胡子    时间: 2017-11-14 20:44
标题: debian 9 iptables 你们有没遇到问题
  1. iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT
  2. iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
  3. iptables -A OUTPUT -j ACCEPT
  4. iptables -A INPUT -p tcp --dport 80 -j ACCEPT
  5. iptables -A INPUT -p tcp --dport 22 -j ACCEPT
  6. iptables -A INPUT -p tcp --dport 443 -j ACCEPT
  7. iptables -A OUTPUT -p icmp -j ACCEPT
  8. iptables -A INPUT -p icmp -j ACCEPT
  9. iptables -A INPUT -j REJECT
  10. iptables -A FORWARD -j REJECT


  11. cat > /etc/network/if-post-down.d/iptables <<EOF
  12. #!/bin/bash
  13. iptables-save > /etc/iptables.rules
  14. EOF
  15. chmod +x /etc/network/if-post-down.d/iptables

  16. cat > /etc/network/if-pre-up.d/iptables <<EOF
  17. #!/bin/bash
  18. iptables-restore < /etc/iptables.rules
  19. EOF
  20. chmod +x /etc/network/if-pre-up.d/iptables
复制代码



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


以前都是这么操作的   有没相同问题的  
作者: zhc670    时间: 2017-11-14 20:54
好像是运营商弄的,
我也碰到了,
一条条找吧。
作者: 大胡子    时间: 2017-11-14 21:01
zhc670 发表于 2017-11-14 20:54
好像是运营商弄的,
我也碰到了,
一条条找吧。

啊 不是吧  规则清掉就可以 自己的问题
作者: 冻猫    时间: 2017-11-14 21:35
iptables -L -n --line-numbers看看本身默认有没有规则,是不是冲突了。
作者: hdown    时间: 2017-11-14 22:02
你这样有个问题,如果你设置之前,有其他iptables规则和你冲突就完蛋。
所以你开头应该加一句iptables -F INPUT 来清除之前所有的规则。
作者: ghost    时间: 2017-11-15 01:54
為什麼現在一萬分不給當神仙了...
作者: domin    时间: 2017-11-15 02:07
我知道是什么问题.
你是不是装了锐速




欢迎光临 全球主机交流论坛 (https://gebi.eu.org/) Powered by Discuz! X3.4