Subject: Re: default route and private networks
To: Tom Ivar Helbekkmo <tih@eunetnorge.no>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: tech-net
Date: 04/26/2005 01:11:06
In message <86ll76uodh.fsf@athene.hamartun.priv.no>, Tom Ivar Helbekkmo writes:
>"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.

That's almost, but not quite, what is needed here.  If you specify 
-ifa, the packet is sent out on that interface.  We want to send on 
interface A while using some address from interface B. 


		--Prof. Steven M. Bellovin, http://www.cs.columbia.edu/~smb