OpenBSD Journal

IPv6: 6rd with OpenBSD

Contributed by weerd on from the 1st-2nd-3rd-4rd-5rd-6rd-version-of-IP dept.

Reader David Hill wrote in with an article explaining how to set up 6rd tunneling in OpenBSD:

There are many websites claiming OpenBSD doesn't support 6rd. There are also user-space 6rd implementations that do not work on OpenBSD.
Well, 6rd works just fine with OpenBSD if you do it manually.

My ISP is Charter Communcations. As they slowly roll IPv6 out, they have offered IPv6 connectivity via their 6rd Border Relay.

Their settings are as follows:

6rd Prefix = 2602:100::/32
Border Relay Address = 68.114.165.1
6rd prefix length = 32
IPv4 mask length = 0

So I wrote a quick perl script (excuse the code) to generate a hostname.gif0:

#!/usr/bin/perl

sub convert
{
        my $ip = @_[0];
        my ($a, $b, $c, $d) = (split(/\./, $ip));
        $out = sprintf("%x%x%x%x:%x%x%x%x",
                $a / 16, $a % 16,
                $b / 16, $b % 16,
                $c / 16, $c % 16,
                $d / 16, $d % 16);
        return $out;
}

my ($prefix, $bip, $ip);
print "Enter IPv6 6rd Prefix (2602:100:): ";
chomp($prefix = <STDIN>);
print "Enter IPv4 Border Relay address: ";
chomp($bip = <STDIN>);
print "Enter your public IP: ";
chomp($ip = <STDIN>);

$dest = convert($bip);
$src = convert($ip);

print   "\n\nmtu 1480\n",
        "tunnel ", $ip, " ", $bip, "\n",
        "inet6 alias ", $prefix, $src, "::1 128\n",
        "dest ", $prefix, $dest, "::1\n",
        "!/sbin/route -qn add -inet6 default ", $prefix, $dest, "::1\n";

If I run it with my settings:

$ perl 6rd.pl
Enter IPv6 6rd Prefix (2602:100:): 2602:100:
Enter IPv4 Border Relay address: 68.114.165.1
Enter your public IP: 24.247.20.162


mtu 1480
tunnel 24.247.20.162 68.114.165.1
inet6 alias 2602:100:18f7:14a2::1 128
dest 2602:100:4472:a501::1
!/sbin/route -qn add -inet6 default 2602:100:4472:a501::1

Now I just paste that into /etc/hostname.gif0 and run:

# sh /etc/netstart gif0

Using mtr -6 www.google.com, I see that it is working.

  1.|-- ???                                        100.0     1    0.0   0.0   0.0   0.0   0.0
  2.|-- 2001:506:100:6c::1                          0.0%     1   22.2  22.2  22.2  22.2   0.0
  3.|-- bbr01olvemo-tge0-3-0-4.mo.olve.charter.com  0.0%     1   28.4  28.4  28.4  28.4   0.0
  4.|-- bbr02chcgil-tge0-0-0-4.il.chcg.charter.com  0.0%     1   39.1  39.1  39.1  39.1   0.0
  5.|-- prr01chcgil-tge2-1.il.chcg.charter.com      0.0%     1   37.4  37.4  37.4  37.4   0.0
  6.|-- 2001:4860:1:1:0:4e93:0:18                   0.0%     1   35.5  35.5  35.5  35.5   0.0
  7.|-- 2001:4860::1:0:3f7                          0.0%     1   35.2  35.2  35.2  35.2   0.0
  8.|-- 2001:4860:0:1::4da                          0.0%     1   35.6  35.6  35.6  35.6   0.0
  9.|-- ord08s08-in-x13.1e100.net                   0.0%     1   35.0  35.0  35.0  35.0   0.0

So, that is basically it in a nutshell. If you want to use ipv6 by default, add 'family inet6 inet4' to your /etc/resolv.conf

(Comments are closed)


Comments
  1. By Simon Perreault (sperreault) sperreault@openbsd.org on http://nomis80.org

    That's only part of the answer. You're configuring a tunnel to the border router. The thing is that the border router is only supposed to be used when communicating to the outside world, like a default route. All other subscribers in the same 6rd domain are reachable directly, peer-to-peer, without using the border router.

    Now, if they (the ISP) configured their stuff correctly, the BR should relay packets correctly even for intra-domain communication. In that case, what you're losing is just a tiny bit of efficiency.

    Comments
    1. By Simon Perreault (sperreault) on http://nomis80.org

      Oh and another thing: it would be really nice if you could obtain the 6rd parameters from DHCP instead of hard-coding them. :)

  2. By Logan Velvindron (2001:470:1f14:a6b:4d13:3d81:e836:9538) logan@elandsys.com on http://lugm.org/

    nice write-up :-)

    Let's hope one day, we'll get 6rd, or native v6 in Mauritius !

    Comments
    1. By Anonymous Coward (2001:470:89e9:1:8843:6d86:3d34:ed86) on

      > Let's hope one day, we'll get 6rd, or native v6 in Mauritius !

      My ISP (Comcast) is in the process of rolling out native IPv6 throughout their coverage area (see here for info). Unfortunately, I've had to leave OpenBSD behind, as OpenBSD cannot accept router advertisements on the WAN interface while forwarding packets. So I've switched to FreeBSD for my firewall / router.

      Comments
      1. By jared spiegel (63.251.248.156) on

        > Unfortunately, I've had to leave OpenBSD behind, as OpenBSD cannot accept router advertisements on the WAN interface while forwarding packets. So I've switched to FreeBSD for my firewall / router.

        i've got comcast too.

        i use the wide-dhcp package and that works for me well enough. every now and again i have to restart it manually to regain working v6 connectivity on the openbsd host -- LAN hosts behind openbsd don't get affected.

        i put fd00::1/64 on the lan iface and rtadvd does the right thing for all my lan clients.

        also i just put my wan iface's ipv6 lladdr in as my default route and it Just Works.

  3. By Morten Taksrud (51.174.73.127) morten@taksrud.net on www.taksrud.net

    Does anyone know if there are any news in OpenBSD regarding 6rd since 2013 or are we still "stuck" with improvising solutions our selves? :)
    -morten

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]