Hetzner ipv6

From TykWiki
Revision as of 18:00, 23 July 2012 by Tykling (talk | contribs)
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.

Using the routers fe80:: address

$ 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.

Using static NDP (not recommended)

This is for rc.conf:

### v6 extra config due to weird v6 setup at hetzner
ipv6_static_routes="gw"
ipv6_route_gw="2a01:4f8:141:52a0::1 -iface re0"
static_ndp_pairs="gw"
static_ndp_gw="2a01:4f8:141:52a0::1 0:26:88:75:e7:95"
v6_network_extra_enable="YES"

Replace my values with your ipv6 default gateway's IP and mac address.

You also need two rc.d scripts: /etc/rc.d/static_ndp (included in base from FreeBSD 9, if you need it find it here). The other script, /usr/local/etc/rc.d/v6_network_extra is not included in FreeBSD (yet), it looks like this:

#!/bin/sh
#
# ipv6 tunnels and default router
#
 
# PROVIDE: v6_network_extra
# REQUIRE: NETWORKING static_ndp
# KEYWORD: nojail

. /etc/rc.subr

name="v6_network_extra"
start_cmd="v6_network_extra_start"

v6_network_extra_start()
{       
        /sbin/route -n add -inet6 default 2a01:4f8:141:52a0::1
        /etc/rc.d/static_ndp restart
}
 
load_rc_config $name
run_rc_command "$1"

Remember to change your default gateway in this script, and remember to chmod +x the script.