Self-host nftables blacklist
Bash script to block malicious IPs via nftables blacklists
- Stars
- 37
- Requires
- Iprange, Nftables
What is nftables blacklist?
This bash script fetches IP addresses from public blocklists and applies them as nftables rules on Linux servers. It handles both IPv4 and IPv6 with CIDR notation, merges overlapping ranges automatically, and performs atomic rule swaps. The tool can process over 100,000 blocked IPs and includes automatic whitelisting of the server's own addresses. It runs on any Linux system with nftables and the iprange utility, and can be executed manually, scheduled via cron, or managed through systemd services and timers. All configuration lives in a bash config file where users define blocklist sources, whitelist entries, and runtime options.
nftables blacklist alternatives
cactusdcactusd is an open-source, self-hosted daemon that aggregates and serves domain/IP blocklists for DNS-based ad-blocking, updating every 12 hours with a built-in web UI.Comparecactusd with nftables blacklist
super📡 SPR: Open Source, secure, user friendly and fast wifi routers for your home. One wifi password per device. Ad Blocking & Privacy Blocklists. Policy Based Network AccessComparesuper with nftables blacklist
firewalldfirewalld is a self-hosted, open-source firewall daemon for Linux that manages IPv4/IPv6 rules through network zones and a D-Bus interface.Comparefirewalld with nftables blacklist
gatekeeperSelf-hosted DHCP/DNS server for home networks with web dashboard, Full Cone NAT, and zero-config setup.Comparegatekeeper with nftables blacklist
Fail2Ban-ReportSelf-hosted web dashboard aggregating Fail2Ban logs from multiple servers into searchable JSON reports with UFW blocklist sync and role-based auth.CompareFail2Ban-Report with nftables blacklist
FireHOLFireHOL is a self-hosted, open-source iptables firewall generator and traffic shaper for Linux with human-readable configs.CompareFireHOL with nftables blacklist
yantrYantr is a self-hosted homelab app store running as a rootless Podman container alongside your Linux OS — no appliance, no root daemon, ~140 MB RAM at idle.Compareyantr with nftables blacklist
PritunlSelf-hosted distributed VPN server for OpenVPN, WireGuard and IPsec with a web console, SSO and 2FA, MongoDB-backed clustering and site-to-site links.ComparePritunl with nftables blacklist
Should you self-host nftables blacklist?
nftables blacklist scores 42/100 on selfhost.directory (how scoring works) and ranks #8 of 15 in Network Security. It has 37 GitHub stars, +15 in the last 30 days.
There was no stable release in the past 12 months, so check the repository's recent activity before you rely on it.
Setup is moderate: expect some configuration beyond a single command. It is MIT-licensed and written mostly in Shell.
Its closest alternative on selfhost.directory is bettercap (76/100, 20 279 stars). It scores higher overall, so compare the two before you pick. See nftables blacklist vs bettercap side by side.
Features
- Atomic updates
- Auto-whitelisting
- CIDR aggregation
- Country/ASN blocking
- Cron/systemd timer support
- Custom blacklist sources
- Drop packet counters
- Dry Run Mode
- External whitelist files
- Forward chain blocking
- IPv4 and IPv6 blocking
- Large IP set handling
- Persistence across reboots
nftables blacklist README
⭐ This repo survived thirteen years and a spell in the Arctic Code Vault, then a coding agent I was running flipped it private for about two minutes. GitHub responded by vaporising all 766 stars and cutting all 181 forks loose. The code is fine. My pride is not.
If you forked before 25 August 2026: your copy still works, it is just no longer linked here. Re-fork if you want GitHub's "Sync fork" button back.
If you had starred it: yours is gone too. A re-star is appreciated, but the script works either way.
More in Network Security
ntopngSelf-hosted, open-source (GPLv3) network traffic monitor: live flows, top talkers, nDPI layer-7 detection, NetFlow/sFlow collection and a REST API.
openvpnOpenVPN is an open-source, self-hosted VPN daemon for remote access and site-to-site tunnels, offering PKI auth, NAT traversal, TUN/TAP devices, and post-quantum TLS.
OpenZitiOpenZiti is an open-source, self-hosted zero-trust overlay network: identity-based access, dark services with no open ports, tunnelers and SDKs instead of VPN.
opnsenseSelf-hosted, open-source firewall and routing platform on FreeBSD: stateful filtering, VPN, Suricata IPS, multi-WAN failover, all managed from a web GUI.
Outline ServerOutline Server is a self-hosted, open-source Shadowsocks proxy with a REST API for access keys, enabling your own censorship-resistant VPN.
phantom-wgPhantom-WG is a self-hosted, open-source WireGuard VPN platform with multihop routing, IPv6 dual-stack, and crash recovery via SQLite, all in isolated Docker containers.
pia-tunSelf-hosted Docker container for PIA WireGuard VPN with strict killswitch, port forwarding, SOCKS5/HTTP proxies, and port syncing for torrent clients.
pihole-doh-wireguardSelf-hosted Docker Compose stack combining Pi-hole ad-blocking, Cloudflared DNS-over-HTTPS encryption, and WireGuard VPN for secure remote access to your home network.
pihole-unbound-dockerSelf-hosted DNS ad-blocking with Pi-hole and Unbound recursive resolver for privacy and security, deployed via Docker Compose.
PomeriumOpen-source self-hosted identity-aware reverse proxy that gates private web apps, SSH and TCP services through OIDC sign-in and per-request access policy.
SafeLineSafeLine is an open-source, self-hosted WAF protecting web apps from SQL injection, XSS, and DDoS via intelligent semantic analysis. Runs as a Docker reverse proxy.
ShadowsocksOpen-source, self-hosted Shadowsocks proxy in pure C (the renamed shadowsocks-libev) with AEAD and SIP003 obfuscation, static builds and Docker images.
0 comments