From: Arthur van Leeuwen <arthurvl@sci.kun.nl>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] Policy Routing Help
Date: Tue, 02 Apr 2002 08:31:08 +0000 [thread overview]
Message-ID: <marc-lartc-101773637306433@msgid-missing> (raw)
In-Reply-To: <marc-lartc-101768403719512@msgid-missing>
On Mon, 1 Apr 2002 russ@essentialmix.ca wrote:
> Hey guys, can anyone comment on this if it is possible?
>
> My setup:
>
> Linux Box Cable
> _____ E0 _____
> | |_______|___|____
> | |
> | | DSL
> | | E1 _____
> | |_______|___|____
> |___|
>
>
> Hopefully everyone can interperet my diagram. Anyhow, I have an FTP
> server running off the Linux Box. The DNS resolves to Eth0 which is the
> NIC attached to the Cable modem provider and the default route is set to
> the Cable next-hop. Eth1 is attached to My Network. What I would like to
> happen is that all incoming FTP traffic to Eth0 will always return out
> Eth0 through the Cable ISP. Any other traffic will take the DSL provider
> via a default route to the DSL next-hop
>
> I can think of 2 ways to do this:
>
> 1) Mark FTP traffic and create a rule to set the next-hop to the Cable
> default route
>
> 2) Configure policy routing such that if traffic is destined to Eth0 IP
> address, the next-hop is set to the Cable provider.
The latter is better. :)
> Because there is a default route configured on the linux box to the Cable
> ISP, all return traffic regardless of the interface it was received on
> will always take the Cable ISP. I would prefer option #2. Can anyone
> shed some light on the config necessary to do this? This is pretty quick
> and dirty with policy routing on IOS, but I am struggling a little bit on
> the linux config. Thanks all!
Very well:
One creates two additional routing tables, say E0 and E1. These are added in
/etc/iproute2/rt_tables. Then you set up routing in these tables as follows:
ip route add $CABLE_GW dev eth0 src $IP_ETH0 table E0
ip route add default via $CABLE_GW table E0
ip route add $DSL_GW dev eth1 src $IP_ETH1 table E1
ip route add default via $DSL_GW table E1
Next you set up the main routing table. It is usually a good idea to route
things to the direct neighbour through the interface connected to that
neighbour. Note the `src' arguments, they make sure the right outgoing IP
address is chosen.
ip route add $CABLE_GW dev eth0 src $IP_ETH0
ip route add $DSL_GW dev eth1 src $IP_ETH0
ip route add $CABLE_NET via $CABLE_GW
ip route add $DSL_NET via $DSL_GW
Then, your preference for default route:
ip route add default via $DSL_GW
Next, you set up the routing rules, making sure that you route out a given
interface is you already have the corresponding source address:
ip rule add from $IP_ETH0 table E0
ip rule add from $IP_ETH1 table E1
This set of commands makes sure all answers to traffic coming in on a
particular interface get answered from that interface. I set something like
this up back in 1999 for my then-current employer to deal with a 'secure'
leased line and a cable-modem, with e-mail coming in over both lines...
Doei, Arthur. (Who just now realises that ftpd's may actually still play
havoc with this: set your server to passive-only, if you
can.)
--
/\ / | arthurvl@sci.kun.nl | Work like you don't need the money
/__\ / | A friend is someone with whom | Love like you have never been hurt
/ \/__ | you can dare to be yourself | Dance like there's nobody watching
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
next prev parent reply other threads:[~2002-04-02 8:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-01 17:45 [LARTC] Policy Routing Help russ
2002-04-02 8:31 ` Arthur van Leeuwen [this message]
2002-04-03 16:40 ` Patrick McHardy
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=marc-lartc-101773637306433@msgid-missing \
--to=arthurvl@sci.kun.nl \
--cc=lartc@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 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.