sydomain

思绪来的快,去的也快,偶尔在这里停留。

安装ipset

本文介绍centos7.0安装ipset方法

安装ipset

yum install ipset

创建集合,名称为blacklist

# 创建集合,hash:ip 只支持IP
ipset create blacklist hash:ip
# 创建集合,hash:net支持IP段 (推荐)
ipset create blacklist hash:net
# 创建集合,最大IP数量,默认65535
ipset create blacklist hash:net maxelem 100000

添加IP

# 添加IP进入集合
ipset add blacklist 122.11.11.11
# 添加IP段进入集合,1到254
ipset add blacklist 122.11.11.0/24
# 拒绝集合通过TCP的80端口进行连接
iptables -I INPUT -m set –-match-set setname src -p tcp –destination-port 80 -j DROP


Powered By sydomain

Copyright Your WebSite.Some Rights Reserved.