Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jack Bates <uo4zau@nottheoilrig.com>
To: Eliezer Croitoru <eliezer@ngtech.co.il>
Cc: giles@coochey.net, Steven Kath <steven@vyatta.com>,
	netfilter@vger.kernel.org
Subject: Re: Mark traffic on one machine, match on another machine?
Date: Mon, 03 Dec 2012 06:32:47 -0800	[thread overview]
Message-ID: <50BCB80F.4090208@nottheoilrig.com> (raw)
In-Reply-To: <50BC9297.3050507@ngtech.co.il>

Thanks a lot for your help, how can I evaluate --restore-mark before I 
classify and shape response traffic from the origin server?

I think you mean something like:

   # Copy ctmart to nfmark (e.g. 1, 2)
   iptables -A PREROUTING -t mangle -i eth0.2 -j CONNMARK --restore-mark

   # Classify by nfmark (e.g. 1, 2), send unmarked traffic to class 2:2
   tc filter add dev eth0.2 parent ffff: protocol ip handle 1 fw flowid 
2:1 action mirred egress redirect dev ifb0
   tc filter add dev eth0.2 parent ffff: protocol ip handle 2 fw flowid 
2:3 action mirred egress redirect dev ifb0
   tc filter add dev eth0.2 parent ffff: protocol ip u32 match u32 0 0 
flowid 2:2 action mirred egress redirect dev ifb0

Just how can I get --restore-mark to evaluate before tc filter?

Another way I can imagine is with the CLASSIFY target:

   # Send unmarked traffic to class 2:2
   iptables -A PREROUTING -t mangle -i eth0.2 -m connmark --mark 1 -j 
CLASSIFY 2:1
   iptables -A PREROUTING -t mangle -i eth0.2 -m connmark --mark 2 -j 
CLASSIFY 2:3
   iptables -A PREROUTING -t mangle -i eth0.2 -j CLASSIFY 2:2

But I have the same challenge, how can I evaluate the CLASSIFY target 
before I shape traffic?

Or is there another way to classify and shape response traffic from the 
origin server based on the TOS/DSCP field of the request?

On 03/12/12 03:52 AM, Eliezer Croitoru wrote:
> You use iptables mark + restore mark based on connection tracking.
> you can mark the TOS on the outgoing postrouting table.
> you can take a look at the iptabes man pages:
> http://ipset.netfilter.org/iptables.man.html
> which has --restore-mark  exaple.
>
> Eliezer
>
> On 12/3/2012 10:43 AM, Jack Bates wrote:
>> I can imagine a couple ways of classifying traffic from our proxy server
>> based on the TOS/DSCP field, and also how to set the connection mark
>> based on this field. But how do I classify and shape response traffic
>> from the origin server based on the connection mark?

  reply	other threads:[~2012-12-03 14:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-28  5:09 Mark traffic on one machine, match on another machine? Jack Bates
2012-11-28  5:25 ` Steven Kath
2012-11-28 12:54   ` Giles Coochey
2012-11-30  5:41     ` Jack Bates
2012-11-30  6:27       ` Eliezer Croitoru
2012-12-03  8:43         ` Jack Bates
2012-12-03 11:52           ` Eliezer Croitoru
2012-12-03 14:32             ` Jack Bates [this message]
2012-12-05  2:39               ` Anatoly Muliarski
2012-12-05  9:12                 ` Eliezer Croitoru
2012-12-05 14:17                   ` Jack Bates
2012-12-06  4:18                     ` Anatoly Muliarski
2012-12-10 16:18                       ` Jack Bates
2012-12-10 20:11                         ` Anatoly Muliarski
2012-12-12 15:25                           ` Jack Bates
2012-12-13  5:06                             ` Anatoly Muliarski
2012-12-13  5:45                             ` Andrew Collins
2012-12-13 20:59                               ` Anatoly Muliarski
2012-12-13 22:06                                 ` Andrew Collins
2012-12-14  5:17                                   ` Anatoly Muliarski
2012-12-08 20:58 ` Jan Engelhardt

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=50BCB80F.4090208@nottheoilrig.com \
    --to=uo4zau@nottheoilrig.com \
    --cc=eliezer@ngtech.co.il \
    --cc=giles@coochey.net \
    --cc=netfilter@vger.kernel.org \
    --cc=steven@vyatta.com \
    /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