Skip to contentSkip to conversation

/sbin/iptables -vnxL OUTPUT

DISCUSSION Mario Ohnewald 2 participants 5 messages Mar 2, 2004 – Mar 4, 2004

lore
Share & tools
lore
#0 lore raw

Hello!
I have got a iptables firewall running and i want to monitor my traffic,
therefore i played arund with the following command: /sbin/iptables -vnxL
OUTPUT | grep "Chain OUTPUT"
It worked fine, although, after a while it kept getting the result:
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
I reloaded the filter rules, still the same.

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source
destination

       9     2051 ACCEPT     all  --  *      lo      0.0.0.0/0           
0.0.0.0/0
       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0           
0.0.0.0/0           icmp type 11
       2      132 ACCEPT     icmp --  *      *       0.0.0.0/0           
0.0.0.0/0           icmp type 3 code 3
       0        0 DROP       icmp --  *      *       0.0.0.0/0           
0.0.0.0/0           icmp type 3
    9535  2685876 ACCEPT     all  --  *      *       0.0.0.0/0           
0.0.0.0/0           state NEW,RELATED,ESTABLISHED
       0        0 LOG        all  --  *      *       0.0.0.0/0           

0.0.0.0/0 LOG flags 6 level 4 prefix `SuSE-FW-OUTPUT-ERROR '

dory:/home/sts/# /sbin/iptables -vnxL OUTPUT
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source              
destination
       9     2051 ACCEPT     all  --  *      lo      0.0.0.0/0           
0.0.0.0/0
   10140  2866335 ACCEPT     all  --  *      *       0.0.0.0/0           
0.0.0.0/0           state NEW,RELATED,ESTABLISHED
       0        0 LOG        all  --  *      *       0.0.0.0/0           
0.0.0.0/0           LOG flags 6 level 4 prefix `SuSE-FW-OUTPUT-ERROR '
dory:/home/sts/# /sbin/iptables -vnxL OUTPUT
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
    pkts      bytes target     prot opt in     out     source              
destination
       9     2051 ACCEPT     all  --  *      lo      0.0.0.0/0           
0.0.0.0/0
       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0           
0.0.0.0/0           icmp type 11
   12236  3394902 ACCEPT     all  --  *      *       0.0.0.0/0           
0.0.0.0/0           state NEW,RELATED,ESTABLISHED
       0        0 LOG        all  --  *      *       0.0.0.0/0           
0.0.0.0/0           LOG flags 6 level 4 prefix `SuSE-FW-OUTPUT-ERROR '

How come it wont count up the Accepted packaged and Bytes? If you need any more infos, please tell me!

Thanks, Mario!

Signature · 2 lines
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
#1 lore raw

* Mario Ohnewald <[email protected]> 2. Mar 04:

Quoted 1 line

Hello!

Hi,

Quoted 6 lines

I have got a iptables firewall running and i want to monitor my traffic,
therefore i played arund with the following command: /sbin/iptables -vnxL
OUTPUT | grep "Chain OUTPUT"
It worked fine, although, after a while it kept getting the result:
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
I reloaded the filter rules, still the same.

Please don't wrap outputs.

Quoted 1 line

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)

                    These-----^----------^

are only the counters of your default policy. Your traffic is...

Quoted 6 lines
    pkts      bytes target     prot opt in     out     source              destination
       9     2051 ACCEPT     all  --  *      lo      0.0.0.0/0           0.0.0.0/0
       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0           0.0.0.0/0           icmp type 11
       2      132 ACCEPT     icmp --  *      *       0.0.0.0/0           0.0.0.0/0           icmp type 3 code 3
       0        0 DROP       icmp --  *      *       0.0.0.0/0           0.0.0.0/0           icmp type 3
    9535  2685876 ACCEPT     all  --  *      *       0.0.0.0/0           0.0.0.0/0           state NEW,RELATED,ESTABLISHED
     ,^^^^--^^^^^^^

... here.

Quoted 5 lines

0 0 LOG all -- * * 0.0.0.0/0 0.0.0.0/0 LOG flags 6 level 4 prefix `SuSE-FW-OUTPUT-ERROR '

[snip stuff]

How come it wont count up the Accepted packaged and Bytes?

It would, but as you -j ACCEPT everything before the default policy it can't.

HTH,
regards, Frank.

Signature · 1 line
Sigmentation fault
#2 lore raw

Hi,

Quoted 29 lines
Quoted 2 lines

I have got a iptables firewall running and i want to monitor my traffic,
therefore i played arund with the following command: /sbin/iptables

-vnxL

Quoted 4 lines

OUTPUT | grep "Chain OUTPUT"
It worked fine, although, after a while it kept getting the result:
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
I reloaded the filter rules, still the same.

Please don't wrap outputs.

Quoted 1 line

Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)

                    These-----^----------^

are only the counters of your default policy. Your traffic is...

Quoted 1 line

pkts bytes target prot opt in out source

destination

Quoted 1 line
       9     2051 ACCEPT     all  --  *      lo      0.0.0.0/0          

0.0.0.0/0

Quoted 1 line
       0        0 ACCEPT     icmp --  *      *       0.0.0.0/0          

0.0.0.0/0 icmp type 11

Quoted 1 line
       2      132 ACCEPT     icmp --  *      *       0.0.0.0/0          

0.0.0.0/0 icmp type 3 code 3

Quoted 1 line
       0        0 DROP       icmp --  *      *       0.0.0.0/0          

0.0.0.0/0 icmp type 3

Quoted 1 line
    9535  2685876 ACCEPT     all  --  *      *       0.0.0.0/0          

0.0.0.0/0 state NEW,RELATED,ESTABLISHED

     ,^^^^--^^^^^^^

... here.

Quoted 1 line
       0        0 LOG        all  --  *      *       0.0.0.0/0          
Quoted 8 lines

0.0.0.0/0 LOG flags 6 level 4 prefix `SuSE-FW-OUTPUT-ERROR '

Quoted 4 lines

[snip stuff]

How come it wont count up the Accepted packaged and Bytes?

It would, but as you -j ACCEPT everything before the default policy it can't.

I call this default policy at the beginning of my script (actually SuSEFirewalls script):

$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD 2> /dev/null
$IPTABLES -P INPUT "$DROP"
$IPTABLES -P OUTPUT "$ACCEPT"
$IPTABLES -P FORWARD "$ACCEPT" 2> /dev/null
$IPTABLES -F
$IPTABLES -X
$IPTABLES -t nat -F
$IPTABLES -t nat -X
$IPTABLES -t mangle -F
$IPTABLES -t mangle -X

so why am i "-j ACCEPT" accepting it before that?

Thanks, Mario

Signature · 2 lines
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
#3 lore raw

* Mario Ohnewald <[email protected]> 3. Mar 04:

Quoted 1 line

Hi,

Hello,

Quoted 2 lines

I call this default policy at the beginning of my script (actually SuSEFirewalls script):

It doesn't matter, when you call it. Packets traverse chains from top to bottom. The 'bottom' is the default policy. (Well, it's listed on top, but you know what I mean.)

Quoted 13 lines

$IPTABLES -F INPUT
$IPTABLES -F OUTPUT
$IPTABLES -F FORWARD 2> /dev/null
$IPTABLES -P INPUT "$DROP"
$IPTABLES -P OUTPUT "$ACCEPT"
$IPTABLES -P FORWARD "$ACCEPT" 2> /dev/null
$IPTABLES -F
$IPTABLES -X
$IPTABLES -t nat -F
$IPTABLES -t nat -X
$IPTABLES -t mangle -F
$IPTABLES -t mangle -X

Quoted 1 line

so why am i "-j ACCEPT" accepting it before that?

In these scrambled outputs I did not wanted to sort again was a match-any-rule with -j ACCEPT in your OUTPUT (it isn't set here). So never a packet reached the bottom (policy) of your OUTPUT.

Please RTFM,
regards, Frank.

Signature · 1 line
Sigmentation fault
#4 lore raw

Hi,

Quoted 6 lines
Quoted 2 lines

I call this default policy at the beginning of my script (actually SuSEFirewalls script):

It doesn't matter, when you call it. Packets traverse chains from top to bottom. The 'bottom' is the default policy. (Well, it's listed on top, but you know what I mean.)

Oh sorry, totally misunderstood that :/

Quoted 6 lines
Quoted 1 line

so why am i "-j ACCEPT" accepting it before that?

In these scrambled outputs I did not wanted to sort again was a match-any-rule with -j ACCEPT in your OUTPUT (it isn't set here). So never a packet reached the bottom (policy) of your OUTPUT.

So since i ACCEPT the packets before they reach my default policy, i need to get my traffic liek this?:
iptables -xv -L OUTPUT | grep "state NEW,RELATED,ESTABLISHED" | awk '{print $2}'

Thanks, Mario

Signature · 2 lines
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz