Geolocation block using UFW

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

2 Replies

Linode Staff

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:

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


Please enter an answer

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] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct