http://wiki.openwrt.org/TransparentFirewall学习
里面有这么一段开服务端口的 iptables .规则外贸
# SSH
ipta.bles -A INPUT -p. TCP --dport 22 \ 鲜花
-m recent --name ROUTER-SSH --update --hitc.ount 5 --seconds 180 -j. DROP 婚庆
iptables -A .INPUT -p TC.P --dport 22 \.
-m recent --name ROUTER-SSH --set. -j .ACCEPT域名
复制代码
查看了 recent .的帮助文档.
recent v1.2.11 .options:教育
[.!] --set Add so.urce address to list, always matches.学习
[!] --rcheck . Mat.ch if source address in list.--- 印刷
[!] --update . Match if source address in list, also .update last.-seen time.域名
[!] --re.move Match if sour.ce address in list, also remo.ves that address from list. 美容
--seconds seconds For check and upda.te .commands above..
. . . Specifies that the match will only occur if source address last seen within.
the .last 'seconds' secon.ds.( 游戏 )
--hitcount hits . For check and update commands above..--------------彩票
. . Specifies that. the match will only occur if source address seen hits times.电脑
May. be used in .conjunctio.n with the seconds option. 汽车
--rttl For check and upda.te comm.ands above.--------------彩票
Specifies that the match will only occur i.f th.e source ad.dress and the TTL.
. . match between this .packet and the one which was set. 鲜花
. .Useful if you have problems with people spoofing their source address in or.der.
. to DoS you via this module...
--name name Name of. the recent. list to be used. DEFAULT .used if none given. 鲜花
--rsource . Match/Save the source address of e.ach pac.ket in the recent list table (default). 健康
--rdest Match/Save the destin.ation address of each packet in th.e recent .list table..
ipt_recent v0.3.1: Stephen Frost <
sfrost@snowman.net>.
http://snowman.net/projects/ipt_recent/.复制代码
可惜没能弄懂什么意思,哪位能讲一下.?.
最佳答案wysilly
http://upload.bbs.csuboy.com/Mon_1004/126_6774_c2515fb4e40125e.gif[/img]iptables -A INPUT -p TCP --dport 22 \健康
-m recent --.name ROUTER-SSH --set -j. ACCEPT( 游戏 )
这句目的为生成一个名为RO.UTER-SSH的recent.表. 建材
ipta.bles -A INPUT -p TCP --dport 22 .\.
-m. recent --name ROUTER-SSH --update. --hitcount 5 --seconds 180 -j DROP虚拟主机
目的为在持续的180秒,.命中多于5次的连接就被d.rop掉.就是只允许在180秒内同一个ip只能有5个ssh的连接. 婚庆
不过这两.句好像写的也不怎么对. 鲜花
iptabl.es -A INPUT -p tcp --dport 22 -m stat.e --state NEW -m recent --name ROUTER-SSH --update --.seconds 1800 --.hitcount 5 -j DROP.
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --name R.OUTER-SSH .--set .-j ACCEPT.
我觉得这样更好.下面的这个man说的比较清.楚. 女人
QUOTE:recent
Allows you to dynamically create a list of. IP addresses and then. mat.ch against that list in a few different<性病>
ways.
.For example, y.ou can create a `badguy' list out of people attempting to connect to port 139 o.n your firewall教育
. and then DROP all fut.ure packets from them without considering them.外贸
-.-name name健康
Sp.ecify the list to use for the commands. If no name is given then 'DEFAULT'. will be used.. 杀毒
[!] .--set[成人用品]
This wi.ll add the source address of the packet to the list.. If. the source address is already in the( 游戏 )
list, this will up.date the existing ent.ry. This will always return success (or failure if `!' is .passed.
. in). 汽车
. [!] --rcheck 外汇
. Check if the source add.ress of the p.acket is currently in the list.学习
[!] --upda.te服务器
. Like --rch.eck, except it will update the "last seen" timestamp if it .matches..
[!] --remov.e[成人用品]
Check i.f the source. address of the packet is currently .in the list and if so that address will be域名
removed from the list and the rul.e wil.l return true. If the address is not found,. false is returned. 婚庆
[!] --secon.ds s.econds 女人
. . This option must be used in conjunction with .one of --rcheck or --update. When used, this will narrow 建材
the match to only happen when the address i.s in the list a.nd was seen within the last given number o.f 健康
. seconds.虚拟主机
[!] --hitcount hi..ts 杀毒
. This option must be. used in conjunction with one of --rcheck or --update. When used, this will narr.ow<性病>
. the match to only happen when the a.ddress is in the list and pack.ets had been received greater than or虚拟主机
equal to the given value. This op..tion may be used along with --seconds to create an even narrower mat.ch( 游戏 )
. r.equiring a certai.n number of hits within a specific time frame. 建材
--.rttl This option must be used in c.onjunction with one of --rcheck or --update. When u.sed, this will narrow.
. the match to only happen when the address is in the list and the. TTL of the current packet matches .that.
. of the packet which hi.t the --set rule. This may be useful if you have problems with peo.ple faking their教育
source address in order to DoS you via this module by disa.llo.wi.ng others access to your site by sending 杀毒
. bogus packets to y.ou.服务器
cat. /proc/net/ipt_recent/ROU.TER-SSH学习
类似
src=192.168.1.2 ttl: 63 last_seen: 44747.58176 oldest_pkt: 6 last_pk.ts: 44.74758176, 4474758176, 4474758176, 4474758176, 4474758176, 4474.75817.1,. 4474758171, 4474758171, 4474758171, 4474758171, 447475817.1, 4474758171, 4474758172, 4474758172, 4474758176, 4474758176, 4474758176, 4474758176, 4474758176.
last_pkts后为.最近通过的packet的时间.oldest_pkt为已经记录的过的packet数.大概就是这样了,应该很.容易明白了.
[ 本.帖最后由 wysilly 于. 2007-6-10 13:24 编辑 ]电脑