FreeBSD network configuration on Hetzner servers

Update: article updated 20.3.2013

My current dedicated server provider in Europe is the german company Hetzner. They support FreeBSD but use a non-standard network configuration. It is not very well documented how to properly configure network settings on FreeBSD to have a fully functional IPv4 and IPv6 network. In this article I am giving an example how to configure it properly just with the /etc/rc.conf file.
The networking part of the /etc/rc.conf file adjusted for dedicated Hetzner servers is located below and is reported to work on EX4 and EX6 servers. You have to replace the network card (e.g. ifconfig_re0 with ifconfig_em0 and gateway_if=”re0″ with gateway_if=”em0″), IPv4 and IPv6 addresses and aliases, gateway IPv4 and IPv6 addresses and the gateway MAC address with your own values. For full IPv6 functionality the file /etc/rc.d/static_ndp_pairs is required, this file is shipped with FreeBSD 8.3 or 9.0 and higher.

You can check the IP address of your gateway from the rescue system with the following command:

route -n get | grep gateway:

Then you can check the MAC adress of the discovered gateway IP address:

arp 176.9.X.X

Networking part of /etc/rc.conf (example):

# IP address configuration
# IPv4 primary address
ifconfig_re0="inet 176.9.X.100/32"
# IPv6 primary address (if applicable)

# IP alias configuration
# IPv4 alias examples
#ifconfig_re0_alias0="inet 176.9.X.100/32"
#ifconfig_re0_alias1="inet 176.9.X.101/32"
# IPv6 alias examples
#ifconfig_re0_alias2="inet6 2a01:4f8:150:X::3/64"
#ifconfig_re0_alias3="inet6 2a01:4f8:150:X::4/64"

# Routing configuration (Hetzner)
# Network interface to reach your gateway
# Gateway MAC address (required for static ARP or IPv6)
# Gateway IPv4 address
# Routing magic (do not edit)
static_routes="gateway default"
route_gateway="-host $gateway_ip4 -interface $gateway_if"
route_default="default $gateway_ip4"
# Static ARP should not be necessary
#static_arp_gateway="$gateway_ip4 $gateway_mac pub"
# If using IPv6, uncomment lines below 
#static_ndp_gateway="$gateway_ip6 $gateway_mac"

NOTICE: The configuration above is an example configuration and may not work on your dedicated server.

Hetzner copmany homepage
Hetzner wiki

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>