[LARTC] 2 Gateways

Damion de Soto damion@snapgear.com
Fri, 28 May 2004 09:57:25 +1000


Mihai,
> But... there is a problem... I have to make the packet (after it has been
> SNAT-ed)
> follow the gateway corresponding to the $INET_IP_1 or to the $INET_IP_2
> respectively.
> 
> In my routing table I have only one default route... corresponding to one of
> the gateways.
> Is it possible to have 2 default routes? Is there a more elegant way to
> solve this problem?
you basically want to use the 'ip route' command, and setup 2 routing tables.

> Is there a way to tell the routing table that every request that has the
> source address $INET_IP_1
> follow the $GW_1, and every request that has the source address $INET_IP_2
> follow the $GW_2?
yup, you setup the two tables, one has GW_1 and one has GW_2, and direct traffic into 
the tables based on it's address.
take a look through the mailling list archives and doco on the web for examples.
it's not too hard.

regards,

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Damion de Soto - Software Engineer  email:     damion@snapgear.com
SnapGear - A CyberGuard Company ---    ph:         +61 7 3435 2809
  | Custom Embedded Solutions          fax:         +61 7 3891 3630
  | and Security Appliances            web: http://www.snapgear.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ---  Free Embedded Linux Distro at   http://www.snapgear.org  ---