Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: Counting traffic - another question
Date: Tue, 27 Jul 2004 13:59:13 +0100	[thread overview]
Message-ID: <200407271359.13020.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <1304297675.20040727143400@op.pl>

On Tuesday 27 July 2004 1:34 pm, Marcin wrote:

> Hi
>
>   I have set of rules that doing upload/download stats for my NATed network
>   (10.0.0.0/8):
>
>   # Marking
>   $IPTABLES -t mangle -A FORWARD -p tcp -j CONNMARK --restore-mark
>   $IPTABLES -t mangle -A FORWARD -p tcp -m mark ! --mark 0 -j ACCEPT
>
>   $IPTABLES -t mangle -A FORWARD -p tcp --dport $SSH_PORT -j MARK --set-mark
> $SSH

<snip...>

>   Rules above (IMO) marks specified trafic traveling through FORWARD
>   chain, and this is only traffic from localnet <-> internet, not from
>   localnet <-> linuxbox.

Correct.   FORWARD chain matches only packets which are routed *through* the 
machine, not packets going to/from the machine itself.

>   Ok, now i make chains for counting uploads/downloads from/to my lan.

Why?   You seem to have one set of rules in the FORWARD mangle table for 
MARKing packets, and then another set of rules in POSTROUTING looking for 
MARKs and counting the packets.

Why not simply count all the packets in FORWARD mangle?

For example:

iptables -A FORWARD -t mangle -i eth0 -o ppp0 -p tcp --dport ssh

Will count all packets going from eth0 to ppp0 destination ssh (TCP port 22).

No need to MARK the packets (unless you want the MARKs for something else?), 
and you can specify input & output interface in the FORWARD table to identify 
which way through your firewall the packets are going.

Regards,

Antony.

-- 
Most people have more than the average number of legs.

                                                     Please reply to the list;
                                                           please don't CC me.



  reply	other threads:[~2004-07-27 12:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-27 12:34 Counting traffic - another question Marcin
2004-07-27 12:59 ` Antony Stone [this message]
2004-07-27 13:52   ` Re[2]: " Marcin Sura
2004-07-27 13:57   ` Marcin Sura
2004-07-27 14:26     ` Antony Stone
2004-07-27 15:27       ` Re[4]: " Marcin Sura
2004-07-27 21:57       ` Marcin Sura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200407271359.13020.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox