Skip to content

Instantly share code, notes, and snippets.

@asheroto
asheroto / README.md
Last active November 17, 2025 21:12
Easily install and configure GeoIP for use with iptables which enables you to block/allow entire countries.

Configure GeoIP for iptables

Important

This setup forces iptables-legacy (not nftables) and installs a custom-built xt_geoip_query tool written in C to properly read modern GeoIP databases (xtables-addons ≥ 3.20). The script does not modify firewall rules automatically; it only echoes recommended examples.

Caution

If you use Docker or containerized services, switching to iptables-legacy can temporarily break container networking. This happens because Docker manages its own NAT and MASQUERADE rules, which can be lost when iptables backends change or modules are reloaded. SEE NOTES BELOW.