Is it possible "forwarded port" to allow only for specific country via geo-block in ip-tables? How?
ipset list BlockedCountries
Name: BlockedCountries
Type: hash:net
Revision: 0
Header: family inet hashsize 1024 maxelem 65536
Size in memory: 8500
References: 10109
Members:
./IPSET_List.sh BlockedCountries
IPSET BlockedCountries==>
1.0.1.0/24 1.0.2.0/23 1.0.8.0/21 1.0.32.0/19 1.1.0.0/24 1.1.2.0/23 1.1.4.0/22 1.1.8.0/24 1.1.9.0/24 1.1.10.0/23 1.1.12.0/22 1.1.16.0/2 1.1.32.0/19 1.2.0.0/23 1.2.2.0/24 1.2.4.0/24 1.2.5.0/24 1.2.6.0/23 1.2.8.0/24 1.2.9.0/24 1.2.10.0/23 1.2.12.0/22 1.2.16.0/20 1.2.32.0/1 1.2.64.0/18 1.3.0.0/16 1.4.1.0/24 1.4.2.0/23 1.4.4.0/24 1.4.5.0/24 1.4.6.0/23 1.4.8.0/21 1.4.16.0/20 1.4.32.0/19 1.4.64.0/18 1.6.0.0/1 1.8.0.0/16 1.10.0.0/21 1.10.8.0/23 1.10.11.0/24 1.10.12.0/22 1.10.16.0/20 1.10.32.0/19 1.10.64.0/18 1.12.0.0/14 1.22.0.0/15 1.24.0.0/13 1.38.0.0/1 1.45.0.0/16 1.48.0.0/15 1.50.0.0/16 1.51.0.0/16 1.56.0.0/13 1.68.0.0/14 1.80.0.0/13 1.88.0.0/14 1.92.0.0/15 1.94.0.0/15 1.116.0.0/14 1.180.0.0/1 1.184.0.0/15 1.186.0.0/16 1.187.0.0/16 1.188.0.0/14 1.192.0.0/13 1.202.0.0/15 1.204.0.0/14 14.0.0.0/21 14.0.12.0/22 14.1.0.0/22 14.1.24.0/22 14.1.96.0/2
<snip> etc.
iptables -I VSERVER -t nat -m set ! --match-set BlockedCountries src -p tcp -m tcp --dport 12345 -j DNAT --to 172.16.0.12:34567
iptables -nvL VSERVER --line -t nat
Chain VSERVER (1 references)
num pkts bytes target prot opt in out source destination
1 0 0 DNAT tcp -- * * 0.0.0.0/0 0.0.0.0/0 ! match-set BlockedCountries src tcp dpt:12345 to:172.16.0.12:34567
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!