[晕事]今天做了件晕事7

今天在使用iptables与grep的时候碰到一件晕事;
第一步添加了一条rule到OUTPUT:
iptables -A OUTPUT --source 10.87.51.2 --destination 10.87.51.10 -p tcp --sport 5060 -j DROP
第二步使用:iptables -nL | grep DROP
发现这条记录跑到了FORWARD chain
在这里插入图片描述

后来经过详细的调查发现,iptables实际的内容是:
Chain FORWARD (policy DROP)
target prot opt source destination
ACCEPT udp – 0.0.0.0/0 0.0.0.0/0 udp dpt:514
ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp dpt:514
ACCEPT udp – 0.0.0.0/0 0.0.0.0/0 udp spt:514
ACCEPT tcp – 0.0.0.0/0 0.0.0.0/0 tcp spt:514

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all – 127.0.0.1 127.0.0.1
ACCEPT all – 127.0.0.1 127.0.0.1
ACCEPT all – 127.0.0.1 127.0.0.1
ACCEPT all – 127.0.0.1 127.0.0.1
IPV4_OUT all – 0.0.0.0/0 0.0.0.0/0
DROP sctp – 10.87.51.2 10.87.51.10
DROP sctp – 10.87.51.2 10.87.51.10

所以grep DROP 出现了一个假象。

猜你喜欢

转载自blog.csdn.net/qq_36428903/article/details/130378320
今日推荐