Subject: Re: default route and private networks
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Tom Ivar Helbekkmo <tih@eunetnorge.no>
List: tech-net
Date: 04/26/2005 06:56:58
"Steven M. Bellovin" <smb@cs.columbia.edu> writes:

> The current semantics, as I understand them, is that the source address 
> assigned is taken from the routing table entry used for the (initial, 
> for TCP) outgoing packet.  In particular, the first address on the 
> interface selected is used.  Suppose we try to extend that, by 
> associating explicit source addresses with routing entries.  When a
> destination address matches some particular route table entry, the 
> source address associated with that address would be used as the source 
> address for the packet.

This is already in the code, and I've just checked that it works.

# ifconfig vlan1 inet 192.168.1.10 netmask 255.255.255.0
# ifconfig vlan1 inet 192.168.1.20 netmask 255.255.255.0 alias
# route add 192.168.2.0/24 192.168.1.1 -ifa 192.168.1.20

Outbound packets not explicitly bound, but using the given route, are
addressed from 192.168.1.20.  Other packets sent out that interface
are addressed from 192.168.1.10.  "route get" shows what is stored.

-tih
-- 
Don't ascribe to stupidity what can be adequately explained by ignorance.