Linux Advanced Routing and Traffic Control list
 help / color / mirror / Atom feed
From: Andy Furniss <andy.furniss@dsl.pipex.com>
To: Patrick McHardy <kaber@trash.net>
Cc: LARTC@mailman.ds9a.nl, netfilter-devel@lists.netfilter.org
Subject: Re: [LARTC] How to balance OUTBOUND traffic by packet if..
Date: Fri, 14 Jan 2005 15:10:02 +0000	[thread overview]
Message-ID: <41E7E0CA.5090509@dsl.pipex.com> (raw)
In-Reply-To: <41E72982.5000205@trash.net>

Patrick McHardy wrote:
> Andy Furniss wrote:
> 
>> Seems still broken.
>>
>> I built vanilla(apart from nth) 2.6.10, new iptables 1.2.11 + 
>> pom-200400621 with runme extra only said y to nth.
>>
>> I see -
>>
>> Chain OUTPUT (policy ACCEPT 817 packets, 103K bytes)
>>  pkts bytes target     prot opt in     out     source destination
>>    15  1260 MARK       all  --  *      eth0    0.0.0.0/0 
>> 0.0.0.0/0           every 2th packet #0 MARK set 0x1
>>    15  1260 MARK       all  --  *      eth0    0.0.0.0/0 
>> 0.0.0.0/0           every 2th packet #1 MARK set 0x2
>>
>> Chain POSTROUTING (policy ACCEPT 817 packets, 103K bytes)
>>  pkts bytes target     prot opt in     out     source destination
>>     0     0            all  --  *      eth0    0.0.0.0/0 
>> 0.0.0.0/0           MARK match 0x1
>>    15  1260            all  --  *      eth0    0.0.0.0/0 
>> 0.0.0.0/0           MARK match 0x2
>> [root@amd /home/andy]# cat ./nth-test
>> iptables -t mangle -A OUTPUT -o eth0 -m nth --counter 1 --every 2 
>> --packet 0 -j MARK --set-mark 1
>> iptables -t mangle -A OUTPUT -o eth0 -m nth --counter 1 --every 2 
>> --packet 1 -j MARK --set-mark 2
>> iptables -t mangle -A POSTROUTING -o eth0 -m mark --mark 1
>> iptables -t mangle -A POSTROUTING -o eth0 -m mark --mark 2
>>
>> Any Ideas anyone?
> 
> 
> 
> Try adding "-m mark --mark X -j RETURN" rules after the MARK rules. The 
> MARK
> target is non-terminal, so you are overwriting the mark in the second rule.
> Alternatively you can use "--start 1" in the one of the nth matches.

Thanks Patrick - I assumed that with the same counter and packet 0/1 
that nth would only actually match alternate packets (start didn't work).

So this works -

iptables -t mangle -A OUTPUT -o eth0 -m nth --counter 1 --every 2 
--packet 0 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -o eth0 -m mark --mark 1 -j RETURN
iptables -t mangle -A OUTPUT -o eth0 -m nth --counter 1 --every 2 
--packet 1 -j MARK --set-mark 2
iptables -t mangle -A OUTPUT -o eth0 -m mark --mark 2 -j RETURN

but is over complicated really - Why I didn't do it like below in the 
first place I don't know <slaps self>

iptables -t mangle -A OUTPUT -o eth0 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -o eth0 -m nth --every 2  -j MARK --set-mark 2

Andy.

PS had to remove junk@maild.mine.nu from CC as my ISP server threw a 
domain not found - can someone else CC him please.



_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

      reply	other threads:[~2005-01-14 15:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-07 14:40 [LARTC] How to balance OUTBOUND traffic by packet if junk
2005-01-08 12:02 ` Andy Furniss
2005-01-11  0:28 ` junk
2005-01-11  2:31 ` gypsy
2005-01-11 10:02 ` junk
2005-01-12 11:10 ` Andy Furniss
2005-01-12 11:36 ` Andy Furniss
2005-01-13  3:21 ` Andy Furniss
2005-01-13 12:27   ` Andy Furniss
2005-01-14  2:08     ` Patrick McHardy
2005-01-14 15:10       ` Andy Furniss [this message]

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=41E7E0CA.5090509@dsl.pipex.com \
    --to=andy.furniss@dsl.pipex.com \
    --cc=LARTC@mailman.ds9a.nl \
    --cc=kaber@trash.net \
    --cc=netfilter-devel@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