14

Is there a way to show the network interfaces via iptables -L in Ubuntu 12.04?

When I execute an iptables -L I get an output like this :

Chain INPUT (policy DROP)
target     prot opt source               destination       
...
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0     
...

which is somehow misleading. First I was thinking, great rule, allows everything until I discovered that this rule is bound to interface localhost.

Is there a way to get an overview which shows the rules and the interfaces at once?

16

Add -v for the verbose mode.

Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
39050 4448K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0           
 6595  544K ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0           
  419 15084 ACCEPT     2    --  *      *       0.0.0.0/0            0.0.0.0/0           

Even better, change the command to -S for plain mode:

-P INPUT ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p igmp -j ACCEPT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.