netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: dwmw2@infradead.org, netdev@vger.kernel.org
Subject: Re: Routing over multiple interfaces
Date: Tue, 02 Nov 2010 23:56:32 +0100	[thread overview]
Message-ID: <4CD09720.8030403@plouf.fr.eu.org> (raw)
In-Reply-To: <1288728267.2467.4.camel@edumazet-laptop>

Eric Dumazet a écrit :
> Le mardi 02 novembre 2010 à 20:46 +0100, Pascal Hambourg a écrit :
> 
>> What about using iptables + routing rules ?
>> Mark every other packet going through the default PPP link with
>> iptables, and reroute marked packets through the other PPP link.
> 
> OK. I provided a working setup, maybe you also could provide one based
> on iptables as well ?

Arnd Hannemann provided something quite close to what I was thinking
about. I would just make a few adjustments. I added a rule for locally
generated traffic if needed. Also, using the PPP peer as gateway could
be troublesome if both links have the same peer address, so I used the
device instead.

iptables -t mangle -N mark6
iptables -t mangle -A mark6 -m statistic --mode nth --every 2 -j MARK
--set-mark 6

# forwarded traffic, $LANDEV is the interface connected to the LAN
iptables -t mangle -A PREROUTING -i $LANDEV -j mark6
# locally generated traffic to the PPP link
iptables -t mangle -A OUTPUT -o ppp0 -j mark6

ip rule add fwmark 6 table ppp1
ip route replace default dev ppp0
ip route replace default dev ppp1 table ppp1

It still needs some refinements such as excluding non-external
destinations from the PREROUTING rule. Your setup seems much simpler and
efficient.

  reply	other threads:[~2010-11-02 22:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 21:12 Routing over multiple interfaces David Woodhouse
2010-11-01 21:16 ` David Miller
2010-11-01 21:35   ` Eric Dumazet
2010-11-01 22:15     ` David Woodhouse
2010-11-02 19:46     ` Pascal Hambourg
2010-11-02 20:04       ` Eric Dumazet
2010-11-02 22:56         ` Pascal Hambourg [this message]
2010-11-10 14:50     ` David Woodhouse
2010-11-10 15:08       ` Eric Dumazet
2010-11-10 15:51         ` David Woodhouse
2010-11-02 18:47   ` Bandan Das
2010-11-02 22:10   ` Arnd Hannemann
2010-11-04 12:51     ` Patrick Schaaf
2010-11-04 14:01       ` Eric Dumazet
2010-11-01 21:21 ` Benjamin LaHaise

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=4CD09720.8030403@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --cc=dwmw2@infradead.org \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).