Subject: Re: Routing by source address
To: Daniel Fuehrer <info@network.de>
From: Carl Brewer <carl@bl.echidna.id.au>
List: tech-net
Date: 09/05/2006 09:23:04
Daniel Fuehrer wrote:
> Hi,
> 
> within a NetBSD installation, I connect to several ISPs via PPPoE using 
> tap devices. This works fine, but there's a problem with the routing:
> 
> In order to send packets over a certain connection, the socket is being 
> bound to the correspondending IP, but that gives me a "no route to host" 
> unless I change the default gateway. However, this is no practical 
> solution since I want to use all PPPoE sessions simultanously.
> 
> Therefore, I have to tell NetBSD that it should route all packets 
> originating from the IP of ISP #1 through the gateway of ISP #1 and so 
> on (some kind of routing by source address).
> 
> There's a how-to for Linux here:
> http://www.lartc.org/howto/lartc.rpdb.multiple-links.html
> 
> I'd be really glad if someone could describe a working solution for 
> NetBSD (using pf, ipf or whatever).

AFAIK, the only way to do policy routing on NetBSD (or any of the
*BSD's?) is to use IPF or PF.

pass in quick on <default route interface> to:<alternate int>:<next hop 
IP> from <> to <>

This is poorly documented and an awful hack, but it does work.