In case you want to block all Russian (or any) domains

I got this from somewhere a long time ago and it's been on by blacklist since the beginning, but in case you're worried about anything cyber coming from a country (e.g. Russia and China) then here's how to blacklist their domains:

Blacklist | Regex Filter | Domain

ru = Russia
cn = China
hk = Hong Kong


Explain more please.. is it just changing like that? I want to try


Countries usually have their own domain extensions.
For example, the domain extension for the UK is

This is useful for some larger international companies that have regional sites for language or shopping purposes. Amazon is a good example where they have regional domains serving a global customer base.

If you wanted to block a domain extension for a country then you can use the above REGEX statement and add the extension name for the PiHole to ignore it.

e.g. Want to exclude Australia, add "au" to the list. Block french sites, add "fr". Block some sex websites, add "xxx" and "sex" to the REGEX. This will work for any domain extension that you want to block.

Adding all these to the above regex would look like this:

Here's a list of countries and their related top level domain extensions:

REGEX is a form of pattern recognition and is a way of telling the PiHole to ignore any domain as long a it ends with the extensions you select (separated by the pipe "|")
More info on REGEX here: Regular expression - Wikipedia

Is that explanation useful ... or did I misinterpret your question?

Is there a more efficient way to write this regex? I ended up putting all ccTLDs into one expression.


Honestly, if you want to block all of that then just wildcard block the full internet with a regex of * and then whitelist the individual TLD's you trust.

Note, this won't do very much for you. Malware doesn't usually leave a calling card with their country TLDs.


@callar Thanks for your explanation and to all who have left their comments.

I've found it useful to block Cameroon and Oman ccTLDs, not because they're evil, but to protect me from typosquatting, eg. or

A lot of the new gTLDs (win, click, bid, bet, top, cricket, ..) look to me like they're only used for sketchy advertising, spam, or phishing. No ill effects in blocking them wholesale, and minimal support burden from the family (no complaints about blocking too much useful stuff, no having to reimage people's machines every couple of weeks because they're clicking on too much crap).

1 Like