|
|
|
|
| 讨论--ipset实现动态更新iptables规则 |
 讨论--ipset实现动态更新iptables规则 - lxtmac [ 2007-03-29 15:09 | 364 byte(s)]
 Re: 讨论--ipset实现动态更新iptables规则 - liuzhuan23 [ 2007-04-13 09:45 | 1,758 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
1)
http://ipset.netfilter.org/ipset.man.html
2)
#建立链a1,链类型ipmap,包含192.168.0.0网络,掩24位
ipset -N a1 ipmap --network 192.168.0.0/24
#在链a1下插入一个IP,192.168.0.23
ipset -A a1 192.168.0.23
#建立链a2,链类型ipmap,包含192.168.0.23到192.168.0.100范围之内IP
ipset -N a2 ipmap --from 192.168.0.23 --to 192.168.0.100
ipset -A a2 192.168.0.23
#建立链ports,链类型portmap,包含1到1024之内端口号
ipset -N ports portmap --from 1 --to 1024
ipset -A ports 21
#把链a1默认绑定到链ports(使链a1中每个成员都具有链ports属性)
ipset -B a1 :default: -b ports
#把链a1中的成员192.168.0.23绑定到链ports(此链中只有192.168.0.23具有链ports属性)
ipset -B a1 192.168.0.23 -b ports
#建立链c1,链类型macipmap........
ipset -N c1 macipmap --network 192.168.0.0/24
ipset -A c1 192.168.0.23%00:14:78:2A:74:CA
ipset -N c2 macipmap --from 192.168.0.23 --to 192.168.0.100
ipset -A c2 192.168.0.23%00:14:78:2A:74:CA
#建立链c3,链类型iptree,计时时间为360秒
ipset -N c3 iptree --timeout 360
ipset -A c3 192.168.0.23
#显示链a1
ipset -L a1
#检测链a1中是否具有102.168.0.23成员
ipset -T a1 192.168.0.23
#删除链a1
ipset -X a1
#应用到iptables
iptables -A INPUT -m set --set a1 src -j DROP
|
|
|
----
When you know Slackware you know Linux.
|
|
[Original]
[Print]
[Top]
|
|
|