Configuring FreeBSD 9.1 with a Sonic.net IPv6 Tunnel

July 11, 2013 Brian Cunnie

Abstract

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 Sonic.net 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 Sonic.net subscriber.

Gathering Network Information

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

IPv4_Sonic

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

Next we need to find our IPv6 Address:

IPv6_Sonic

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 Sonic.net’s. The upper address, …:16c3, is your FreeBSD machine’s.

Network Information

  • my IPv4 tunnel endpoint (i.e. my static IP): 50.0.204.157
  • Sonic.net’s IPv4 tunnel endpoint: 208.201.234.221
  • my IPv6 tunnel endpoint: 2001:05a8:0000:0001:0000:0000:0000:16c3/127
  • Sonic.net’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 50.0.204.157 208.201.234.221
# 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 ipv6.google.com

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:

gif_interfaces="gif0"
ifconfig_gif0_ipv6="YES"
gifconfig_gif0="50.0.204.157 208.201.234.221"
ifconfig_gif0="inet6 2001:05a8:0000:0001:0000:0000:0000:16c3/127"
static_routes="ipv6"
route_ipv6="-net -inet6 default 2001:05a8:0000:0001:0000:0000:0000:16c2"

Acknowledgements

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

About the Author

Biography

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

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