All of lore.kernel.org
 help / color / mirror / Atom feed
* using iptables for "route mapping"
@ 2003-03-24 19:49 Mark Seamans
  2003-03-24 20:53 ` Kim Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Seamans @ 2003-03-24 19:49 UTC (permalink / raw)
  To: netfilter

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: using iptables for "route mapping"
  2003-03-24 19:49 using iptables for "route mapping" Mark Seamans
@ 2003-03-24 20:53 ` Kim Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: Kim Jensen @ 2003-03-24 20:53 UTC (permalink / raw)
  To: Mark Seamans, netfilter

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-03-24 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-24 19:49 using iptables for "route mapping" Mark Seamans
2003-03-24 20:53 ` Kim Jensen

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.