Hetzner ipv6

From TykWiki
Jump to navigationJump to search

With Hetzner IPv6 you get a default gateway that is outside your own subnet. This can be rather frustrating to configure with FreeBSD, so I just use the link-local address of the router instead of using the gateway that Hetzner provides me with.

Finding the routers link-local fe80:: IP address

IPv6 has a bunch of Well-known IPv6 multicast addresses where one of them is ff02::2. I can use this on any network to see if any routers are present on the network. To find the IP of my IPv6 default gateway on the Hetzner network my server is on:

$ ping6 ff02::2%em0
PING6(56=40+8+8 bytes) fe80::ea40:f2ff:fe09:be0%em0 --> ff02::2%em0
16 bytes from fe80::7afe:3dff:fe46:ec8f%em0, icmp_seq=0 hlim=64 time=3.470 ms
16 bytes from fe80::7afe:3dff:fe46:ec8f%em0, icmp_seq=1 hlim=64 time=1.033 ms
^C
--- ff02::2%em0 ping6 statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.033/2.252/3.470/1.218 ms

$ 

This means I can add the line ipv6_defaultrouter="fe80::7afe:3dff:fe46:ec8f%em0" to /etc/rc.conf and IPv6 works.

Note that you need to append %em0 or whatever your interface is called, otherwise ping6 doesn't know which interface to use.

Note: Is seems that Hetzner has decided (finally) to add fe80::1 to all their routers, so the ipv6 gateway is fe80::1%interface no matter which datacenter you are in. This has the added advantage that the gateway IP doesn't change if they change the hardware (a normal link-local fe80:: IP is constructed from the mac-address of the interface).

In the datacenters where they already made this change, pinging ff02::2%interface looks like this:

[tykling@haze ~]$ ping6 ff02::2%re0
PING6(56=40+8+8 bytes) fe80::4261:86ff:fee9:d063%re0 --> ff02::2%re0
16 bytes from fe80::1%re0, icmp_seq=0 hlim=64 time=2.383 ms
16 bytes from fe80::1%re0, icmp_seq=1 hlim=64 time=1.072 ms
^C
--- ff02::2%re0 ping6 statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 1.072/1.728/2.383/0.656 ms

[tykling@haze ~]$

Thanks to Hetzner for realizing that their IPv6 network setup was causing problems for customers, and taking appropriate steps to rectify the situation.