Ivan Tomica

Configuring IPv6 on FreeBSD on Hetzner

This article will be one of the few to come in the near future. I’m in the process of switching my VPS servers from various VPS providers to dedicate box I’ve leased at Hetzner.

Up until now I’ve mostly used CentOS on my server systems but it is time to switch to FreeBSD now, various reasons but that’s a topic for another article.

I figured out how to better start “mini series” than with basics, that is, with network configuration. Since I strongly believe we need to move to IPv6 at some point I always take additional time to configure all of my services to be available on IPv6 network. So without further ado, this is how to configure IPv6 on your FreeBSD box at Hetzner.

First step is to find out network details assigned to your server. You can do that via Hetzner Robot panel. Information should be available in “Main functions” > “Servers” > YOURSERVER > “IPs”. Just hover your mouse over IPv6 address that’s assigned to your server, like:

From there you can see your IPv6 address, netmask, prefix length, and default gateway. To configure address on your server add following to your /etc/rc.conf:

# IPv6 configuration
ifconfig_em0_ipv6="inet6 2a01:4f8:140:54c7::1 prefixlen 64"

Additional IPv6 addresses to the same NIC are added with:

ifconfig_em0_alias0_ipv6="inet6 2a01:4f8:140:54c7::2 prefixlen 64"
ifconfig_em0_alias1_ipv6="inet6 2a01:4f8:140:54c7::3 prefixlen 64"

You get the point. You should of course change em0 with name of your network interface name you have listed in ifconfig -a output. Realtek cards are generally called “re#”.

After you have changed your /etc/rc.conf you need to restart network and routing with:

service netif restart && service routing restart

You should now have IPv6 configured on your server. To verify everything is working as expected try to ping some of the configured IPv6 addresses from your other IPv6 capable host:

# ping6 2a01:4f8:140:54c7::5
PING 2a01:4f8:140:54c7::5(2a01:4f8:140:54c7::5) 56 data bytes
64 bytes from 2a01:4f8:140:54c7::5: icmp_seq=1 ttl=58 time=0.638 ms
64 bytes from 2a01:4f8:140:54c7::5: icmp_seq=2 ttl=58 time=0.973 ms
64 bytes from 2a01:4f8:140:54c7::5: icmp_seq=3 ttl=58 time=0.590 ms
64 bytes from 2a01:4f8:140:54c7::5: icmp_seq=4 ttl=58 time=0.585 ms
--- 2a01:4f8:140:54c7::5 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.585/0.696/0.973/0.163 ms
Tagged in:
Sysadmin on the everlasting journey of learning. Always in search for an opportunity to prove myself and to learn something new. My addiction is learning and my main goal is to excel in every aspect of Linux/Unix system administration.


Leave a Reply

Your email address will not be published. Required fields are marked *