Subject: Re: RFC: local address selection
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Tom Ivar Helbekkmo <tih@eunetnorge.no>
List: tech-net
Date: 11/15/2004 10:51:18
manu@netbsd.org (Emmanuel Dreyfus) writes:

>>       in IPv4 code, rt_ifa is used for selecting source address for a
>>       particular routing entry.  route -ifa should be sufficient.
>
> Right, it seems -ifa just does what I want. But... Why isn't this
> documented???

It is documented, in the route(8) man page.  However, it says there
that -ifp and -ifa are meant to be used when the route specification
would otherwise be ambiguous.  The effect we're trying to get here
seems not to have been originally intended.

On the other hand, I can't get it to work here.  :-(  That is, the
assignment of a source address in the routing table entry works, but
the routing entry then fails to be useful.  For instance:

# ifconfig vlan0 inet 192.168.1.1 netmask 255.255.255.0
# ifconfig vlan1 inet 192.168.2.1 netmask 255.255.255.0
# ifconfig vlan1 inet 192.168.2.2 netmask 255.255.255.0 alias
# route add default 192.168.1.2 -ifa 192.168.2.2

This will cause traffic destined for the world to be sent out properly
addressed:  At layer 2, outgoing packets are from our MAC address on
vlan0 to the MAC address of the gateway at 192.168.1.2.  The layer 3
addressing is also good, properly from 192.168.2.2 to the destination.
The problem is that the packets are sent out on vlan1.

I would conclude that -ifa must only be used to choose an address on
the correct interface for the outgoing traffic -- but then I am under
the impression that you, Emmanuel, got this to work...?

I must be misunderstanding something.  I'd appreciate a helpful clue!

I'm running -current as of October 15th on an i386 system.  The
ethernet interface underlying the VLAN trunk uses the fxp driver.

-tih
-- 
Tom Ivar Helbekkmo, Senior System Administrator, EUnet Norway Hosting
www.eunet.no  T +47-22092958 M +47-93013940 F +47-22092901 FWD 484145