Skip to contentSkip to conversation

iptables -n doesn't display numbers in all cases for prot column

DISCUSSION Marcin Mirosław 1 participant 1 message Nov 25, 2011

lore
Share & tools
lore
#0 lore raw

Hello!
I'd like to ask you about such situation. When i display rules without using "-n" i'm getting:

# iptables -L -v
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source 
destination
    0     0 ACCEPT     ipencap--  any    any     anywhere 
anywhere
    0     0 ACCEPT     ipv6 --  any    any     anywhere 
anywhere
    1    88 ACCEPT     icmp --  any    any     anywhere 
anywhere
   94 13850 ACCEPT     udp  --  any    any     anywhere 
anywhere
  801  632K ACCEPT     tcp  --  any    any     anywhere 
anywhere

It's ok. When i add "-n" switch i'm getting:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source
destination

    0     0 ACCEPT     4    --  *      *       0.0.0.0/0 
0.0.0.0/0
    0     0 ACCEPT     41   --  *      *       0.0.0.0/0 
0.0.0.0/0
    1    88 ACCEPT     icmp --  *      *       0.0.0.0/0 

0.0.0.0/0
101 14402 ACCEPT udp -- * * 0.0.0.0/0
0.0.0.0/0
905 651K ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0

As we can see protocols "ipencap","ipv6" are shown as number but icmp/tcp/udp wasn't displayed as number of protocol.

$ grep "tcp\|udp\|icmp" /etc/protocols
icmp    1       ICMP            # internet control message protocol
tcp     6       TCP             # transmission control protocol
udp     17      UDP             # user datagram protocol
# iptables -V
iptables v1.4.12.1

My question is: why some protocols are always displayed as protocol name even i use "-n" switch? Thanks for help.
Marcin