B
B
Bobur Bakhritdinov2015-10-16 10:01:47
linux
Bobur Bakhritdinov, 2015-10-16 10:01:47

iptables geo filter rules?

Help solve the problem, block all countries except one, using the ip range! xtables I already tried it skips packets.
OS: Centos 6.7
IPTABLES: 1.4.7

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mikes, 2015-10-16
@bakhritdinov_b

If you do not drive with geoip modules, then you need ipset

ipset -N %country% hash:net
wget -P . http://www.ipdeny.com/ipblocks/data/countries/%country%.zone
for i in $(cat /etc/%country%.zone ); do ipset -A %country% $i; done
iptables -P INPUT DROP
iptables -A INPUT -p tcp -m set --match-set %country% src -j ACCEPT

this is what it looks like to me

A
Axian Ltd., 2015-10-16
@AxianLTD

Google "geo filter iptables"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question