Configuring FreeBSD 9.1 with a IPv6 Tunnel

July 11, 2013 Brian Cunnie


IPv6 (the next generation of TCP/IP) is becoming more widely available: Networking providers such as Comcast are beginning to offer native IPv6 to its subscribers, other providers such as offer IPv6 tunnels, and IPv6 Tunnel Brokers such as Hurricane Electric offer free IPv6 tunnels (no subscription necessary).

This blog post describes setting up an IPv6 tunnel under FreeBSD 9.1 as a subscriber.

Gathering Network Information

You can extract your IPv4 and IPv6 addresses and routes from the website (you will need to be a subscriber). First, let’s find our IPv4 address (this should be an address of one of your FreeBSD machine’s interfaces):


A note about’s IPv4 tunnel endpoint. It appears that every IPv6 tunnel uses the same IPv4 address for the far-end tunnel endpoint:

Next we need to find our IPv6 Address:


A note about the IPv6 address: this is actually a subnet, not an address. In IPv6, a /127 subnet is a subnet consisting of 2 IP addresses which correspond to the tunnel endpoints. The lower address, …:16c2, is’s. The upper address, …:16c3, is your FreeBSD machine’s.

Network Information

  • my IPv4 tunnel endpoint (i.e. my static IP):
  •’s IPv4 tunnel endpoint:
  • my IPv6 tunnel endpoint: 2001:05a8:0000:0001:0000:0000:0000:16c3/127
  •’s IPv6 Tunnel Endpoint: 2001:05a8:0000:0001:0000:0000:0000:16c2

Setting up & Testing

sudo ifconfig gif0 create
# tunnel:  my IP, their IP:
sudo ifconfig gif0 tunnel
# my IPv6
sudo ifconfig gif0 inet6 2001:05a8:0000:0001:0000:0000:0000:16c3/127
# default route is THEIR IPv6:
sudo route add -net -inet6 default 2001:05a8:0000:0001:0000:0000:0000:16c2
# Let's test:
ping6 -c 4

Making Persistent

You’ll want the IPv6 tunnel to persist across reboots, so you’ll need to make the following changes to /etc/rc.conf:

ifconfig_gif0="inet6 2001:05a8:0000:0001:0000:0000:0000:16c3/127"
route_ipv6="-net -inet6 default 2001:05a8:0000:0001:0000:0000:0000:16c2"


Eric Allman’s post. Hurricane Electric’s instructions.

About the Author


Define your product with this simple exercise
Define your product with this simple exercise

Whether you’re a lean startup or a mature business, having a clearly articulated product vision, which incl...

Pivotal Speaks on Scaling Mobile Infrastructure
Pivotal Speaks on Scaling Mobile Infrastructure

Pivotal is speaking twice this month at Mobile conferences. Yesterday, Pivotal COO Edward Hieatt spoke on a...

SpringOne 2021

Register Now