understanding the output of iptables -L

tags: learning networking linux

content

output of iptables -L --line-numbers

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  10.42.0.0/16         anywhere
2    ACCEPT     all  --  anywhere             10.42.0.0/16

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
  • 3 chains
  • whatever in () is the default rule for that chain
    • e.g., for chain INPUT, if no rules specified, default is accept the packet
  • how to understand ACCEPT in a OUTPUT chain?
    • accept sounds like it’s only for incoming traffic, but it really just means allow
    • ACCEPT in a OUTPUT means allow a traffic to go out

up

iptables-chains

down

reference