Re: help with routing determined by source address

Linux Advanced Routing and Traffic Control

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

 



Hi Vincent!

> > I want to route packets where the gateway is determined by the source
> > address and not the destination address - is this possible with iproute2?
> > 
> Yes.
> # When sraddr belongs to ISPA
> ip rule add prio $PRIO_ISPA from $ISPA_NET lookup $ISPA_TABLE
> # When sraddr belongs to ISPB
> ip rule add prio $PRIO_ISPB from $ISPB_NET lookup $ISPB_TABLE
> # Everything else
> ip rule add prio $PRIO_DEFAULT lookup $DEFAULT_TABLE
>
> # Default route through ISPA
> ip route add table $ISPA_TABLE default via $ISPA_GW dev $ISPA_DEV
> # Default route through ISPB
> ip route add table $ISPB_TABLE default via $ISPB_GW dev $ISPB_DEV
> 
> #For everything else, use a multipath route;
> ip route add table $DEFAULT_TABLE nexthop via $ISPA_GW dev $ISPA_DEV
> nexthop via $ISPB_GW dev $ISPB_DEV

Thanks, this makes sense. I just don't understand the multipath route? Also,
I take it the _TABLE variables can be arbitrary [unique] ids right? And if I
want to have ISPB as the exception to the rule, I'll set ISPA's priority the
highest?

> > for example:
> > 
> >  ISP-A   ISP-B
> >   |        |
> > +---------------+
> > | linux machine +
> > +---------------+
> > 
> > default gw is ISP-A interface, but if packet comes via ISP-B, the ISP-B
> > interface should be used instead of ISP-A interface
> 
> IPs used on the linux machines, are private or public IPs ?

public ips

-- 

Regards
 Abraham

BEWARE!  People acting under the influence of human nature.

___________________________________________________
 Abraham vd Merwe [ZR1BBQ] - Frogfoot Networks
 P.O. Box 3472, Matieland, Stellenbosch, 7602
 Cell: +27 82 565 4451 Http: http://www.frogfoot.net
 Email: abz@frogfoot.net

Attachment: pgp00046.pgp
Description: PGP signature


[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux