All of lore.kernel.org
 help / color / mirror / Atom feed
From: <linux@davidtrott.com>
To: netfilter@lists.netfilter.org
Subject: Question about nth matching
Date: Thu, 15 May 2003 10:34:23 -0700	[thread overview]
Message-ID: <1053020063.3ec3cf9f493f6@www.mailshell.com> (raw)

Hi,

I am using the nth patch to perform load balancing for outgoing traffic, specifically these are packets that are generated on the firewall itself (not forwarded traffic).

In order to do this I have used ip route 2 to set up two different routing tables, then I use netfilter to set the MARK so that alternate packets are sent to alternate links.

In order to do this I use the following rules:

iptables -t mangle -A OUTPUT -d 10.1.1.1 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -d 10.1.1.1 -m nth --every 2 -j MARK --set mark 2

Using the above rules everything appears to be fine, however this style can get messy if you have more than two links so I tried to use the following style:


iptables -t mangle -A OUTPUT -d 10.1.1.1 -m nth --every 2 --packet 0 -j MARK --set-mark 1
iptables -t mangle -A OUTPUT -d 10.1.1.1 -m nth --every 2 --packet 1 -j MARK --set-mark 2

This does not work (it appears that neither mark is set - although I am not certain of this).

Can anyone point me in the right direction in order to get the second case working?

TIA,
David

Notes:
Kernel 2.4.20
Iptables 1.2.7a

Both the kernel and iptables have had a few patches applied although I don’t think this is the cause of the problem.

I have read that sending alternate packets over different links is not always a good idea because it can lead to packets arriving at the destination host in the wrong order. I have been told that this is not a problem for Linux, but some other OS don’t like it, so I have restricted the balancing rules to a host that I know runs Linux.
This is the reason for the –d 10.1.1.1 (on my firewall 10.1.1.1 is replaced with the real IP).


             reply	other threads:[~2003-05-15 17:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-15 17:34 linux [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-05-16  2:11 Question about Nth matching David Trott

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=1053020063.3ec3cf9f493f6@www.mailshell.com \
    --to=linux@davidtrott.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.