<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="/default.xsl"?>
<fr:tree xmlns:fr="http://www.forester-notes.org" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xml="http://www.w3.org/XML/1998/namespace" root="false" base-url="/">
  <fr:frontmatter>
    <fr:authors>
      <fr:author>
        <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
      </fr:author>
    </fr:authors>
    <fr:date>
      <fr:year>2019</fr:year>
      <fr:month>2</fr:month>
      <fr:day>11</fr:day>
    </fr:date>
    <fr:date>
      <fr:year>2019</fr:year>
      <fr:month>2</fr:month>
      <fr:day>22</fr:day>
    </fr:date>
    <fr:uri>https://xw.is/001G/</fr:uri>
    <fr:display-uri>001G</fr:display-uri>
    <fr:route>/001G/</fr:route>
    <fr:title text="OpenBSD › OpenBSD HE IPv6 tunnel"><fr:link href="/openbsd-index/" title="OpenBSD" uri="https://xw.is/openbsd-index/" display-uri="openbsd-index" type="local">OpenBSD</fr:link> › <fr:link href="/openbsd/" title="OpenBSD" uri="https://xw.is/openbsd/" display-uri="openbsd" type="local">OpenBSD</fr:link> HE IPv6 tunnel</fr:title>
  </fr:frontmatter>
  <fr:mainmatter>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>11</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>22</fr:day>
        </fr:date>
        <fr:title text="Introduction">Introduction</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>We will create an IPv6 tunnel (provided by <fr:link href="https://he.net/" type="external">Hurricane Electric</fr:link>) suitable for subnetting (<html:code>/48</html:code>).</html:p>
        <html:pre />
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>11</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>22</fr:day>
        </fr:date>
        <fr:title text="Configuration">Configuration</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>In <html:code>/etc/hostname.gif0</html:code>:</html:p>
        <html:pre>tunnel 207.246.122.61 209.51.161.14
!ifconfig gif0 inet6 alias 2001:470:1f06:95f::2 2001:470:1f06:95f::1 prefixlen 128
!route -n add -inet6 default 2001:470:1f06:95f::1</html:pre>
        <html:p>Enable it (as root):</html:p>
        <html:pre>sh /etc/netstart gif0</html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>11</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>22</fr:day>
        </fr:date>
        <fr:title text="Test">Test</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Check that it works:</html:p>
        <html:pre><![CDATA[freedom# route show -inet6
Routing tables

Internet6:
Destination        Gateway            Flags   Refs      Use   Mtu  Prio Iface
default            tunnel521973.tunne UGS        0       44     -     8 gif0
default            fe80::fc00:1ff:fed UGS        0        0     -    56 vio0
::/96              localhost          UGRS       0        0 32768     8 lo0
localhost          localhost          UHhl      10       20 32768     1 lo0
::ffff:0.0.0.0/96  localhost          UGRS       0        0 32768     8 lo0
tunnel521973.tunne tunnel521973-pt.tu UHh        1        1     -     8 gif0
tunnel521973-pt.tu tunnel521973-pt.tu UHl        0       59     -     1 gif0
2001:19f0:5:11d4:: freedom.mgk.ro     UCn        0        0     -     4 vio0
freedom.mgk.ro     56:00:01:d3:aa:bd  UHLl       0        0     -     1 vio0
2002::/24          localhost          UGRS       0        0 32768     8 lo0
2002:7f00::/24     localhost          UGRS       0        0 32768     8 lo0
2002:e000::/20     localhost          UGRS       0        0 32768     8 lo0
2002:ff00::/24     localhost          UGRS       0        0 32768     8 lo0
fe80::/10          localhost          UGRS       0        3 32768     8 lo0
fec0::/10          localhost          UGRS       0        0 32768     8 lo0
fe80::%vio0/64     fe80::5400:1ff:fed UCn        1        1     -     4 vio0
fe80::5400:1ff:fed 56:00:01:d3:aa:bd  UHLl       0        0     -     1 vio0
fe80::fc00:1ff:fed fe:00:01:d3:aa:bd  UHLch      1        5     -     3 vio0
fe80::1%lo0        fe80::1%lo0        UHl        0        0 32768     1 lo0
fe80::%gif0/64     fe80::42bc:4cfd:63 Un         0        0     -     4 gif0
fe80::42bc:4cfd:63 fe80::42bc:4cfd:63 UHl        0        0     -     1 gif0
ff01::/16          localhost          UGRS       0        3 32768     8 lo0
ff01::%vio0/32     fe80::5400:1ff:fed Um         0        1     -     4 vio0
ff01::%lo0/32      fe80::1%lo0        Um         0        1 32768     4 lo0
ff01::%gif0/32     fe80::42bc:4cfd:63 Um         0        1     -     4 gif0
ff02::/16          localhost          UGRS       0        3 32768     8 lo0
ff02::%vio0/32     fe80::5400:1ff:fed Um         0        1     -     4 vio0
ff02::%lo0/32      fe80::1%lo0        Um         0        1 32768     4 lo0
ff02::%gif0/32     fe80::42bc:4cfd:63 Um         0        1     -     4 gif0
freedom#
freedom#
freedom# ping6 google.com
PING google.com (2607:f8b0:4006:810::200e): 56 data bytes
64 bytes from 2607:f8b0:4006:810::200e: icmp_seq=0 hlim=57 time=2.307 ms
64 bytes from 2607:f8b0:4006:810::200e: icmp_seq=1 hlim=57 time=2.892 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 2.307/2.599/2.892/0.292 ms
freedom# traceroute6 google.com
traceroute6 to google.com (2607:f8b0:4006:810::200e), 64 hops max, 60 byte packets
 1  tunnel521973.tunnel.tserv4.nyc4.ipv6.he.net (2001:470:1f06:95f::1)  9.294 ms  6.861 ms  6.119 ms
 2  ve422.core1.nyc4.he.net (2001:470:0:5d::1)  2.155 ms  2.158 ms  2.876 ms
 3  core1-0-0-8.lga.net.google.com (2001:504:f::27)  1.798 ms  1.815 ms  2.393 ms
 4  2001:4860:0:1126::1 (2001:4860:0:1126::1)  3.032 ms  3.619 ms 2001:4860:0:1128::1 (2001:4860:0:1128::1)  2.576 ms
 5  2001:4860:0:1::2105 (2001:4860:0:1::2105)  2.89 ms  2.362 ms 2001:4860:0:1::2107 (2001:4860:0:1::2107)  2.052 ms
 6  lga34s14-in-x0e.1e100.net (2607:f8b0:4006:810::200e)  2.167 ms  2.114 ms  2.193 ms
freedom#]]></html:pre>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false">
      <fr:frontmatter>
        <fr:authors>
          <fr:author>
            <fr:link href="/aram/" title="Aram Hăvărneanu" uri="https://xw.is/aram/" display-uri="aram" type="local">Aram Hăvărneanu</fr:link>
          </fr:author>
        </fr:authors>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>11</fr:day>
        </fr:date>
        <fr:date>
          <fr:year>2019</fr:year>
          <fr:month>2</fr:month>
          <fr:day>22</fr:day>
        </fr:date>
        <fr:title text="Routing">Routing</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <html:p>Assign IPs to the interface you wish to route to:</html:p>
        <html:pre>freedom# cat /etc/hostname.enc0
inet 172.24.24.1 255.255.255.0 172.24.24.255
<html:strong>inet6 2001:470:8c78:a0::1 64</html:strong>
up</html:pre>
        <html:p>Reconfigure it:</html:p>
        <html:pre>sh /etc/netstart enc0</html:pre>
        <html:p>Enable IPv6 forwarding:</html:p>
        <html:pre>freedom# cat /etc/sysctl.conf
hw.smt=1
net.inet.ip.forwarding=1
<html:strong>net.inet6.ip6.forwarding=1</html:strong></html:pre>
        <html:p>Same thing with sysctl (as root):</html:p>
        <html:pre>sysctl net.inet6.ip6.forwarding=1</html:pre>
      </fr:mainmatter>
    </fr:tree>
  </fr:mainmatter>
  <fr:backmatter>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="References">References</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Context">Context</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Backlinks">Backlinks</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Related">Related</fr:title>
      </fr:frontmatter>
      <fr:mainmatter>
        <fr:tree show-metadata="true" expanded="false" toc="false" numbered="false">
          <fr:frontmatter>
            <fr:authors />
            <fr:uri>https://xw.is/openbsd/</fr:uri>
            <fr:display-uri>openbsd</fr:display-uri>
            <fr:route>/openbsd/</fr:route>
            <fr:title text="OpenBSD">OpenBSD</fr:title>
            <fr:taxon>Software</fr:taxon>
            <fr:meta name="external">https://www.openbsd.org</fr:meta>
          </fr:frontmatter>
          <fr:mainmatter>
            <html:p>OpenBSD is a security-focused, free software, Unix-like operating system based on the Berkeley Software Distribution.</html:p>
          </fr:mainmatter>
        </fr:tree>
      </fr:mainmatter>
    </fr:tree>
    <fr:tree show-metadata="false" hidden-when-empty="true">
      <fr:frontmatter>
        <fr:authors />
        <fr:title text="Contributions">Contributions</fr:title>
      </fr:frontmatter>
      <fr:mainmatter />
    </fr:tree>
  </fr:backmatter>
</fr:tree>
