ipset
Create and manage IP address sets for firewall rules
TLDR
SYNOPSIS
ipset command [options]
DESCRIPTION
ipset creates and manages IP sets, a framework for storing IP addresses, networks, ports, and combinations thereof. Sets can be referenced in iptables/nftables rules for efficient matching against large lists.Different set types support different entry formats: hash:ip for individual addresses, hash:net for CIDR ranges, hash:ip,port for address-port combinations. Sets use hash tables for O(1) lookup performance.
PARAMETERS
create NAME TYPE
Create a new IP set (types: hash:ip, hash:net, hash:ip,port, etc.)add NAME ENTRY
Add entry to a setdel NAME ENTRY
Remove entry from a setdestroy NAME
Delete a setlist [NAME]
List set contentssave [NAME]
Output sets in restorable formatrestore
Restore sets from saved outputtest NAME ENTRY
Test if an entry is in a setflush [NAME]
Clear all entries from a set-exist
Ignore errors when adding already existing entries or deleting non-existing entries-quiet
Suppress output
CAVEATS
Requires root privileges. Sets must be created before they can be referenced in firewall rules. Set contents are not persistent across reboots without explicit save/restore.
HISTORY
ipset was developed by Jozsef Kadlecsik to provide efficient set-based matching for the Linux firewall. It became part of the standard Linux networking toolkit and is widely used for implementing blocklists and allowlists.
SEE ALSO
iptables(8), nft(8), firewall-cmd(1)
