查看iptable各表的内容
# iptables -t mangle --list
# iptables -t raw --list
# iptables -t nat --list
# iptables -t filter --list or # iptables --list
注意:如果不指定-t选项,就只会显示默认的filter表
以下例子表明在filter表的input链, forward链, output链中存在规则:
root@server ~]# iptables --list -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-proh
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-proh
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
target – 前面提到的target的特殊值
prot – 协议:tcp, udp, icmp等
source – 数据包的源IP地址
destination – 数据包的目标IP地址