# man > ipset(8)

---
type: CommandReference
command: ipset
mode: man
section: 8
source: man-pages
---

## Quick Reference
- `ipset create myset hash:ip` — Create a hash set for IP addresses
- `ipset add myset 192.168.1.1` — Add an IP to the set
- `ipset del myset 192.168.1.1` — Delete an IP from the set
- `ipset test myset 192.168.1.1` — Check if IP is in the set
- `ipset list` — List all sets and their entries
- `ipset save` — Save all sets to stdout (restore-able format)
- `ipset restore < backup.txt` — Restore sets from a file
- `ipset destroy` — Destroy all sets

## Name
ipset — administration tool for IP sets

## Synopsis
shell
ipset [OPTIONS] COMMAND [COMMAND-OPTIONS]
Common commands: `create`, `add`, `del`, `test`, `destroy`, `list`, `save`, `restore`, `flush`, `rename`, `swap`, `help`, `version`, `-` (interactive).

## Options
### Global Options
- `-!, --exist` — Ignore errors when the set already exists or the entry is already present/missing.
- `-o, --output {plain|save|xml}` — Output format for the `list` command.
- `-q, --quiet` — Suppress all output to stdout and stderr.
- `-r, --resolve` — Force DNS lookups when listing entries (slow).
- `-s, --sorted` — List/save entries sorted.
- `-n, --name` — List only set names.
- `-t, --terse` — List only set names and headers.
- `-f, --file` — Specify a file for input or output.

### Key Create Options
- `timeout` — Default timeout (seconds) for entries. 0 means permanent.
- `counters` — Enable per‑element packet and byte counters.
- `comment` — Allow per‑entry comment strings.
- `hashsize` — Initial hash size (power of 2, default 1024).
- `maxelem` — Maximum number of elements (default 65536).
- `family {inet|inet6}` — IP protocol family (default `inet`).

## Examples
shell
# Create a hash:ip set with a default timeout
ipset create test hash:ip timeout 300

# Add an entry with a custom timeout
ipset add test 192.168.0.1 timeout 60

# Test membership
ipset test test 192.168.0.1

# Save all sets to a file
ipset save > /etc/ipset.conf

# Restore from a file
ipset restore < /etc/ipset.conf
## See Also
- [iptables(8)](http://localhost/phpMan.php/man/iptables/8/markdown)
- [ip6tables(8)](http://localhost/phpMan.php/man/ip6tables/8/markdown)
- [iptables-extensions(8)](http://localhost/phpMan.php/man/iptables-extensions/8/markdown)