Skip to contentSkip to conversation

Multiple output routes

DISCUSSION O-Zone 2 participants 2 messages Dec 15, 2004

lore
Share & tools
lore

O-Zone

author
#0 lore raw

Hi all,
i want to route traffico for a specific subnet to routeA while default route for my linuxbox is routeB. Here's the diagram:

(internet)--[Router A]---+

                                    |
                                [Linux BOX]----(Subnet 10.0.0.x)
                                    |

(internet)--[Router B]---+

RouterA and RouterB have the same subnet (i.e. RouterA lan is 192.168.0.1 and RouterB has 192.168.0.2) and LinuxBox have ONLY ONE externat iface like 192.168.0.3. While i use LinuxBOX i wanna go "out" trought 192.168.0.1 but PC's MASQ'ed in Subnet 10.0.0.x must go out throug 192.168.0.2.

Can someone point me in the right direction ?

Thanks ! Oz

Signature · 2 lines
------
O-Zone ! www.zerozone.it
#1 lore raw
Quoted 8 lines · O-Zone

Hi all,
i want to route traffico for a specific subnet to routeA while default route for my linuxbox is routeB. Here's the diagram:

(internet)--[Router A]---+

                                    |
                                [Linux BOX]----(Subnet 10.0.0.x)
                                    |
Quoted 6 lines

(internet)--[Router B]---+

RouterA and RouterB have the same subnet (i.e. RouterA lan is 192.168.0.1 and RouterB has 192.168.0.2) and LinuxBox have ONLY ONE externat iface like 192.168.0.3. While i use LinuxBOX i wanna go "out" trought 192.168.0.1 but PC's MASQ'ed in Subnet 10.0.0.x must go out throug 192.168.0.2.

leave the default gateway of "Linux Box" set to RouterA--which will take care of all packets from "Linux Box" being routed out via RouterA.

setup policy routing so that packets from 10.0.0.0/24 get routed out via RouterB:

echo 200 RouterB >> /etc/iproute2/rt_tables

ip rule add fwmark 0x01 table RouterB

ip route add default via 192.168.0.2 table RouterB

ip route flush cache

  iptables -t mangle -A PREROUTING -i $insideIF -s 10.0.0.0/24 \
    -j MARK --set-mark 0x01

add filter and nat rules as necessary...

-j

--
"I'm a well-wisher, in that I don't wish you any specific harm."
--The Simpsons