iptables do?administer the Linux kernel IPv4 packet-filter rules (netfilter firewall).
▸ Explain your own iptables command →$ iptables -A INPUT -p tcp --dport 22 -j ACCEPT
$ iptables -L -n -v
$ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
| -A | append a rule to the end of the given chain |
| -I | insert a rule at a position in a chain (default: the top) |
| -D | delete a matching rule from a chain |
| -L | list all rules in a chain |
| -F | flush — delete every rule in a chain |
| -N | create a new user-defined chain |
| -X | delete an empty user-defined chain |
| -P | set the default policy (ACCEPT/DROP) for a built-in chain |
| -p | match a protocol (tcp, udp, icmp, ...) |
| -s | match a source address or subnet |
| -d | match a destination address or subnet |
| -j | jump to a target (ACCEPT, DROP, REJECT, ...) on a match |
| -i | match the input network interface |
| -o | match the output network interface |
| -m | load an extension match module (e.g. state, conntrack) |
| -n | numeric output — don't resolve host names or ports |
| -v | verbose output |
| -t | operate on the given table (filter, nat, mangle, raw) |
| --dport | match the destination port |
| --sport | match the source port |
| --state | match connection state (NEW, ESTABLISHED, RELATED) |
| --line-numbers | show rule line numbers when listing |
Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.