iptables

iptables -I INPUT 1 -i eth0 -p tcp –dport 80 -m state –state NEW,ESTABLISHED -j ACCEPT

 iptables -nvL

  • -L 表示查看当前表的所有规则,默认查看的是 filter 表,如果要查看 nat 表,可以加上 -t nat 参数。
  • -n 表示不对 IP 地址进行反查,加上这个参数显示速度将会加快。
  • -v 表示输出详细信息,包含通过该规则的数据包数量、总字节数以及相应的网络接口。
iptables -I FORWARD -p tcp --dport 8080 -j ACCEPT
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

sudo iptables -I FORWARD -p tcp --dport 8080 -j LOG --log-prefix "IPTables-Dropped: " --log-level 4
iptables -nvL
iptables -Z
iptables -P FORWARD ACCEPT
iptables -P FORWARD DROP
iptables -L FORWARD --line-numbers
iptables -D INPUT 2
iptables -D FORWARD 8


iptables -I FORWARD -p all --dport 8080 -j ACCEPT
Published At