To display the status and rules of the iptables firewall on a Linux system, you can use the iptables
command with the -L
option.
iptables -L
This will list the rules for each of the iptables chains (input, output, and forward).
To display the rules for a specific chain, use the -L
option followed by the name of the chain. For example, to display the rules for the INPUT
chain:
iptables -L INPUT
To display the rule counters for each rule, use the -v
option:
iptables -L -v
To display the rules in a more human-readable format, use the -n
option:
iptables -L -n
To display the rules for the IPv6 version of iptables, use the ip6tables
command instead:
ip6tables -L