routing to a directly attached subnet without an address in this subnet

Lionel Fourquaux lionel.fourquaux+freebsd-questions at normalesup.org
Sun Apr 24 21:09:52 UTC 2011


Dear FreeBSD users,

Consider an IPv6 router with two interfaces, e.g. em0 and em1.
  em0 has addresses fe80::1234:56ff:fe78:9abc and 2001:db8::1
  em1 has address fe80::1234:56ff:fe78:9abd
Network 2001:db8::/64 is directly attached to em0, and network 
2001:db8:0:1::/64 is directly attached to em1. The default 
route points to em0. I would like to route packets addressed 
to 2001:db8:0:1::/64 to interface em1, without allocating an 
address in 2001:db8:0:1::/64 for em1. (Or to understand why this 
would be impossible).

I have tried to add a route using:
  route add -ipv6 2001:db8:0:1::/64 -iface em1
(and several variations), but this fails (route returns 
successfully, but I can't ping anything on 2001:db8:0:1::/64). 
On the other hand, if I give address 2001:db8:0:1::1/64 to em1, 
ping6 works and packets are routed successfully. I guess that 
the differenceis that the OS can't figure out which interface 
to use for NDP in the first case. However, ndp(8) can create 
static entries in the NDP table for individual hosts but not 
whole subnets.

I can't see any strong reason for requiring that em1 have 
an address for every directly attached subnet packets are routed 
to. The router already has a valid routable address on em0 
which can be used as source address for ICMP, and it has an 
address on em1 (the link local one) which can be used for 
NDP and routing. So:
  1. Is there a way to set up the router the way I want it?
  2. If not, why is it not possible?

I can mark the additional addresses on em1 as deprecated, possibly 
even firewall out anything going to these addresses. From the outside, 
the router would behave exactly the way I want. However, this 
does not seem as nice as such a simple setup should be.

This is on FreeBSD 8.2 (i386), GENERIC kernel. I have slightly 
simplified the description but all the relevant parts should be here.

Anticipated thanks for your answers, and best regards.

		-- Lionel Fourquaux



More information about the freebsd-questions mailing list