Hetzner, FreeBSD and IPv6

So, I got this server at Hetzner and it’s running FreeBSD. Hetzner provides native IPv6 so I thought I would request a subnet and try it out. Little did I know, that it would be so tricky to get up and running.

It seems that Hetzner is doing something a bit different. I got my IPv6 /64 but the default gateway is not in my subnet. The recommendation from Hetzner is to make a static route first and then add the default gateway. In Linux that is about all it takes - on FreeBSD, you need a couple of extra steps (they don’t mention that on their wiki).

First of, this is my information from Hetzner:

IPs: 2a01:xxxx:xxxx:3183:: /64
Gateway: 2a01:xxxx:xxxx:3180::1 /59

Now as you see, the gateway is not on my subnet - and creating a static route is easy, so this is what I did in rc.conf:

ipv6_enable=”YES”
ipv6_static_routes=”defgw”
ipv6_route_defgw=”2a01:xxxx:xxxx:3180:: -prefixlen 59 -iface re0”
ipv6_defaultrouter=”2a01:xxxx:xxxx:3180::1”

I am trying to route ipv6 trafik to the subnet with my default gateway to the interface: re0 - i rebooted, but it did not work. The defgw route was there, but not the default route. In /etc/network.subr I realized that the defaultrouter is simply added to the list of static routes (as the first) before being added. The problem: You can’t add a default route to an ip not on your net. And because the default route is the first to be added, this will fail. I changed line 1057 in /etc/network.subr from:

ipv6_static_routes=”default ${ipv6_static_routes}”

to:

ipv6_static_routes=”${ipv6_static_routes} default”

I rebooted again - success! I confirmed with netstat -rn that my static route and default ipv6 gateway was there. But I still couldn’t reach my default gateway. After several days of head scratching i got a tip from Hetzner support. On FreeBSD I should use ndp to set a default ipv6 interface - on the command line I simply did:

ndp -I re0

And bingo! IPv6 up and running. Now to make this setting permanent, start by adding the following line to /etc/sysctl.conf:

net.inet6.ip6.accept_rtadv=1

Then add this line to rc.conf:

ipv6_default_interface=”re0”

Reboot and ipv6 should now be up at running at boot time :)

Btw. I haven’t added any information about setting up the ipv6 ip addresses, but they should ofcourse also be added to rc.conf like:

ipv6_ifconfig_re0=”2a01:xxxx:xxxx:3183::2”

( The default is a prefixlen of 64 that is why I haven’t added prefixlen to the above line )

  1. bitmand posted this
Short URL for this post: http://tmblr.co/ZPBpMy15foux
blog comments powered by Disqus