List IPv4 NAT rules with counters
Build a paste-ready command, then review its compatibility and effects before running it.
iptables -t nat -L -n -v --line-numbersread-onlyno known side effects Compatibility
LinuxVerified for Linux using posix, bash, zsh syntax.
Operational knowledgereview due 2027-01-20
Requirementsiptablesiptables must be installed and available on PATH.
Version supportiptables Current supported releasesVerified for linux using posix, bash, zsh syntax; consult compatibility notes for platform-specific differences.
Expected signalsChain PREROUTING (policy ACCEPT 92 packets, 5520 bytes)Representative successful output; values vary with the selected target and system state.
Known errorsiptables: command not foundiptables is missing or is not available on PATH.
Verifyiptables -t nat -L -n -v --line-numbersThe output matches the expected target and exits without an error.Rollback noteNot required: this command is read-only and does not change system state.
Command breakdown
01iptablesCommandRuns the iptables stage of this one-liner.
02-tOptionConfigures iptables with the -t option.
03natArgumentPasses nat to iptables.
04-LOptionConfigures iptables with the -L option.
05-nOptionApplies the command-specific numeric, dry-run, or non-resolving mode.
06-vOptionEnables verbose output for this command.
07--line-numbersOptionConfigures iptables with the --line-numbers option.
Example input
iptables -t nat -L -n -v --line-numbers
Example output
Chain PREROUTING (policy ACCEPT 92 packets, 5520 bytes)
num pkts bytes target prot opt in out source destination
Illustrative output — exact values vary by system and data.
Official sources