From: Kim Jensen <kimj@dawn.dk>
To: Mark Seamans <marks@crvinc.com>, netfilter@lists.netfilter.org
Subject: Re: using iptables for "route mapping"
Date: Mon, 24 Mar 2003 21:53:17 +0100 [thread overview]
Message-ID: <200303242153.17159.kimj@dawn.dk> (raw)
In-Reply-To: <200303241349.41852.marks@crvinc.com>
Hi Mark,
Using the following lines it is possible to copy the default routing table
into a second. With the fwmark rule you can trigger the routing table from
iptables.
$ ip route flush table 4 > /dev/null 2>&1
$ ip route show table main | grep -Ev '^default' \
| while read ROUTE ; do
ip route add table 4 $ROUTE
done
$ ip rule add fwmark 4 table 4
$ ip route add default via xxx.xxx.xxx.xxx table 4
Iptables part
$ iptables -t mangle -A PREROUTING -s aaa.bbb.ccc.ddd -j MARK --set-mark 4
If your source is matching the rule, it will be send via the alternative
route, otherwise it will go via your normal route. Feel free to add more
hosts.
In case you wish to use loadsharing, then you have to use a different
approach. Read more about this at:
http://linux-ip.net/html/adv-multi-internet.html
http://www.ssi.bg/~ja/nano.txt
My problem here is that I still haven't heard about a solution where you have
a mixture of MASQUERAD'ing and NAT'ing.
At least I hope this will help you.
Regards
Kim
On Monday 24 March 2003 20:49, Mark Seamans wrote:
> Has anyone used iptables (realm support) to act like Cisco's route mapping?
> IE: Using it as a core ISP router with multiple uplinks. Route source ip
> A to gateway X, while routing source ip B to gateway Y.
>
> I have played around with iproute2's tables and rules with no success.
>
> Mark
prev parent reply other threads:[~2003-03-24 20:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-24 19:49 using iptables for "route mapping" Mark Seamans
2003-03-24 20:53 ` Kim Jensen [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=200303242153.17159.kimj@dawn.dk \
--to=kimj@dawn.dk \
--cc=marks@crvinc.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.