iptables常见的模块拓展-m iprange 、-m multiport、

1、
指定-m multiport就可以使用--dports、--sports
参考:http://www.zsythink.net/archives/1544

标准的--dport与--sport使用方式: 80、80:90、:80、90:
扩展的--dports与--sports使用方式:以上组合,使用冒号来分离。

2、
指定-m iprange就可以使用--src-range 、--dst-range
参考:http://www.zsythink.net/archives/1564
标准的-s 使用方式:192.168.1.1、192.168.1.0/24、192.168.1.2,10.1.1.1、(192.168.1.1,10.1.1.0/24???)
扩展的--src-range: from[-to] 应该是单独192.168.1.1、192.168.1.0/24、192.168.1.5-192.168.1.6

实际操作:
root@ca:~# iptables -t filter -I INPUT -p tcp -s 111.192.82.1,112.35.36.2 --dport 40022 -j ACCEPT
实际会拆解成2条规则

root@ca:~# iptables -t filter -I INPUT -m iprange --src-range 111.192.82.1,112.35.36.2 --dport 40022 -j ACCEPT
iptables v1.6.0: iprange: Bad value for "--src-range" option: "111.192.82.1,112.35.36.2"
Try `iptables -h' or 'iptables --help' for more information.
思考:iprange是否要连续ip地址

3、
iptables -I INPUT 3 -p tcp -m tcp --dport 40022,8006 --tcp-flags FIN,SYN,RST,ACK SYN -m recent --rcheck --seconds 60 --name prox --mask 255.255.255.255 --rsource -j ACCEPT
以上出现语法错误

iptables -I INPUT 3 -p tcp -m tcp -m multiport --dports 40022,8006 --tcp-flags FIN,SYN,RST,ACK SYN -m recent --rcheck --seconds 60 --name prox --mask 255.255.255.255 --rsource -j ACCEPT
以上为1条规则,不像当-m iprange --src-range 连续ip段时,会拆分为1条1条的规则

posted @ 2020-12-02 11:41  helloweifa  阅读(3081)  评论(0编辑  收藏  举报