FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14170 questions

16819 answers

27660 comments

54138 members

0 votes
549 views 1 comments
by
Is it possible to make geolocation based firewall rules with Geoip database, or some other way. I would like to open some ports but only from my country and block other countries.

1 Answer

0 votes
by

There is no simple way to do this efficiently, you could create custom firewall rules for your country that allows connections, and set the default to deny all others.

Of course a simple VPN would get around this as a security measure.

IP lists are available, I found this: https://lite.ip2location.com/ip-address-ranges-by-country 

by
I'll try to do something with those lists, thanks. I was hoping there would be some automated solution, similar which I use with Pfsense firewalls, country IP lists are automatically updated etc. Those lists aren't very accurate but serves purpose here.

But, this is Linux and iptables, not giving up yet. And of course VPN is always an option and more secure.