Subject: Re: connection comes in fxp0 but response goes out fxp1 help?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: None <sudog@sudog.com>
List: tech-net
Date: 08/12/2001 16:18:09
First off, YES, I'm definitely interested. Please feel free to email
an attachment to me at your convenience.

Second, it looks like Paul Vixie had some multiple default route
patches so that this sort of behaviour can be automatic.

Third: Can I humbly ask for an official opinion as to why this sort of
option/functionality hasn't made it into the kernel? Logically,
intuitively, if traffic is coming in to IP 10.0.x.x, why would it make
sense to send traffic back out the 64.x.x.x interface with a source of
10.0.x.x? And why shouldn't two default routes be allowed--perhaps a
route switch?

There was some discussion of the matter previous. Here are references:

http://mail-index.netbsd.org/tech-kern/1999/02/
(search for '"default" outgoing address')

http://mail-index.netbsd.org/current-users/2001/02/
(search for 'Multiple defaultroutes')

Thanks core et al.

Marc Tooley

> Stock, you can't - at least last I knew, and I doubt this has changed.
> Traffic always leaves via the interface implied by the route to the
> peer address.
>
> I did write a pseudo-interface which lets you do routing based on the
> source address.  In this case, if I assume you have
>
> -----+----------------+-----------  10.0.0.0/8
>      | 10.0.0.1       | 10.0.1.2
> +----------+    +----fxp0---+          +----------+
> | Router 1 |    | Webserver |          | Router 2 |
> +----------+    +----fxp1---+          +----------+
>                       | 12.34.56.78         | 12.34.56.1
>                -------+---------------------+----------- 12.34.56.0/24
>
> then you might set it up thus:
>
> srtconfig srt0 set 0 10.0.0.0 /8 fxp0 10.0.0.1
> srtconfig srt0 set 1 12.34.56.0 /24 fxp1 12.34.56.1
> ifconfig srt0 192.168.0.1 192.168.0.2 up
> route add default 192.168.0.2
>
> Then, off-LAN outgoing traffic will be routed to srt0, which will look
> at the source address in the outgoing packet:
> 	if it's in 10.0.0.0/8, next hop is 10.0.1.1 via fxp0
> 	if it's in 12.34.56.0/24, next hop is 12.34.56.1 via fxp1
> 	otherwise, drop the packet
>
> The reason for giving srt0 an address and routing via it is that this
> logic applies only to packets transmitted on the srt interface.  So we
> have to get the traffic we care about sent out srt0.
>
> It's for 1.4T, but the interfaces it depends on have been pretty stable
> for a while, so it probably would require little to no work to port
> forward to -current or backward to 1.4.x; I didn't see any mention of
> what version you're using.
>
> As always, I'll be happy to send a copy to whoever wants it.
>
> /~\ The ASCII				der Mouse
> \ / Ribbon Campaign
>  X  Against HTML	       mouse@rodents.montreal.qc.ca
> / \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
>