There are different ways of printing out an iptables rule set. You're right to include -L
, but for troubleshooting this is not always sufficient. To have a full listing, use the -n
and -v
options with the -L
:
iptables -n -v -L
iptables -t yourtablename -n -v -L
that you can send to a txt file.
The -v
(verbose) option may be very useful in troubleshooting, as it shows the packets/byte counters for each rule. With it, one can often find a rule which doesn't catch anything. The -v
option shows also the interfaces (in and out), which are not shown with a simple -L
.
The -n
option makes it faster as it will not try to resolve ips to hosts.
If no -t
, then table filter is default.
There is also the command iptables-save -c
that show the rules the same way as they are entered on the command line (which is used for saving a rule set, that can be understood by iptables-restore to reload the rule set)