Re: Multiple output routes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2004-12-15 at 04:44, O-Zone wrote:
> 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. 

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



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux