<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shapeshifter.se &#187; IPv6</title>
	<atom:link href="http://www.shapeshifter.se/tag/ipv6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shapeshifter.se</link>
	<description>Mostly miscellaneous technical mumbo-jumbo.</description>
	<lastBuildDate>Sat, 12 Dec 2009 12:00:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>1-wire meets IPv6</title>
		<link>http://www.shapeshifter.se/2009/07/10/1-wire-meets-ipv6/</link>
		<comments>http://www.shapeshifter.se/2009/07/10/1-wire-meets-ipv6/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 12:25:19 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[1-wire]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[IPv6]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=548</guid>
		<description><![CDATA[A project I&#8217;ve been hacking on for a while is a self-contained 1-wire to IPv6 bridge based on an Atmel AVR ATmega644 and the ENC28J60 Ethernet controller from Microchip.
1-wire: is a serial bus from Dallas Semiconductor/Maxim that only requires 1 data line, there are a number of cheap sensors and other devices for this bus. [...]]]></description>
			<content:encoded><![CDATA[<p>A project I&#8217;ve been hacking on for a while is a self-contained <a href="http://www.maxim-ic.com/products/1-wire/">1-wire</a> to IPv6 bridge based on an <a href="http://www.atmel.com/dyn/products/product_card.asp?PN=ATmega644P%20Automotive">Atmel AVR ATmega644</a> and the <a href="http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en022889">ENC28J60</a> Ethernet controller from Microchip.</p>
<p><strong>1-wire</strong>: is a serial bus from Dallas Semiconductor/Maxim that only requires 1 data line, there are a number of cheap sensors and other devices for this bus. The strength of this bus is not its speed but that it supports large ranges (up to 300 meters).<br />
Also, each 1-wire device has a permanent <em>unique</em> 64-bit serial number.</p>
<p><strong>IPv6</strong>: Insanely large address space. It&#8217;s common to use a 64-bit netmask for site networks so that <a href="http://en.wikipedia.org/wiki/EUI-64">EUI-64</a> based addresses can be used for auto configuration. This leaves 64-bit for the node address &#8211; do you see where this is going now&#8230; <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Yes..I&#8217;ve built a device that assigned each 1-wire device it&#8217;s connected to its own IPv6 address. Why? you ask, mostly because I can.</p>
<p><!-- WSA: rules for context 'adsense-post-top' did not apply --></p>
<h3>Hardware</h3>
<p>As mentioned above, the device is based on an AVR ATmega644. It has 64KB of flash memory for program code and 4KB of RAM. It&#8217;s running on its built-in oscillator at 8MHz. The ENC28J60 Ethernet chip is connected to the AVR using SPI. The rest of the hardware is mostly for power distribution and management.</p>
<p>The PCB was manufactured by <a href="http://www.batchpcb.com/">BatchPCB</a>, cheap service but a bit slow turn-around time.</p>
<p><a href="http://www.shapeshifter.se/wp-content/uploads/2009/07/DSC00658.JPG"><img class="aligncenter size-medium wp-image-608" title="Populated PCB" src="http://www.shapeshifter.se/wp-content/uploads/2009/07/DSC00658-300x225.jpg" alt="Populated PCB" width="300" height="225" /></a></p>
<p>Unfortunately I  screwed up the SPI connection but I managed to fix that with some green wires (or black wires in this case). You&#8217;ll note them in the picture above.<br />
I also intended to run the AVR at 5V and the ethernet chip at 3.3V. This is what the quad AND-gate in the upper right<br />
corner was for, but since I screwed up the SPI routing it&#8217;s disconnected and the whole circuit is running at 3.3V.<br />
The ENC28J60 can only run at 3.3V, the AVR has a range from 2.8-5V and 1-wire should be ran at 5V but works at 3.3V. Hence the need for TTL voltage translation.</p>
<p>As for the 1-wire devices I had implemented a bus master in software that generated the require waveforms. It worked great up to about 10-15 meters. Any cable length greater than that refused to work.<br />
This was a bit unexpected and without an oscilloscope it was more or less impossible to figure out where and how the signals got mangled. So I simply got a <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2923">DS2480</a> 1-wire line driver that generates the required signals in hardware with more precise timing.</p>
<div id="attachment_595" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.shapeshifter.se/wp-content/uploads/2009/07/DSC00725.JPG"><img class="size-medium wp-image-595" title="DSC00725" src="http://www.shapeshifter.se/wp-content/uploads/2009/07/DSC00725-300x189.jpg" alt="Add-on board with a 1-wire master" width="300" height="189" /></a><p class="wp-caption-text">Add-on board with a 1-wire master</p></div>
<p>This required an add-on board and because I didn&#8217;t want to wait for a new PCB I used a 2.54mm prototype board. With the DS2480 only available in SOIC8 packages it required some &#8220;creative&#8221; soldering <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
The DS2480 required 5V, thus It had to get its own power supply and also required level translation on the UART line between this device and the AVR. I choose an approach using MOSFETs and a few resistors for this (the TO92 packages in the picture above). This turned out to work really good and I think I&#8217;m going to use this for the SPI level translation in the next revision of the board.<br />
The wire leaving the board on the left side leads to the 1-wire sensor devices.</p>
<p>The add-on board is extremely ugly. But hey, it works.</p>
<p>Future improvements for the next revision</p>
<ul>
<li>Use of external crystal at 16MHz instead of internal 8MHz clock.</li>
<li>Use MOSFETs for 3.3-5 V translation. Need to test it at 16MHz before manufacturing a PCB though.</li>
<li>Obviously fix all PCB errors <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>All SMD parts (resistors and voltage regulators) to shrink PCB size even more.</li>
<li>Better power distribution. I was a bit too conservative with the decoupling capacitors resulting in some weird power problems (fixable with some caps)</li>
<li>Create a real add-on board</li>
</ul>
<p>I&#8217;ll publish the PCB CAD files when the next revision is complete.</p>
<h3>Software</h3>
<p>The only small IPv6 stack I know of is the uIPv6 stack in the <a href="http://www.sics.se/contiki/">Contiki operating system</a> created by Adam Dunkel et al. This is unfortunately only available together with Contiki and not as a stand alone package as the originally uIP (IPv4) stack.</p>
<p>Contiki is a great operating system, but when you only have 4KB of RAM it becomes a bit heavy weight. So I broke out the uIPv6 stack from Contiki and made it run stand alone and ported in to AVR. I also ported the web server application from Contiki and made it run on AVR. As I wanted to use multiple IPv6 addresses I also had to add support for IP aliases to the uIPv6 stack.</p>
<p>Since the uIPv6 was integrated with Contiki it used the Contiki process model which it self is based on &#8220;proto-threads&#8221; (another thing invented by Adam Dunkel). I felt that this didn&#8217;t fit so I turned all processes into a polling mode instead. So one has to call a set of polling functions from the main application loop or from timers.</p>
<p>The other major parts of the code are drivers for ENC28J60, DS2480 and DS1820.</p>
<h5>Software</h5>
<dl>
<dt>1-wire devices</dt>
<dd>30 second polling interval with auto-discovery of new devices.<br />
Each device is assigned its own IPv6 address, requires a /64 network to be available.</dd>
<dt>Webserver</dt>
<dd>Integrated web server makes it possible to visit each address. An XML file with the latest sensor reading is returned. An &#8220;age timestamp&#8221; is also provided which makes it possible to determine how old the reading is. </dd>
</dl>
<p>Currently, with 5 1-wire devices connected it uses about 3KB of RAM.</p>
<ul>
<li><a href="http://svn.h3q.net/work/avr/ethernode/src">Source code</a></li>
<li><a href="http://www.shapeshifter.se/code/uipv6/">uIPv6 port</a></li>
</ul>
<h3>In-action</h3>
<p>I only have temperature sensors connected at the moment. If you happen to have an IPv6 capable connection you can access the sensors through a web browser.</p>
<p><a rel="nofollow,noindex" href="http://[2001:16d8:ffe5:002:2894:eaf6:100:0c7]">2001:16d8:ffe5:002:2894:eaf6:100:0c7</a><br />
<a rel="nofollow,noindex" href="http://[2001:16d8:ffe5:002:28c1:b4f6:100:035]">2001:16d8:ffe5:002:28c1:b4f6:100:035</a><br />
<a rel="nofollow,noindex" href="http://[2001:16d8:ffe5:002:2809:aef6:100:0ca]">2001:16d8:ffe5:002:2809:aef6:100:0ca</a><br />
<a rel="nofollow,noindex" href="http://[2001:16d8:ffe5:002:28c5:a5f6:100:058]">2001:16d8:ffe5:002:28c5:a5f6:100:058</a><br />
<a rel="nofollow,noindex" href="http://[2001:16d8:ffe5:002:2813:caf6:100:050]">2001:16d8:ffe5:002:2813:caf6:100:050</a></p>
<p style="text-align: center;">(If you don&#8217;t have IPv6 you should get it, or you can view graphs based on the sensor values at <a rel="nofollow" href="http://www.lindberg.tl">lindberg.tl</a> instead).</p>
<table style="text-align: center;" border="0" cellspacing="2">
<tbody>
<tr>
<td><a href="/wp-content/uploads/2009/07/DSC00664.JPG"><img title="DSC00664" src="/wp-content/uploads/2009/07/DSC00664-300x225.jpg" alt="DSC00664" width="300" height="225" /></a></td>
<td><a href="/wp-content/uploads/2009/07/DSC00661.JPG"><img title="DSC00661" src="/wp-content/uploads/2009/07/DSC00661-300x225.jpg" alt="DSC00661" width="300" height="225" /></a></td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2009/07/10/1-wire-meets-ipv6/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Obscuring SMTP auth headers &#8211; with IPv6</title>
		<link>http://www.shapeshifter.se/2008/12/10/obscuring-smtp-auth-headers-with-ipv6/</link>
		<comments>http://www.shapeshifter.se/2008/12/10/obscuring-smtp-auth-headers-with-ipv6/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 16:01:19 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=410</guid>
		<description><![CDATA[
The FreeBSD Diary and Riseup labs describe a way to anonymize the first &#8220;received from&#8221; header with usually contain the IP-address of the computer the mail was sent from.  This information is removed by taking advantage of the &#8220;Authenticated sender&#8221; and the header_checks directive in Postfix.
The &#8220;Authenticated sender&#8221; is added when a user has been [...]]]></description>
			<content:encoded><![CDATA[<p><!-- WSA: rules for context 'adsense-post-top' did not apply --><br />
The <a href="http://www.freebsddiary.org/smtp-headers-rewrite-auth.php">FreeBSD Diary</a> and <a href="http://riseuplabs.org/privacy/postfix/">Riseup labs</a> describe a way to anonymize the first &#8220;received from&#8221; header with usually contain the IP-address of the computer the mail was sent from.  This information is removed by taking advantage of the &#8220;Authenticated sender&#8221; and the header_checks directive in Postfix.</p>
<p>The &#8220;Authenticated sender&#8221; is added when a user has been authenticated by the MTA through SASL and the directive smtpd_sasl_authenticated_header have been set to yes.  The header_checks directive takes a file containing a regular expression which rewrites the header data and removes sensitive information.</p>
<p>This all works well &#8211; with IPv4. The regular expression posted on the pages mentioned above does not take IPv6 addresses into account, I modified it slightly to accept both IPv4 and IPv6 addresses.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #339933;">/^</span>Received<span style="color: #339933;">:</span> from <span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span> \<span style="color: #009900;">&#40;</span>\<span style="color: #009900;">&#91;</span><span style="color: #339933;">?</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">-.</span>_<span style="color: #009900;">&#91;</span><span style="color: #339933;">:</span>alnum<span style="color: #339933;">:</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span>\<span style="color: #009900;">&#93;</span><span style="color: #339933;">?</span> \<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>\<span style="color: #339933;">.</span>0<span style="color: #339933;">-</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#123;</span><span style="color: #cc66cc;">7</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">|</span>IPv6<span style="color: #009900;">&#91;</span>\<span style="color: #339933;">:</span>a<span style="color: #339933;">-</span>fA<span style="color: #339933;">-</span>F0<span style="color: #339933;">-</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#41;</span>\<span style="color: #009900;">&#93;</span>\<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span>
\<span style="color: #009900;">&#40;</span>Authenticated sender<span style="color: #339933;">:</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">^</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#41;</span>\<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>by mx1\<span style="color: #339933;">.</span>example\<span style="color: #339933;">.</span>com<span style="color: #009900;">&#41;</span> \<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #339933;">^</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#41;</span>\<span style="color: #009900;">&#41;</span> with <span style="color: #009900;">&#40;</span>E<span style="color: #339933;">?</span>SMTPS<span style="color: #339933;">?</span>A<span style="color: #339933;">?</span><span style="color: #009900;">&#41;</span> id
 <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span>A<span style="color: #339933;">-</span>F<span style="color: #009900;">&#91;</span><span style="color: #339933;">:</span>digit<span style="color: #339933;">:</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">.*</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">/</span> REPLACE Received<span style="color: #339933;">:</span> from smtp<span style="color: #339933;">-</span>auth<span style="color: #339933;">.</span>example<span style="color: #339933;">.</span>com <span style="color: #009900;">&#40;</span>smtp<span style="color: #339933;">-</span>auth<span style="color: #339933;">.</span>example<span style="color: #339933;">.</span>com
 <span style="color: #009900;">&#91;</span>127<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>1<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#40;</span>Authenticated sender<span style="color: #339933;">:</span> hidden<span style="color: #009900;">&#41;</span><span style="color: #0000ff;">$5</span><span style="color: #0000ff;">$6</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$7</span><span style="color: #009900;">&#41;</span> with <span style="color: #0000ff;">$8</span> id <span style="color: #0000ff;">$9</span> <span style="color: #0000ff;">$10</span></pre></div></div>

<p>Note that this should be one single line.</p>
<p>Put this in a file, for example /usr/local/etc/postfix/obscure_smtp_auth and add the following to your Postfix configuration (assuming you have SASL working).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">header_checks <span style="color: #339933;">=</span> pcre<span style="color: #339933;">:/</span>usr<span style="color: #339933;">/</span>local<span style="color: #339933;">/</span>etc<span style="color: #339933;">/</span>postfix<span style="color: #339933;">/</span>obscure_smtp_auth
smtpd_sasl_authenticated_header <span style="color: #339933;">=</span> yes</pre></div></div>

<p>The first header will now be rewritten, for both IPv4 and IPv6 clients and will look something like this.</p>
<pre>
Received: from smtp-auth.example.com (smtp-auth.example.com [127.0.0.1]) 127.0.0.1 (Authenticated sender: hidden)
	by mx1.example.com (Postfix) with ESMTPSA id 3677033C6F
	for &#038;lthostmaster@example.se&gt;; Wed, 10 Dec 2008 16:31:51 +0100 (CET)
</pre>
<p>instead of</p>
<pre>
Received: from [IPv6:2001:xxxx:xxxx:xxxx:xxxx:xxxx:fedd:7914] (unknown [IPv6:2001:xxxx:xxxx:xxxx:xxxx:xxxx::fedd:7914])
	(Authenticated sender: someuser@example.com)
	by mx1.example.com (Postfix) with ESMTPSA id 3677033C6F
	for  &#038;lthostmaster@example.se&gt;;  Wed, 10 Dec 2008 16:31:51 +0100 (CET)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/12/10/obscuring-smtp-auth-headers-with-ipv6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPv6: Network, Routing and Firewalling</title>
		<link>http://www.shapeshifter.se/2008/11/02/ipv6-network-routing-and-firewalling/</link>
		<comments>http://www.shapeshifter.se/2008/11/02/ipv6-network-routing-and-firewalling/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 12:55:54 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[quagga]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=397</guid>
		<description><![CDATA[Note: This is about &#8220;intra-AS&#8221; IPv6 routing and networking as I haven&#8217;t had the opportunity to play with IPv6 BGP stuff.

I got a (insanely) large IPv6 address space from SixXS statically routed to me over a 6-in-4 tunnel, it&#8217;s connected to a static IPv4 address on a machine with plenty of bandwidth.  As I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Note: This is about &#8220;intra-AS&#8221; IPv6 routing and networking as I haven&#8217;t had the opportunity to play with IPv6 BGP stuff.<br />
<!-- WSA: rules for context 'adsense-page-linkunit' did not apply --><br />
I got a (insanely) large IPv6 address space from <a href="http://www.sixxs.net">SixXS</a> statically routed to me over a 6-in-4 tunnel, it&#8217;s connected to a static IPv4 address on a machine with plenty of bandwidth.  As I wanted IPv6 connectivity at multiple points I figured that instead of wasting a /48 for every location I could just as well setup my own &#8220;overlay&#8221; IPv6 network running on top of several IPv4 tunnels.</p>
<p><span id="more-397"></span></p>
<p>Oh, and to put things in perspective. An IPv6 address is 128 bits, 48-bits (aka /48) for the net leaves 80 bits for hosts. That&#8217;s 1.20892582 × 10<sup>24</sup> hosts, or 65536 /64 sub-nets with 1.84467441 × 10<sup>19</sup> hosts in each. But of course you already knew that <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let&#8217;s kick start the post by showing a pretty picture of how the network looks.</p>
<div id="attachment_398" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.shapeshifter.se/wp-content/uploads/2008/11/ipv6-net.png"><img class="size-medium wp-image-398" title="ipv6-net" src="http://www.shapeshifter.se/wp-content/uploads/2008/11/ipv6-net-300x216.png" alt="IPv6 net" width="300" height="216" /></a><p class="wp-caption-text">IPv6 net</p></div>
<p>IPv6 is statically routed from the SixXS PoP to my IPv6 border router. The routers within my administrative zone are spread geographically and talk IPv6 to each other over 6-in-4 tunnels. They also run OSPFv3 for convenience and because static routing is a pain (I&#8217;ll admit that the current setup is doable with static routing, but if I add one or more routers things will get ugly).</p>
<h2>6-in-4 tunnels</h2>
<p>There are many ways to tunnel traffic. Since we&#8217;re dealing with public IP-addresses here (hence already insecure traffic) I didn&#8217;t feel the need to secure the traffic between my routers as the packets will be routed to the Internet in an insecure way anyhow. I therefore opted for one of the easier tunneling methods of simply putting the complete IPv6 packet directly into a IPv4 packet and setting protocol field to 41 (IPv6 protocol number). This kind of tunnel is available in most operating systems.  My routers run FreeBSD and the pseudo-interface <a href="http://www.freebsd.org/cgi/man.cgi?query=gif">gif(4)</a> provides this functionality.</p>
<h3>Numbering IPv6 point-to-point links</h3>
<p>Numbering these links was not as easy as one would have though. These are point-to-point links and in IPv4 you would normally use a /30 (possibly a /31). However sub-netting in IPv6 is not as liberal as IPv4. RFC3513 section 2.5.4 says that the node id should be 64-bit (ie a /64 net). Using a /64 on one point-to-point link is not very attractive as it wastes A LOT of addresses (sure I have plenty, but it&#8217;s ugly).</p>
<p>Fortunately, more people feel this way and /127 nets have become popular on p2p-links. After reading RFC3627 &#8220;Use of /127 Prefix Length Between Routers Considered Harmful&#8221; and compared the pros and cons I decided to use /126 on my point-to-point links (which is equivalent to a /30 in the IPv4 world).</p>
<p>Configuring this is trivial, watch out for firewall issues though. You need to allow protocol 41 (same level as tcp and udp) between the IPv4 hosts.</p>
<blockquote>
<pre>gif1: flags=8051 metric 0 mtu 1280
	tunnel inet X.X.X.X --&gt; Y.Y.Y.Y
	inet6 fe80::218:71ff:fe68:d071%gif1 prefixlen 64 scopeid 0x5
	inet6 2001:16d8:ffe5::1 prefixlen 126</pre>
</blockquote>
<p>The observant reader might notice the configured fe80::/10 network, which is an auto configured link-local network (only valid on the p2p-link). I didn&#8217;t initially have this configured, but it turned out that this was <strong>extremely</strong> important for reasons that will become clear in the following sections.</p>
<h2>OSPFv3</h2>
<p>As stated previously I run OSPFv3 (OSPF with IPv6 extensions) on the routers for flexibility.  I choose Quagga for this and the routers run ospf6d and zebra.</p>
<h3>zebra</h3>
<p>The zebra daemon handles the interaction with the kernel and installs the selected routes into the kernels forwarding table (FIB) (which quite erroneously is called routing table in most operating systems).</p>
<p><strong>zebra configuration at the border router</strong><br />
<em>Terminal access lists and settings have been left out for readability</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">hostname</span> border
password somepassword
log <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>quagga<span style="color: #000000; font-weight: bold;">/</span>zebra.log
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Static default route which is injected as an external route</span>
<span style="color: #666666; font-style: italic;"># into OSPF</span>
ipv6 route <span style="color: #000000;">2000</span>::<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3</span> <span style="color: #000000;">2001</span>:16d8:ff00:2be::<span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Enable IPv6 forwarding (if not already enabled by the OS)</span>
ipv6 forwarding
<span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<p>Why are we injecting 2000::/3 as a default route?  Because 2001::/3 covers the currently valid global unicast addresses. See <a href="http://www.iana.org/assignments/ipv6-unicast-address-assignments">ipv6-unicast-address-assignments</a> and <a href="http://tools.ietf.org/html/rfc4147">RFC4147</a>.</p>
<p><strong>zebra configuration at internal routers</strong><br />
<em>Terminal access lists and settings have been left out for readability</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">hostname</span> router1
password somepassword
log <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>quagga<span style="color: #000000; font-weight: bold;">/</span>zebra.log
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Enable RA (router advertisements) on the internal interface so that clients on the LAN</span>
<span style="color: #666666; font-style: italic;"># are able to auto configure an IPv6 address within the correct prefix.</span>
interface internal0
 link-detect
 ipv6 address <span style="color: #000000;">2001</span>:16d8:ffe5:<span style="color: #000000;">2</span>::<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">64</span>
 no ipv6 nd suppress-ra
 ipv6 nd ra-interval <span style="color: #000000;">10</span>
 ipv6 nd prefix <span style="color: #000000;">2001</span>:16d8:ffe5:<span style="color: #000000;">2</span>::<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">64</span>
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Enable IPv6 forwarding (if not already enabled by the OS)</span>
ipv6 forwarding
<span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<h3>ospf6d</h3>
<p>ospf6d is the daemon in the Quagga suite that implements OSPFv3. My setup is quite simple and does not involve any areas.</p>
<p><strong>ospf6d configuration at border router</strong><br />
<em>Terminal access lists and settings have been left out for readability</em></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">password somepassword
log <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>quagga<span style="color: #000000; font-weight: bold;">/</span>ospf6d.log
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Tunnel interface on which</span>
interface gifX
ipv6 ospf6 instance-id <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Redistribute connected subnets and static (from zebra) routes to neighbors</span>
router ospf6
router-id 0.0.0.1
redistribute connected
redistribute static
<span style="color: #666666; font-style: italic;"># Add one interface line for each tunnel</span>
interface gifX area 0.0.0.0
<span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<p><strong>ospf6d configuration at internal routers</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">password somepassword
log <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>quagga<span style="color: #000000; font-weight: bold;">/</span>ospf6d.log
<span style="color: #000000; font-weight: bold;">!</span>
interface gifX
 ipv6 ospf6 instance-id <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># The internal interface is configured as passive to suppress OSPF hello-messages</span>
<span style="color: #666666; font-style: italic;"># on the internal network but still allow the configured subnet to be injected into</span>
<span style="color: #666666; font-style: italic;"># OSPF</span>
interface internal0
 ipv6 ospf6 instance-id <span style="color: #000000;">0</span>
 ipv6 ospf6 passive
<span style="color: #000000; font-weight: bold;">!</span>
<span style="color: #666666; font-style: italic;"># Redistribute connected subnets</span>
router ospf6
 router-id 0.0.0.2
 redistribute connected
 <span style="color: #666666; font-style: italic;"># Tunnel interface (external)</span>
 interface gifX area 0.0.0.0
 <span style="color: #666666; font-style: italic;"># Internal interface, marked as passive above.</span>
 interface internal0 area 0.0.0.0
<span style="color: #000000; font-weight: bold;">!</span></pre></div></div>

<p>Note that you need to remove the passive flag if you intend to have more OSPFv3 routers on the network connected to the internal interface. Otherwise they would be unable to find each other.</p>
<h3>OSPFv3 on Point-to-point links</h3>
<p>As I used numbered point-to-point links I figured this would &#8220;just work&#8221;. Turned out that it was not that simple.</p>
<p>The routers successfully formed an adjacency</p>
<blockquote>
<pre>router1# show ipv6 ospf6 neighbor
Neighbor ID     Pri    DeadTime  State/IfState         Duration I/F[State]
0.0.0.1           1    00:00:37   Full/PointToPoint    01:14:38 gif0[PointToPoint]</pre>
</blockquote>
<p>Routes were distributed correctly, but all received routes had the next hop set to :: which is the unspecified IPv6 address (equal to 0.0.0.0), which of course caused zebra to reject the route and not install it into the FIB.</p>
<p><em>Most routes have been left out from the output below</em></p>
<blockquote>
<pre>router1# show ipv6 ospf6 route
*N E1 2000::/3                       ::    gif0 01:14:45
...</pre>
</blockquote>
<p>I though this didn&#8217;t make any sense as a packet dump showed LSA being exchanged correctly. After actually reading the ospf6d source code and some of the OSPFv3 specifications it finally hit me. OSPFv3/IPv6 Point-to-point links <strong>must</strong> use the link-local address space fe80::/10. And what do you know, after I turned on auto link local addresses on the tunnel interfaces routes were properly exchanged and ospf6d set the next hop correctly on received routes.</p>
<blockquote>
<pre>router1# show ipv6 ospf6 route
*N E1 2000::/3                        fe80::218:71ff:fe68:d071   gif0 01:14:45
...</pre>
</blockquote>
<h2>IPv6 clients</h2>
<p>As ospf6d on the LAN router is configured to send router advertisements clients connected to the LAN simply needs to enable IPv6 (and accept router advertisements in case it&#8217;s disabled) to get an IPv6 address and a default route.  This kind of stateless auto configuration is one of the advantages of IPv6, but it has one <strong>big</strong> weakness. It&#8217;s not possible to distribute name server information without DHCPv6.</p>
<p>Currently all my clients are dual-stacked and get name server information through DHCPv4.  I plan to add a stateless DHCPv6 server that distribute information only (no addresses) so that it&#8217;s possible to get name server information without involving IPv4.</p>
<h2>Firewall considerations</h2>
<p>IPv6 needs to be protected by firewalls just as IPv4.</p>
<h3>Protecting the tunnels and tunnel endpoints</h3>
<p>The 6-in-4 tunnels requires a bit of special care, simply allowing everything on the tunnel interface could open up some nasty holes and allow traffic to daemons running on the routers.  How rules should be applied depends on which kind of tunnel type you are using, the following assumes an IPv6 packet directly inside a IPv4 packet without other encapsulation.</p>
<ul>
<li>Allow protocol 41(IPv6) inside IPv4 packets between the IPv4 endpoints.  This is similar to for example allowing TCP between two IPv4 hosts.</li>
<li>Allow IPv6 traffic from/to fe80::/10 (link-local), fe00::/8 (multicast) and your configured /126.</li>
<li>At the end router allow traffic to/from the configured /64 subnet.</li>
<li>Make sure daemons (that are not supposed to be exposed) are listening on ::1/128 only or block traffic from other subnets than your own so that only valid hosts are able to create connections to IPv6 addresses configured on the router.</li>
</ul>
<h3>Protecting public services</h3>
<p>No real difference from IPv4 services, only expose ports that should be exposed. If services and tunnels are running on the same machine make sure that it&#8217;s not possible to connect to the daemons through the IPv6 address configured at the tunnel (see previous section).</p>
<h3>Protecting clients</h3>
<p>Protecting LAN clients are a bit different from IPv4. IPv4 clients are usually behind NAT (unless you&#8217;ve got an insanely large IPv4 space and waste it on client hosts).  A fundamental consequence of NAT is that it&#8217;s impossible to establish inbound connections to hosts, thus providing protection from incoming connections from malicious hosts.</p>
<p>It&#8217;s tempting to simply block all incoming connections to IPv6 clients giving them the same level of protection as IPv4 NAT-hosts. This is however a quite bad idea, one of the advantages of IPv6 and the large address space is that clients are able to establish peer-to-peer (client to client) connections between each other. A large number of applications benefit from this, for example VoIP, Video-chat, file transfers etc.</p>
<p>Still, it&#8217;s probably a good idea to block incoming connections to commonly &#8220;abused&#8221; ports at the LAN border. For example</p>
<ul>
<li>137/TCP, 138/UDP, 139/TCP &#8211; NetBIOS</li>
<li>135/TCP &#8211; RPC</li>
<li>445/TCP &#8211; SMB</li>
<li>389/TCP &#8211; LDAP</li>
<li>1512 &#8211; WINS</li>
<li>515 &#8211; LPD</li>
</ul>
<p class="title">Golden rule, don&#8217;t block too much, but don&#8217;t block too little either <img src='http://www.shapeshifter.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , clients should run a local firewall as well if possible.</p>
<h2 class="title">References</h2>
<ul>
<li><a href="http://www.quagga.net/docs.php">http://www.quagga.net/docs.php</a> &#8211; Quagga Documentation</li>
<li><a href="http://tools.ietf.org/html/rfc4291">http://tools.ietf.org/html/rfc4291</a> &#8211; IP Version 6 Addressing Architecture</li>
<li><a href="http://tools.ietf.org/html/rfc3627">http://tools.ietf.org/html/rfc3627</a> &#8211; Use of /127 Prefix Length Between Routers Considered Harmful</li>
<li><a href="http://tools.ietf.org/html/rfc4861">http://tools.ietf.org/html/rfc4861</a> &#8211; Neighbor Discovery for IP version 6 (IPv6)</li>
<li><a href="http://support.microsoft.com/kb/832017">http://support.microsoft.com/kb/832017</a> &#8211; Service overview and network port requirements for the Windows Server system</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/11/02/ipv6-network-routing-and-firewalling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>shapeshifter.se &#8211; now available over IPv6</title>
		<link>http://www.shapeshifter.se/2008/10/31/shapeshifterse-now-available-over-ipv6/</link>
		<comments>http://www.shapeshifter.se/2008/10/31/shapeshifterse-now-available-over-ipv6/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 15:34:12 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[Meta]]></category>
		<category><![CDATA[IPv6]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=391</guid>
		<description><![CDATA[Granted it&#8217;s still poor-mans-ipv6 (aka ipv6 over a ipv4 tunnel), but still. If you&#8217;re IPv6 capable you&#8217;re most likely reading this over IPv6 already.
The IP address for www.shapeshifter.se is 2001:16d8:ffe5:1:1::1 (from 2001:16d8:ffe5:1::/64)
It has got some shiny AAAA/PTR records too.
shapeshifter.se has IPv6 address 2001:16d8:ffe5:1:1::1
1.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.1.0.0.0.5.e.f.f.8.d.6.1.1.0.0.2.ip6.arpa domain name pointer www.shapeshifter.se.
I played with IPv6 several years ago (back during [...]]]></description>
			<content:encoded><![CDATA[<p>Granted it&#8217;s still poor-mans-ipv6 (aka ipv6 over a ipv4 tunnel), but still. If you&#8217;re IPv6 capable you&#8217;re most likely reading this over IPv6 already.</p>
<p>The IP address for www.shapeshifter.se is 2001:16d8:ffe5:1:1::1 (from 2001:16d8:ffe5:1::/64)</p>
<p>It has got some shiny AAAA/PTR records too.</p>
<blockquote><p>shapeshifter.se has IPv6 address 2001:16d8:ffe5:1:1::1<br />
1.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.1.0.0.0.5.e.f.f.8.d.6.1.1.0.0.2.ip6.arpa domain name pointer www.shapeshifter.se.</p></blockquote>
<p>I played with IPv6 several years ago (back during the 6BONE days) and recently decided to give it another shot.  Most of my services are now available through IPv6 and my local LAN has IPv6 connectivity. I&#8217;ll write more about that in another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2008/10/31/shapeshifterse-now-available-over-ipv6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
