Using command
iptables -L
I list the rules in a all chains, but this tool lists host names instead of IP addresses for the rules that are saved. This is kind of hard reading, as in case I want to quickly find some IP address in the list, it is impossible.
Is there a way, the command switch or anything simple to use, that would let me list my iptables rules with IP addresses and not host names?
iptables is a user-space utility program that allows a system administrator to configure the IP packet filter rules of the Linux kernel firewall, implemented as different Netfilter modules. The filters are organized in different tables, which contain chains of rules for how to treat network traffic packets.
Using IP sets allows you to create an easy to manage list of IP addresses that iptables can use in it's rules. As we have shown when paired with a simple Bash script it can also help to create rules from a hostname or domain name.
Use the following:
iptables -L -n
From the man page:
-n, --numeric
Numeric output. IP addresses and port numbers will be printed in numeric format.
By default, the program will try to display them as host names, network names,
or services (whenever applicable).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With