Skip to content

Block a Country (or ASN, or Network) Safely

License: pro tier and above. See Licensing. Full reference: Client Blocking.

Read this first. Nexus sees the resolver that asks, not the person behind it. Blocking a country stops resolvers located there; users in that country on a public resolver abroad are still answered, and users anywhere on a blocked country's ISP resolver are not.

Lockout warning. A block over your monitoring's addresses makes your nodes look dead to it. Add allow rules first.

New rules start in dry-run: they count matches but answer normally, so you can see the effect before it bites.

Steps

  1. Check the databases. Open Client Blocking in the WebUI (or run gslbctl client-block list). If a banner says no country or ASN database is loaded, rules of that type will not match anything until you load one.
  2. Add allow rules first for everything that must keep working: your monitoring, the secondaries and primaries you transfer zones with, and any partner resolvers. An allow rule always beats a block.
    gslbctl client-block add --type cidr --value 203.0.113.0/24 --action allow
    
  3. Add the block in dry-run (the default):
    gslbctl client-block add --type country --value RU --action drop
    
    drop sends nothing back; refuse answers a bare REFUSED.
  4. Watch Hits for a day. If the number is zero, the rule matches nothing (check the databases); if it is larger than you expect, find out who is asking before you block them.
  5. Enforce — the Enforce button, or gslbctl client-block update <id> --enforce. Every node starts blocking within about five seconds.
  6. To undo, press Dry run (or --dry-run) to keep counting without blocking, or delete the rule. Deleting works even if the licence has expired.

What it does not cover

Only DNS. The REST API, WebUI and /metrics are HTTP; use a host firewall for those.