ipset
TLDR
Create an empty IP set
SYNOPSIS
ipset command [options]
DESCRIPTION
ipset creates and manages IP sets, which are 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 outputflush [NAME]
Clear all entries from a set
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.


