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條的規則


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM