OPNsense Forum

English Forums => General Discussion => Topic started by: g0nz0uk on June 06, 2025, 03:23:23 PM

Title: How can I block traffic from certain countries please?
Post by: g0nz0uk on June 06, 2025, 03:23:23 PM
Hello,

My friend has bought the Ubiquity Dream Hub for his router/firewall, yeah it's very nice.  He's blocking traffic from China/Russia etc and I'd like to do the same with my OPNsense firewall.  How are you doing this on yours?

I use Grafana a lot and I'd love to plot the geo locations on there too, has anyone done this too?

Thanks
Title: Re: How can I block traffic from certain countries please?
Post by: Patrick M. Hausen on June 06, 2025, 03:26:50 PM
You need to register an account with Maxmind to be able to download the free geolocation database. Then you can create firewall aliases based on country.
Title: Re: How can I block traffic from certain countries please?
Post by: g0nz0uk on June 06, 2025, 05:41:56 PM
Sure I can do that, but what would I then need to do in the OPNsense GUI to use this?

Something like this https://docs.opnsense.org/manual/how-tos/maxmind_geo_ip.html
Title: Re: How can I block traffic from certain countries please?
Post by: Patrick M. Hausen on June 06, 2025, 06:05:14 PM
Exactly. As I wrote - with the subscription in place and active go to Firewall > Aliases and create GeoIP aliases by the country as you see fit. Then use these in firewall rules.