fir3net
PPS-Firenetbanner-780.5x190-30-03-17

IPTables -L output displays slowly

When running the command iptables -vL you may find that :

  • the output displays slowly.
  • the output (appears) to have hung.
You can further see what IPtables is doing via running iptables -vL. From this you will most likely see iptables trying to run a reverse DNS lookup (and failing).

Solution

Due to IPtables trying to resolve the IP addresses to name you will need to add the -n switch to successfully list the chains. . The -n switch ensures the numeric output of addresses and ports. 

[root@linux ~]# iptables -nvL
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
16500 1052K ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    1    52 ACCEPT     tcp  --  *      *       172.16.1.100         0.0.0.0/0           state NEW tcp dpt:9876
    0     0 ACCEPT     tcp  --  *      *       172.16.1.1           0.0.0.0/0           tcp dpt:80

!! remainder of output omitted !!
[root@MCAFEEGW7-B ~]# iptables -vL
Chain INPUT (policy DROP 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
14986  955K ACCEPT     all  --  any    any     anywhere             anywhere            state RELATED,ESTABLISHED

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001