Freebsd – Router advertisement for ipv6 is advertising link-local adress

freebsdipv6routing

I have the following situation: I configured a FreeBSD 9.1 machine as the endpoint of a heartbeat SixXS tunnel on a gif0 interface. It works so far, and I can ping6 via IPv6.

I assigned to another interface lagg0 which is an aggregated interface a static IPv6 out of the assigned IPv6 subnet which is connected to the LAN. Now I would like to advertise this network prefix to my LAN using the rtadvd deamon.

This is its /etc/rtadvd.conf file:

lagg0:\
     :addr="xxxx:yyyy:zzzz:aaaa::":prefixlen#64:tc=ether:

with xxxx:yyyy:zzzz:aaaa::/64 being the network prefix. When I now add clients to the network, they take the network prefix and generate their autoconf and temporary adresses. That works great.

However what they are missing is the correct IPv6 default route. In the routing table the default route for IPv6 is the fe80:: link-local adress of the router.

Now no packets are routed to the internet. If I add the default route manually to the host it works.

My questions

I thought that the router advertisement should configure the right default route on the clients. Am I missing something here? Why does it advertise its link-local adress instead of the right one?

Best Answer

The link local address should work just fine, and is indeed the address used by rtadvd.

I'm using 6to4, but it's essentially the same configuration. In my case all I do is:

ifconfig stf0 create
ifconfig stf0 inet6 2002:c0a8:1:ffff::1/16
ifconfig lan0 inet6 2002:c0a8:1::1/64

This just creates the connection, your tunnel should sever the same purpose.

route add -inet6 default 2002:c058:6301::

At this point ping6 ipv6.google.com works from my router.

sysctl net.inet6.ip6.forwarding=1

Now routing is enabled, even with link local addresses, if I manually configure clients to use the router as their DG IPv6 works. But we want some level of auto-configuration... so /etc/rtadvd.conf contains:

lan0:\
    :addr="2002:c0a8:1::":prefixlen=64:tc=ether:

The only thing left is to add the configuration to my rc.conf file:

ipv6_gateway_enable="YES"               # Route IPv6 Traffic
rtadvd_enable="YES"                     # IPv6 Router Advertisement Daemon
rtadvd_interfaces="lan0"

cloned_interfaces="stf0"
ifconfig_stf0_ipv6="inet6 2002:c0a8:1:ffff::1/16"

ipv6_defaultrouter="2002:c058:6301::"   # 6to4 Default Router

The clients do have a default route of the fec0:: range, but it works perfectly. A tcpdump shows the clients sending from their global IPv6 address to the fec0 address.

For anyone reading this wanting to do 6to4 the above "internal" addresses are for 192.168.0.1, which isn't routable on the Internet. You need to calculate your own internal IPv6 address based on your external IPv4 address.