Geolocation block using UFW

Is there a way of whitelisting access to ports based on ip geolocation using UFW.

2 Replies

There's no way to add an entire country or location to UFW using one command, but you could collect a list of IP addresses that are likely to be used in one location and then add all of them to UFW in just a few steps. There's a guide on doing so here:

https://scottlinux.com/2013/08/30/block-geo-region-list-of-ips-with-ufw-in-linux/

Good stuff, mjones. Thanks a lot for sharing. I blocked China just because.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct