Skip to contentSkip to conversation

misleading print

iptables U.Mutlu 4 participants 4 messages Dec 5, 2011 – Aug 9, 2012

lore
Share & tools
lore

U.Mutlu

author
#0 lore raw

I have in my script these statements:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

When doing "iptables -L -n" then the above gets shown as this:
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

IMHO, this could easily be misinterpreted if one looks only at the iptables output, because the crucial info, ie. that it applies to the "lo" device only, is missing...

Right?

#1 lore raw
Quoted 4 lines · U.Mutlu

I have in my script these statements:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

Quoted 8 lines

When doing "iptables -L -n" then the above gets shown as this:
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

IMHO, this could easily be misinterpreted if one looks only at the iptables output, because the crucial info, ie. that it applies to the "lo" device only, is missing...

Right?

That's why one should use iptables -S or iptables-save.

#2 lore raw
In reply to U.Mutlu
Quoted 10 lines · U.Mutlu

I have in my script these statements:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

When doing "iptables -L -n" then the above gets shown as this:

   ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0

IMHO, this could easily be misinterpreted if one looks only at the iptables output, because the crucial info, ie. that it applies to the "lo" device only, is missing...

Output of "iptables -L" doesn't show -i and -o matches by default. If you want to see them, use "-v" option.

Michal Kubeèek

#3 lore raw
Quoted 8 lines · Michal KubeÄ�ek
Quoted 7 lines · U.Mutlu

I have in my script these statements:
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

When doing "iptables -L -n" then the above gets shown as this:

   ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
Quoted 6 lines
Quoted 3 lines

IMHO, this could easily be misinterpreted if one looks only at the iptables output, because the crucial info, ie. that it applies to the "lo" device only, is missing...

Output of "iptables -L" doesn't show -i and -o matches by default. If you want to see them, use "-v" option.

Let's start a vote (of sorts) for getting rid of -L. Yes, it'll break people's oh-so-sacred scripts. But heck, you can't reasonably parse it anyway.