<?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>ipsidixit.net &#187; IPv6</title>
	<atom:link href="http://www.ipsidixit.net/tag/ipv6-networking/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ipsidixit.net</link>
	<description>A far off place</description>
	<lastBuildDate>Thu, 08 Dec 2011 06:30:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>npd6 &#8211; Software now available</title>
		<link>http://www.ipsidixit.net/2011/08/04/npd6/</link>
		<comments>http://www.ipsidixit.net/2011/08/04/npd6/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 12:50:45 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[npd6]]></category>
		<category><![CDATA[ping6]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=619</guid>
		<description><![CDATA[<p>As per previous posts and discussions, my project to develop npd6 (Neighbor Proxy Daemon 6) is now advancing very rapidly.</p> <p>If you have a Linux gateway router terminating your ISP feed supporting IPv6, this may be just what you need. To summarise the problem it solves: your ISP has given you an /64 (or some [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png"><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" /></a>As per previous posts and discussions, my project to develop <em><strong>npd6</strong></em> (Neighbor Proxy Daemon 6) is now advancing very rapidly.</p>
<p>If you have a Linux gateway router terminating your ISP feed supporting IPv6, this may be just what you need. To summarise the problem it solves: your ISP has given you an /64 (or some other size) IPv6 prefix, with the last 64 bits (or whatever) entirely for your own use on a private-side of the network. The IPv6 addresses in use by your own devices may well not even be known to you &#8211; it&#8217;s possible that you use DHCP6 to statically pre-allocate them (yuck!) or more likely you are using <em>radvd</em> on the gateway to advertise the ISP-supplied IPv6 prefix and let the devices themselves choose what they wish to tag on to that. It may be vaguely predictable (based upon the device&#8217;s Ethernet MAC address) or totally unpredictable (as per the Windows 7 box I looked at the other day!)</p>
<p>For these devices to be able to reach the outside IPv6 world, there is a good chance that your ISP will use the ICMP6 <em>Neighbor Solicitation</em> mechanism &#8211; and your gateway needs to play along. Other articles on this site go into painful details about this mechanism, so let&#8217;s sum it up as: in a very vaguely similar way to IPv4 ARPs, a device may receive an IPv6 Neighbor Solicitation for a specific global address and, if it knows how to reach it, respond with a Neighbor Advertisement. So for example, your ISP has given you the global prefix:</p>
<p style="padding-left: 30px;"><span style="font-family: 'courier new', courier; font-size: small;">AAAA:AAAA:AAAA:AAAA:</span></p>
<p>and your home devices thus all end up with addresses using this prefix plus a variable suffix, of the form:</p>
<p style="padding-left: 30px;"><span style="font-family: 'courier new', courier; font-size: small;">AAAA:AAAA:AAAA:AAAA:BBBB:BBBB:BBBB:BBBB</span></p>
<p>So the Windows workstation which has chosen the 128-bit global address AAAA:AAAA:AAAA:AAAA:BBBB:BBBB:BBBB:BBBB tries to connect to ipv6.google.com. Out goes the connection, and when the response comes back, the ISP&#8217;s router says to your gateway: &#8220;Neighbor Solicitation: Do you know how to reach AAAA:AAAA:AAAA:AAAA:BBBB:BBBB:BBBB:BBBB?&#8221;</p>
<p>And you want to say back &#8220;Neighbor Advertisement: Sure, AAAA:AAAA:AAAA:AAAA:BBBB:BBBB:BBBB:BBBB is known to me &#8211; send me his traffic.&#8221;</p>
<p>And to do this today you need to <em>statically pre-configure</em> that full address into the Linux system. And if it changes, you need to change it. And if a new one appears, you need to ad it. And so on. Oh, and to add insult to injury, you cannot even display a list of which ones you have already configured in the system!!</p>
<p>And thus I offer npd6 as a solution: it runs on the gateway, and requires little configuration. You tell it your prefix and which is the ISP&#8217;s interface. There are a few optional knobs and levers. Then it runs and automatically responds to <em>any</em> Neighbor Solicitation received from the ISP for a device with your prefix.</p>
<h2>Status</h2>
<p>The code today is working well. It is easy to build on any typical Linux system. Soon I will package it and offer .debs, RPMs etc. It is highly efficient and low-impact in terms of CPU an so on.  Also, extensive debug options are built in, to assist if any problems occur.</p>
<p>To get it, please visit the GoogleCode hosting site at: <a href="https://code.google.com/p/npd6/">http://code.google.com/p/npd6/</a> and specifically the code at: <a href="https://code.google.com/p/npd6/source/checkout">http://code.google.com/p/npd6/source/checkout</a> (Subversion) or a tarball at <a href="https://code.google.com/p/npd6/downloads/list">https://code.google.com/p/npd6/downloads/list</a></p>
<p>If you want to try it out, please do download and build it. If you need help, please ask! Feel free to raise issues via: <a href="https://code.google.com/p/npd6/issues/list">http://code.google.com/p/npd6/issues/list</a></p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2011/08/04/npd6/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>npd6 &#8211; IPv6 neighbor proxy daemon &#8211; It lives!</title>
		<link>http://www.ipsidixit.net/2011/07/05/npd6-ipv6-neighbor-proxy-daemon-it-lives/</link>
		<comments>http://www.ipsidixit.net/2011/07/05/npd6-ipv6-neighbor-proxy-daemon-it-lives/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 21:14:02 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ping6]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=595</guid>
		<description><![CDATA[<p>As threatened in article IPv6 neighbor proxy daemon – npd6 and the associated design ramblings here, the npd6 project now lives and breathes.</p> <p>EDIT: 22 July &#8211; The project has really taken shape. Version 0.3 is now useful enough to be considered a working beta version. Building is very simple &#8211; do please try it out [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" />As threatened in article <a title="IPv6 neighbor proxy daemon – npd6" href="http://www.ipsidixit.net/2011/06/08/ipv6-neighbor-proxy-daemon-npd6/">IPv6 neighbor proxy daemon – npd6</a> and the associated design ramblings <a title="npd6 Design Document" href="http://www.ipsidixit.net/2011/06/08/npd6-design-document/">here</a>, the npd6 project now lives and breathes.</p>
<p><span style="font-size: x-large;"><strong>EDIT: 22 July &#8211; The project has really taken shape. Version 0.3 is now useful enough to be considered a working beta version. Building is very simple &#8211; do please try it out and let me know of any issues, good or bad.</strong></span></p>
<p>It&#8217;s absolutely early days, but, with plenty of limits and as-of-yet-unknown bugs, it does work&#8230;</p>
<p>I&#8217;m hosting it on Googlecode. It&#8217;s <a href="http://code.google.com/p/npd6/" target="_blank">here</a>. For a while yet I&#8217;ll not be making any binary or packaged versions available, or even autoconf/configure shenanigans &#8211; strictly source + Makefile.</p>
<p>If you want to give it a spin, do feel free. It&#8217;s going to change a LOT &#8211; we&#8217;re probably a month or so away from something I&#8217;d call &#8220;a usable, early <em>beta</em>&#8220;. Today it&#8217;s a &#8220;works for me pre-<em>alpha</em>&#8220;!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2011/07/05/npd6-ipv6-neighbor-proxy-daemon-it-lives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IPv6 neighbor proxy daemon &#8211; npd6</title>
		<link>http://www.ipsidixit.net/2011/06/08/ipv6-neighbor-proxy-daemon-npd6/</link>
		<comments>http://www.ipsidixit.net/2011/06/08/ipv6-neighbor-proxy-daemon-npd6/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 20:30:39 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[radvd]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=558</guid>
		<description><![CDATA[<p>I admit defeat&#8230; You know how it is: you&#8217;re searching for a solution to a technical problem, and you KNOW that someone else has had the same problem. In fact thousands of people have had the same problem. And it was fixed years ago. If I can just find that solution&#8230;</p> <p>EDIT: 22 July [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png"><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" /></a>I admit defeat&#8230; You know how it is: you&#8217;re searching for a solution to a technical problem, and you KNOW that someone else has had the same problem. In fact thousands of people have had the same problem. And it was fixed years ago. If I can just find that solution&#8230;</p>
<p><strong>EDIT: 22 July – The project has really taken shape. Version 0.3 is now useful enough to be considered a working beta version. Building is very simple – do please try it out and let me know of any issues, good or bad.</strong></p>
<p>And find it, eventually (Google, Bing et al &#8211; Thank You!)  you do.</p>
<p>Except when you don&#8217;t.<a href="http://www.ipsidixit.net/2010/03/24/239/" target="_blank"> Back in this post I wrote</a> about a specific, but key, problem in implementing an IPv6 firewall/router on a Linux box, when attached to a &#8220;normal&#8221; ISP.</p>
<h2>What was the problem?</h2>
<p>In a nutshell, it was as follows. My ISP gives me a full IPv6 service, with a staticically allocated (i.e. fixed) global IPv6 address. They give me a /64, so I in turn have a full /64 to play with in my private net. Enough to network every dust particle in the house. (And this is one dusty house).</p>
<p>As I found, not surprisingly the ISP does not let me advertise address space <em>back </em>to them regarding which devices in my private-but-globally-addressed network actually exist. Given that, I rather naively hoped that they would thus blindly forward <em>anything</em> that was addressed to my (global prefix + private part) network to me regardless, and treat my gateway device as, in effect, a sort of default route for my IPv6 prefix.</p>
<p><span id="more-558"></span></p>
<h2>Could you give an example?</h2>
<p>Sure. Say my ISP has given me the IPv6 prefix of <em>2a01:e35:8b25:7ea9:</em>&#8230; A device inside my network then, by the magic of <em>radvd</em>, gets an address of, say: <em>2a01:e35:8b25:7ea9:1111:2222:3333:4444.</em></p>
<p>(If you need a primer on this stuff, <a href="http://www.ipsidixit.net/2010/02/24/228/" target="_blank">read all about it here</a>!)</p>
<p>Then assuming all the other myriad options are set up right, from that inside device I do a test ping6 of ipv6.google.com. And it fails.</p>
<p>As per my earlier article, it&#8217;s all down to my ISP, when they get traffic from the remote host (in fact in this case the <em>ICMP6 echo reply</em> from Google) destined for <em>2a01:e35:8b25:7ea9:1111:2222:3333:4444</em> rather than just &#8220;knowing&#8221; that such a global address must, by definition, be behind my connection, they go to the irritating lenghts of instead doing the whole Neighbor Solicitation dance with me.</p>
<p>And I find that unless I have performed the following command on my Linux gateway:</p>
<p>ip -6 neigh add proxy 2a01:e35:8b25:7ea9:1111:2222:3333:4444 dev eth0</p>
<p>the gateway device will not reply to the neighbor solicitation. And hence nothing works.</p>
<h2>OK, does it matter much?</h2>
<p>Heck yes.</p>
<ol>
<li><em>Each</em> inside device must be statically configured on the gateway.</li>
<li>It is currently not possible (I know this seems implausible&#8230;) from user-space to <em>list</em> or <em>show</em> what devices you have configured in this way.</li>
<li>The biggie: if you are dynamically allocating addresses in the network, you will not even KNOW what the end-point address is.</li>
</ol>
<p>Item 3 is in large part a consequence of using radvd. But even if one used (at the cost of a lot more work) an IPv6 DHCP server, you still have to statically pre-configure the end devices addresses on it, and lose the ability to add devices on-the-fly.</p>
<p>So we have a real stumblin block. Sure, for test purposes I can dig out the IPv6 address which my end station has picked, and bang in the neighbor proxy command on the gateway. And it works fine.</p>
<p>But in terms of manageability and scalability it&#8217;s a freakin&#8217; disaster.</p>
<h2>Must be easy to fix, surely?</h2>
<p>Well if it is, no one I&#8217;ve spoken to has any idea! It&#8217;s a great, glaring black-hole. IPv6 on Linux simply currently appears to have no support for automating the proxying of global/private addresses <em>using the Neighbor Solicitation</em> mechanism. I can only assume that it was never thought this would be a problem, and Neighbor Solicitation would only ever be used to directly connected devices.</p>
<p>The ability to force a neighbor proxy as shown here is pretty obviously an after-thought. The real give away is the inability to list current defined proxies&#8230;</p>
<h2>So what we gonna do?</h2>
<p>I intend to fix it!! I&#8217;m going to use the article linked to <a href="http://www.ipsidixit.net/2011/06/08/npd6-design-document/">HERE </a>as a working document to put together a rough and ready design for a user-space daemon to fix this. It&#8217;s going to be simple to use &#8211; that&#8217;s key.</p>
<p>The main elements I can think of as a start are as follows:</p>
<ol>
<li>Run in user-space (I hope!)</li>
<li>Have a single, simple config file.</li>
<li>To have no prior knowledge of devices inside the networks.</li>
<li>Only prior knowledge, via static config, is the IPv6 prefix.</li>
<li>If a neighbor solicitation is received for our <em>prefix</em>, regardless of the suffix, we respond positively.</li>
</ol>
<p>Easy? No idea! I&#8217;m a useful enough network programmer but not at all familiar with the Linux IPv6 stack from the code perspective. But the functionality is, conceptually, not complex.</p>
<p>The key gotchas I forsee are:</p>
<ol>
<li>How we hook incoming neighbor solicitations. Period.</li>
<li>Then as per (1), but now with the &#8220;I want to run in user-space&#8221; goal. <img src='http://www.ipsidixit.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>What I do when someone points out (and they will&#8230;) that I&#8217;m going to violate several dozen RFCs by doing this.</li>
</ol>
<p>Piece of cake. As per above link, <a href="http://www.ipsidixit.net/2011/06/08/npd6-design-document/">the working design doc will be here</a>. Very soon. All contributions welcome &#8211; and I really do mean that!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2011/06/08/ipv6-neighbor-proxy-daemon-npd6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>npd6 Design Document</title>
		<link>http://www.ipsidixit.net/2011/06/08/npd6-design-document/</link>
		<comments>http://www.ipsidixit.net/2011/06/08/npd6-design-document/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 20:29:25 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=565</guid>
		<description><![CDATA[<p>So what must npd6 do in functional terms?</p> See Neighbor Solicitations. EITHER respond to them directly OR respond via the existing mechanisms. Log activity. Report status. Receive Neighbor Solicitations <p>The daemon needs to receive incoming neighbor solcitations from a designated port(s). I currently have no idea if this is an easy hook to make [...]]]></description>
			<content:encoded><![CDATA[<p>So what must npd6 do in functional terms?</p>
<ul>
<li>See Neighbor Solicitations.</li>
<li>EITHER respond to them directly</li>
<li>OR respond via the existing mechanisms.</li>
<li>Log activity.</li>
<li>Report status.</li>
</ul>
<h1>Receive Neighbor Solicitations</h1>
<p>The daemon needs to receive incoming neighbor solcitations from a designated port(s). I currently have no idea if this is an easy hook to make from user-space or whether we need to hook much lower. Kernel module? iptables? Main area for investigation this one!</p>
<h1>Act upon Neighbor Solicitations</h1>
<p>OK, so we receive an NS. What do we do about it?</p>
<h2>Validate</h2>
<p>First off, we validate it to a small degree. Likely scenario here is that in a <em>conf</em> file we have defined out static IPv6 prefix (in my scenario this will be 64-bits) We check it matches that. Likely in the conf we also want options to either explicitly include only defined addresses (ranges?) as valid (i.e. define valid suffixes) and/or <em>exclude</em> certain addresses/ranges?</p>
<h2>Action</h2>
<p>Key decision to be made is in what manner we act to a valid NS. The obvious two approaches are to either respond directly ourselves or instead to use the existing kernel mechanism to, in effect, add the address via the &#8220;ip -6 neigh proxy add&#8230;&#8221; command.</p>
<p>Pros and cons? Currently I have no idea how easy it is to spoof out a response. If easy, do I want to bother, when there&#8217;s an existing kernel mechanism do do so? So using that existing mechnaism seems attractive. We then, however, face the issue of how to manage the proxied addresses via that mechanism. Have we already added it? Should we check? Or blindly (re)add it? If we are to be stateful about it, how do we handle a restart situation, since I currently do not know how to get the kernel to cough out the current state of proxied addresses&#8230;</p>
<p>Needs a little investigation. <img src='http://www.ipsidixit.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h1>Logging and info</h1>
<p>Pretty much goes without saying that we want our daemon to log meaningful data. Also optional debug logging.</p>
<p>And if we&#8217;re going down the route of using the existing kernel neighbor proxy mechanism, then we would also want a feature to signal the daemon and have it spit out the current state of neighbor proxying.</p>
<p>&nbsp;</p>
<h1>9 June</h1>
<p>So my first steps here will be to dig around the kernel code currently handling NS. Get the feel of what&#8217;s going on there and see how it looks. Will update back here with impressions.</p>
<p>&nbsp;</p>
<p>Update 1:</p>
<p>Just started having a read of the radvd code. I note that it appears you can open a socket to hook ICMP6 messages, which is highly promising if true! Since NSs <em>are</em> ICMP6 it would make a really neat, easy, user-spacey way to integrate with them. Have to look more closely at the code. Also need to think about whether you could do this in parallel with radvd doing it too. Still, at least it&#8217;s a line of investigation to follow.</p>
<h1>14 June</h1>
<p>Just a brief update: I put together a skeleton npd6 prototype/framework with which to investigate. Did the dull part, setting up an environment for parameters, simple logging, debug, etc. Can now start really looking at the interesting bits.</p>
<h1>16 June</h1>
<p>So spent a lot of time looking at how netlink and IPv6 biff along together in Linux. Turns out the answer is: not so well! Reading the radvd code had given me false optimism, as it <em>does</em> use netlink to hook router advertisements. However the summary seems to be that netlink and IPv6 are only really fully developed for IPv6 ICMp <em>routing messages</em>, and hence doesn&#8217;t seem to let me extend things to e.g. neighbor solicitations as we need.</p>
<p>So out of that blind alley, and back to good ol&#8217; raw sockets. I can now happily hook any and all IPv6 ICMP and read the message. I don&#8217;t actually DO anything useful with it yet, but that&#8217;s no big deal. That fact that I can reliably (?) receive IPv6 ICMP in my user-space daemon is fine so far.</p>
<p>Next? Extend the processing of those received messages: spot the ones I&#8217;m interested in and decode them into debug logs.</p>
<h1>23 June</h1>
<p>OK, this rocks! The radvd code is an excellent crash course in IPv6 ICMP packet handling. LEarned a lot about how best to play the cmsg, iovec, mshhdr chain-game. Gave myself a headache in the process, but it&#8217;s good stuff. So my prototype is almost doing something useful now: it receives all NS sent to the gateway, and can compare their target against the user-defined prefix. If the target and prefix match up to the full prefix length it moves on and replies. The logic is very simple at this early stage: we don&#8217;t filter out, white/blacklist, etc. If the target matches the prefix, we&#8217;re going to respond. At the moment the bulk of NSs I receive on this device are actually for the interface&#8217;s address itself, so the box anyway NAs them in return. So for now, we&#8217;ll send an extra (dupe) NA for these. Obviously that would not be the long-term behaviour, but for now no harm -ICMP is stateless, and a dupe response is no big deal. Also, as a fun extra, it lets me benchmark my code by measuring the delay between the kernel-generated NA reply and my daemon reply!!</p>
<p>The NA I send back is almost right. Few fields and bits I need to understand a bit more, but this daemon is almost ready for alpha!</p>
<p>Anyone fancy testing it soon&#8230;.? (I&#8217;ve a colleague lined up to test on his home network, but would love to see it outside of the Free network.)</p>
<h1>24 June</h1>
<p>A very difficult issue pops up. Code so far can trap any unicast ICMP arriving at the gateway, and respond with a NA. Great! It works. Then remember that the NS coming in to us can be either directed unicast (what I&#8217;ve tested with so far) or, actually more likely, multicast. OK, no biggie. But then we see that the multicast is directed in terms of having the bottom 48 bits set to the target address contained within the solicitation. So&#8230;. from the socket level we need to pick up these &#8220;directed multicasts&#8221; (or solicited-node messages)  And that&#8217;s where things get tricky. To pick up a multicast I need (from socket level) to first join the multicast group. BUT these NSs, remember, don&#8217;t come in on a fixed multicast group.. So you cannot join the multicast group. It&#8217;s chicken + egg. You only know what multicast group will be used AFTER you&#8217;ve joined the right multicast group&#8230; I cannot believe this. But that&#8217;s how it seems right now. And makes me fear if the existing IPv6 socket layer can let this problem be overcome&#8230;. Ow. This is ugly.</p>
<blockquote><p>The solicited-node address facilitates efficient querying of network nodes during address resolution. IPv6 uses the Neighbor Solicitation message to perform address resolution. In IPv4, the ARP Request frame is sent to the MAC-level broadcast, disturbing all nodes on the network segment regardless of whether a node is running IPv4. For IPv6, instead of disturbing all IPv6 nodes on the local link by using the local-link scope all-nodes address, the solicited-node multicast address is used as the Neighbor Solicitation message destination.</p>
<p>The solicited-node multicast address consists of the prefix FF02::1:FF00:0/104 and the last 24-bits of the IPv6 address that is being resolved.</p>
<p>The following steps show an example of how the solicited-node address is handled for the node with the link-local IPv6 address of FE80::2AA:FF:FE28:9C5A, and the corresponding solicited-node address is FF02::1:FF28:9C5A:</p>
<ol>
<li>To resolve the FE80::2AA:FF:FE28:9C5A address to its link layer address, a node sends a Neighbor Solicitation message to the solicited-node address of FF02::1:FF28:9C5A.</li>
<li>The node using the address of FE80::2AA:FF:FE28:9C5A is listening for multicast traffic at the solicited-node address FF02::1:FF28:9C5A. For interfaces that correspond to a physical network adapter, it has registered the corresponding multicast address with the network adapter.</li>
</ol>
<p>As shown in this example, by using the solicited-node multicast address, address resolution that commonly occurs on a link can occur without disturbing all network nodes. In fact, very few nodes are disturbed during address resolution. Because of the relationship between the network interface MAC address, the IPv6 interface ID, and the solicited-node address, in practice, the solicited-node address acts as a pseudo-unicast address for efficient address resolution.</p></blockquote>
<h1>tcpdump tip</h1>
<p>Here&#8217;s a useful one, to tcpdump only NAs and NSs:</p>
<pre>tcpdump -v -i eth0 ip6[40] == 135 or ip6[40] == 136</pre>
<h1>Ugly, ugly&#8230;</h1>
<p>So turns out that, to the very best of my ability to discover, IPv6 sockets do not let me pick up any and all ICMP sent to the interface(s). If it&#8217;s to a multicast address, I must join the group beforehand. Which I cannot do. I have to say it&#8217;s a pretty glaring omission, IMHO. It&#8217;s &#8220;glaring&#8221; not maybe in the general case, but given IPv6 uses &#8220;unique multicast&#8221; addresses for Neighbor Solicitations, to not provide an IP-socket-level mechanism for receiving them is pretty crap.</p>
<p>So I assume I&#8217;m going to have to instead receive on a simple Packet level socket, and build a packet filter on it.</p>
<h1>Packet filters</h1>
<p>The more I look at it, the more it seems that until the IPv6 socket API expands, I&#8217;m going down this path. Easy enough to create a null filter. Done. 2 mins work. <img src='http://www.ipsidixit.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Now to get to grips with the BSD packet Filter VM language to actually write the filter. I know that, in general, BSD-PF semantics for IPv6 are problematic&#8230; However I should be OK here, as I am just interested in IPv6 ICMP &#8211; I think that should be a straightforward enough packet dissect.</p>
<p>Update: 1 July BSD PF VM syntax. Wow. Kinda funky, but now almost makes sense. Hope to have a working ICMP6 packet filter working soon!!</p>
<h1>3 July</h1>
<p>Yes. Can now reliably capture ALL ICMP neighbor solcitations on my gateway box. Now working on restoring the functionality lost by not having the socket feed us ICMP &#8211; since we now get a raw packets we must work a bit harder to find out who sent it, interface, etc. &#8211; the pktinfo mechanism is not available to us (well, the mechanism itself is, but the context make the information is supplies not useful) so we must do that manually. So lost of casting away of IPv6 headers and so forth!</p>
<p>&nbsp;</p>
<h1>Multicast&#8230;</h1>
<p>During development, so far I&#8217;ve almost always had tcpdump running on my WAN interface while testing code. Today was not running it and noted, much to my confusion, that the daemon saw NO multicast neighbor solicitations.Makes sense: tcpdump sets the interface to promiscuous mode. So we see everything. Since many of the NSs are multicast, if we haven&#8217;t signed up to the multicast group (as per above ad nauseam, we can&#8217;t&#8230;) we don&#8217;t see them at the packet filter level.</p>
<p>For now (and maybe for ever!) the compromise is that the interface has the ALLMULTI flag set on it. Setting PROMISC permanently would be a touch too ugly, but I think nominally receiving all multicast is acceptable. In these days of switched point-to-point Ethernet, all of this gets fairly academic anyway, as being in effect now a non-shared medium in so many instances the &#8220;extra&#8221; traffic handled by setting PROMISC is low-to-zero. But anyway, the Linux interface option of ALLMULTI is just fine.</p>
<p>In fact when I found out about the ALLMULTI interface flag, I even wondered if it would let my original design of having an ICMP6 socket open would now work&#8230; But no &#8211; even in full PROMISC mode the OCMP6-level socket does not receive multicast unless the socket has explicitly joined the specific group first.</p>
<h1>RFC time</h1>
<p>OK, so we can now kick out a Neighbor Advertisement in response to a Neighbor Solicitation received on the multicast group address. Cool.</p>
<p>Now to pay attention to the nature of it. As per the RFC 2461:</p>
<pre style="padding-left: 30px;">A node sends a Neighbor Advertisement in response to a valid Neighbor
   Solicitation targeting one of the node's assigned addresses.  The
   Target Address of the advertisement is copied from the Target Address
   of the solicitation.  If the solicitation's IP Destination Address is
   not a multicast address, the Target Link-Layer Address option MAY be
   omitted; the neighboring node's cached value must already be current
   in order for the solicitation to have been received.  If the
   solicitation's IP Destination Address is a multicast address, the
   Target Link-Layer option MUST be included in the advertisement.
   Furthermore, if the node is a router, it MUST set the Router flag to
   one; otherwise it MUST set the flag to zero.</pre>
<p>Soooooooooo, given all of that, the simplest logic will be to set Destination Link-Layer option for all our NAs.</p>
<p>&nbsp;</p>
<h1>11 August 2011</h1>
<p>Haven&#8217;t updated this for a while &#8211; as the project has really taken off and is now living in its own right!!! Mt post at <a href="http://www.ipsidixit.net/2011/08/04/npd6/">http://www.ipsidixit.net/2011/08/04/npd6/</a> indicates where it&#8217;s at and how to obtain it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2011/06/08/npd6-design-document/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Content filtering in a home network</title>
		<link>http://www.ipsidixit.net/2011/02/07/content-filtering-in-a-home-network/</link>
		<comments>http://www.ipsidixit.net/2011/02/07/content-filtering-in-a-home-network/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 11:04:23 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[nslookup]]></category>
		<category><![CDATA[opendns]]></category>
		<category><![CDATA[shorewall]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=425</guid>
		<description><![CDATA[<p>With two young children starting to make increasing use of the Internet, my attention has turned in recent times to the thorny subject of Content Filtering. This posting is actually going to look at a technical approach I settled upon, however one cannot help mentioning, at least in passing, some of the wider issues [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ipsidixit.net/wp-content/2011/02/footer_logo.gif"><img class="size-full wp-image-447 alignleft" style="margin-left: 50px; margin-right: 50px; margin-top: 30px; margin-bottom: 30px;" title="opendns_logo" src="http://www.ipsidixit.net/wp-content/2011/02/footer_logo.gif" alt="" width="100" height="40" /></a>With two young children starting to make increasing use of the Internet, my attention has turned in recent times to the thorny subject of Content Filtering. This posting is actually going to look at a technical approach I settled upon, however one cannot help mentioning, at least in passing, some of the wider issues involved.</p>
<p>As a parent I do not believe in raising children in some sort of bubble, totally devoid of anything that could possibly &#8220;harm&#8221; them. That applies to the Internet too &#8211; my hope is to raise children who are able to understand and deal with things, rather than require protection from them. To that end, Internet access for my children involves their parents first and foremost! They use a laptop, after asking permission, in the kitchen, in view of everyone else. I&#8217;m interested in what they are doing on it (genuinely so, not as some excuse to snoop!) and they want me to help and guide them. Email? Sure, make full use of it. But all emails sent to your address also get forwarded to me too guys&#8230; Why? So I can see what you&#8217;re receiving! Very open. Very honest. Nothing underhand. Those are the rules in this house.</p>
<p>And that approach actually covers probably 90% of what is required. However there&#8217;s still a small part that needs attention. As most adults know, there&#8217;s some weird stuff in some corners of the Internet. <em>Really</em> weird. <em>Disturbingly</em> weird. Stuff which I do not want my young children to see, even if accidentally. Being a very liberal sort, and totally anti-censorship with regard to what consenting adults view, I do not support any move to remove such stuff from the Internet. Weird, sick, depraved, whatever&#8230; Some of it may not be at all nice, but it&#8217;s there and it can be found. I just don&#8217;t want young children to accidentally find it. So what is a network engineer father to do&#8230;?</p>
<h1>Content filtering &#8211; 4 approaches</h1>
<p>Broadly speaking there are four way of approaching content filtering in the home environment:</p>
<ul>
<li>Workstation filtering</li>
<li>Network filtering</li>
<li>ISP filtering</li>
<li>DNS blocking</li>
</ul>
<p><span id="more-425"></span>The first three are all variations on the same theme. They vary in terms of the &#8220;Where do you do it?&#8221;</p>
<h2>Workstation</h2>
<p>There are many software packages out there which will filter content locally on the PC being used to browse the web. In a similar manner to that used by the more familiar virus detection software, one can purchase and run content filtering software which aims to identify and block various categories of content. The difficulty faced with this approach is that it&#8217;s not at all easy to identify what to block! Just to take the most obvious candidate category for blocking: pornography. The software can, and will, have lists of the names of the popular, known web-sites with porn. And with some enormous proportion of the Internet being porn, that will already be a long long list! Then we have the challenge of the fact that every day goodness knows how many hundreds of new porn sites will appear, and old ones disappear. The list of sites cannot be fully up to date. So the software will also need to include elements of heuristic detection: identifying porn indirectly and blocking it. So we&#8217;re now into looking and scanning all the traffic to and fro for words or patterns which might identify it as porn.  And so on. It&#8217;s a computationally intensive exercise, and requires frequent updating with new lists of patterns, URLs, IP addresses and so on.</p>
<p>The task is very similar to virus detection, with the frequent updates required, slowing down of communication to an extent, higher CPU usage, and so on.</p>
<p>The software out there is worth consideration for some &#8211; I&#8217;m not saying it&#8217;s a bad approach. But it has unavoidable limitations. Two obvious ones which apply to me are:</p>
<ul>
<li>Locked to a particular PC &#8211; If I install the software on one PC, then I cannot let the kids use another PC as it will be unprotected, unless I pay for and install the software there too.</li>
<li>Linux. A big issue for me is that we only have a single Windows PC in the house (hooray!) All the others (too many&#8230; way too many&#8230;) including that used by the children, run Linux. And such packages are few and far between for Linux&#8230;</li>
</ul>
<h2>Home network</h2>
<p>An approach I used for a while, with success, was to filter on the gateway device on my network. A quick summary here: at home my Internet connection terminates on a gateway firewall/router system. This system performs all manner of network-related functions. The key one is to run my Linux-based firewall. A host of other jobs get handled by this box too: VPN termination, media serving, DHCP, IPv6 routing, the list is long. Given that all of our Internet traffic traverses this system it is ideally suited to perform a filtering function.</p>
<p>To that end, for a while I ran <a href="http://www.dansguardian.org/" target="_blank">Dans Guardian</a> on my firewall. This is a sophisticated bit of software, and not entirely trivial to set up and get working. Apart from quite a lot of configuration itself, it also requires a web-proxy to be running on the firewall. I ran <a href="http://www.squid-cache.org/">squid</a> to fulfil that requirement. And then there&#8217;s the requirement to &#8220;hook&#8221; users into it. That involves either configuring the workstation to use a designated web proxy (and possible authentication required there &#8211; depends upon what exactly you want to achieve) or using IPTables on the firewall to intercept traffic from a given workstation and force it via the proxy. Various approaches, all quite interesting, but only if you find networks interesting&#8230; Many would find it simply &#8220;complicated&#8221;.</p>
<p>Once up and running, however, there are then further challenges to be faced. Firstly there&#8217;s the question of overhead. That is, how much load does it place on the gateway device, and hence how much delay or slowness does it introduce to the web browsing. My kids may not need the snappiest, lightening fast response times possible, but nor do they want to wait tens of seconds to see a page, or have some You Tube video constantly stop and start. Let me be clear here (and make sure I&#8217;m fair to Dans Guardian): if the device running it is powerful (in terms of CPU, memory, disk and so on) then it&#8217;s great. Really good. Trouble is, however, that a lot of boxes used as gateway routers/firewalls are not, by their nature, so highly specified. And that applied to me. My installation was, frankly, not fast enough. Much of the time it would work OK-ish, but often there would be very long delays indeed.</p>
<p>If you have a powerful box you can dedicate to such filtering, then do go ahead and consider it.</p>
<p>On other issue I also had to tackle was that of updates: as described for the Workstation solution, filtering software, wherever it is located, needs to be kept up to date. Dans Guardian does not come with an update mechanism, nor source of updates. There are sources of such updates out there if you search, but again, it&#8217;s an extra piece of work to do this and get it all set up correctly, auto updating silently every day.  As before, not a criticism of the software that has been made freely available &#8211; but something that does need to be taken in to account.</p>
<h2>ISP</h2>
<p>Many ISPs offer a filtering service to their customers. This is of course attractive, as it entirely removes the need to perform the filtering and blocking locally to the home network. The work is offloaded to the ISP. While there may be a charge associated with this, it may be worth considering. The main, and maybe for many significant, disadvantage to it is the all-or-nothing approach. If you have many PCs (and hence different users) within the home network, you may only want to block certain stuff from certain PCs. I may not want my kids viewing<em> DominatrixFrenchMaids.com, </em>but (purely for research purposes, of course) their father may need to. (God knows, such a site probably exists, but I dare not look&#8230;) More realistically, there are other sites which are more genuinely OK for adults, but not for young children. If one has an interest in 20th Century history, a sad reflection on humankind is that there are some horrible things which can be seen&#8230; For older children and adults, that&#8217;s fine and indeed educational. But not below a certain age. I&#8217;d like to maintain the illusion of a nice world for at least a little while longer.</p>
<p>So ISP filtering is attractive in terms of removing the work from the home. But it does come, in general, with a certain amount of inflexibility.</p>
<h2>DNS blocking</h2>
<p>This last technique is somewhat different from the others. Most people have at least some awareness that the names we use on the Internet (www.ipsidixit.net) actually map on to so-called IP addresses. For example www.ipsidixit.net is mapped via a DNS (Domain Name Service) to the IP address 217.70.191.54 (And to IPv6 2001:4b98:dc0:41:216:3eff:feaa:964a &#8211; I&#8217;m soooo hip and trendy&#8230;)</p>
<p>Yet no one in their right mind (nor even a network engineer) bothers with the numerical version. You just bang in the name and have your computer us DNS to resolve it to an IP address.</p>
<p>Most PCs will use one or more DNS devices specified and operated by their ISP. Used &#8220;normally, for example, my ISP (free.fr) provides two DNS systems for workstations to use.</p>
<p>However one does not need to use their suggestions. One can, in general, use other DNSs operated by third-parties.</p>
<p>The point is, then, that if one used a DNS service which had a constantly updated blacklist of sites which are &#8220;undesirable&#8221;, one could block access to them by simply declining to resolve them to their correct address. This then offers the benefits of ISP Blocking in so far as the load of shifted outside of the home network, but with the added flexibility that only workstations that require protection need use the &#8220;filtering&#8221; DNS. Other workstations can use the normal DNS.</p>
<p>I found that <a href="http://www.opendns.com/">OpenDNS</a> provide such a service, and have stated to make use of it. It&#8217;s free (they have some paid options too &#8211; but the free one seems fine for me) I have no association with OpenDNS, and am only &#8220;promoting&#8221; them as what they offer seems neat and useful. If others have knowledge of other similar services, please do post them in a comment &#8211; I&#8217;m not trying to make this exclusive to OpenDNS! In fact I&#8217;d like to compare OpenDNS to some others.</p>
<p>The service they offer is to provide DNS addresses which can have a selectable level of filtering applied. The spectrum is covered, from porn, violence, drug use, etc. through to shopping sites, social networking sites, etc. You get to choose which categories to block and which to allow.</p>
<p>And it does seem to work really rather well indeed. Below I am going to detail how I set it up within my network, integrating it within the DNS caching system already used.</p>
<p>The main weakness of the system is that with some knowledge and effort it can be circumvented (as, of course, can most systems) One could take the trouble to manually find the Name &lt;&#8211;&gt; IP mapping for a domain and enter that directly into a browser, thereby bypassing the DNS. However such a bypass would be very cumbersome to use, since even if you use an IP to land on a page, probably any link off that page will in turn require DNS, and would then need to be manually decoded, etc. Workable, but hard work. By the time my kids are knowledgeable enough to work all that out, they will probably be old enough to look after themselves!</p>
<h1>Integrating OpenDNS into a Linux firewall, already running DNSMasq</h1>
<p>My home network has <a href="http://www.thekelleys.org.uk/dnsmasq/doc.html">DNSMasq</a> running on a central gateway/server/firewall box. DNSMasq is responsible for DHCP (i.e. allocating IP addresses on my home network) and also DNS caching. To that end, it announces, via DHCP, that it  is the DHCP server to be used by devices. Then it, in turn, resolves addresses via the ISP-supplied DNSs. It caches then DNS lookups locally.</p>
<p>In the DHCP configuration it has a pool of addresses available for any device to use, but most of the devices on the network have pre-allocated addressees reserved for them within the DNSMasq configuration. These are allocated based upon the Ethernet MAC address of a device. This is a very common technique to use with DHCP.</p>
<p>Given that, where now a device will be handed an IP address and the address of a DNS server to use (where that DNS server will actually be the same as the DNSMasq device itself) we want to change the config so that for certain devices (the childrens&#8217; PC) when an IP address is handed out it will instead be given with the DNS addresses of the OpenDNS filtering systems. Then all DNS requests from that PC will no longer be locally forwarded to the gateway device, but will instead be routed out externally to OpenDNS, where they can be answered or blocked as appropriate.</p>
<p>The DNSMasq config to achieve this is slightly fiddly, so I am providing it here more or less in its entirety (a few names omitted and some light obfuscation of MACs etc.), but only highlighting the parts that particularly pertain to the OpenDNS filtering setup.</p>
<pre style="padding-left: 30px;"># Configuration file for dnsmasq.
domain-needed
resolv-file=/etc/resolv.conf
no-resolv
no-poll

# Add other name servers here, with domain specs if they are for
# non-public domains.
server=/localnet/192.168.0.22</pre>
<pre style="padding-left: 30px;"><strong><em><span style="color: #ff6600;">This part is not related to OpenDNS in any way: I don't use my ISP's DNS for normal use - I instead use Google's Public DNS.
</span></em># Google Public DNS servers
server=8.8.8.8
server=8.8.4.4</strong>

# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/localnet/

interface=eth1
expand-hosts
domain=localnet

# For general purpose use, use this range.
dhcp-range=192.168.0.128,192.168.0.160,12h</pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff6600;">This is for OpenDNS. We use the dhcp-mac config to tag these special devices for filtering:
</span># MAC list for openDNS filtering
dhcp-mac=opendns,00:c0:9f:12:34:56	# Laptop on-board
dhcp-mac=opendns,00:90:4b:12:34:56	# Laptop wifi</strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff6600;">Here we're back for normal dhcp-host preallocation for known unfiltered devices:
</span></strong># Most ip addresses are pre-allocated here
dhcp-host=00:50:ba:12:34:56,aname,192.168.0.2,720m
dhcp-host=00:18:8B:12:34:56,anothername,192.168.0.3,5m
dhcp-host=00:90:4b:12:34:56,laptop_wifi,192.168.0.4,720m
dhcp-host=00:26:37:12:34:56,galaxy,192.168.0.5,60m
dhcp-host=00:18:41:12:34:56,magic,192.168.0.6,60m
dhcp-host=00:26:82:12:34:56,eva9150,192.168.0.7,720m
dhcp-host=00:c0:9f:12:34:56,laptop_eth,192.168.0.8,720m
dhcp-host=00:14:29:12:34:56,camera,192.168.0.10,120m
dhcp-host=00:21:5A:12:34:56,printer,192.168.0.11,720m
dhcp-host=00:40:63:12:34:56,aservername,192.168.0.22,infinitem</pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff6600;">The devices tagged "opendns" above here get special DHCP options pointing them to the OpenDNS filtering-servers.
</span># OpenDNS content filtering servers
# Specify the two OpenDNS first, then ourselves third for local stuff
dhcp-option=opendns,6,208.67.222.222,208.67.220.220,192.168.0.22</strong></pre>
<pre style="padding-left: 30px;"><strong><span style="color: #ff6600;">Note also the "192.169.0.22" on the end - this is optional, if you still want the filtered devices to be able to resolve local names.
</span></strong>
dhcp-authoritative
cache-size=150
clear-on-reload</pre>
<p>Anyone who has an existing DNSMasq configuration should find the above more than enough to change it to point arbitrary devices at the OpenDNS systems.</p>
<h1>Summary</h1>
<p>Nothing, but nothing, replaces a conscientious adult supervising, guiding and helping get to grips with the Internet. However even with that it&#8217;s still all too easy for some stuff to pop up which is better left hidden! This article highlight some of the general technical approaches one can take, and in particular that of DNS filtering with a service such as OpenDNS, optionally using a Linux device to semi-automatically allocate filtering to some device but not others.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2011/02/07/content-filtering-in-a-home-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenVPN over IPv6</title>
		<link>http://www.ipsidixit.net/2010/06/21/openvpn-over-ipv6/</link>
		<comments>http://www.ipsidixit.net/2010/06/21/openvpn-over-ipv6/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 12:38:09 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[ethernet]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=313</guid>
		<description><![CDATA[<p>Previous articles have detailed various aspects of getting IPv6 running on a home-gateway router. The aim is to migrate as much as possible towards an IPv6-only situation.</p> <p>Here I cover the steps required to implement a simple point-to-point OpenVPN (SSL) VPN tunnel using PSK over IPv6 infrastructure.</p> <p>One key element for me is to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png"><img class="size-full wp-image-227 alignleft" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" /></a>Previous articles have detailed various aspects of getting IPv6 running on a home-gateway router. The aim is to migrate as much as possible towards an IPv6-only situation.</p>
<p>Here I cover the steps required to implement a simple point-to-point OpenVPN (SSL) VPN tunnel using PSK over IPv6 infrastructure.</p>
<p>One key element for me is to migrate my VPN connection to a remote host I own off IPv4 and entirely onto IPv6. This was not entirely straightforward! In fact it took hours and hours of research and experimentation to get this working. The <em>eventual</em> config required is not so mind-boggling. But getting there was tricky. As I&#8217;ve found out so many times before with regard to IPv6, the building bricks are lying around, but there are very few sources of information to help you stack them up. Once the steps are laid out, as you&#8217;ll see below, it&#8217;s actually pretty easy.</p>
<h2>Migrating from <em>what</em> to OpenVPN IPv6?</h2>
<p>We&#8217;re going to migrate an IPv4 OpenVPN point-to-point PSK VPN tunnel on Linux to an equivalent on native IPv6 infrastructure. We&#8217;re not trying to have an IPv4 tunnel over IPv6, nor an IPv6 tunnel over IPv4 (both of which are possible and useful in different situations). Here I aim to have an IPv6 OpenVPN SSL tunnel over pure IPv6 infrastructure.</p>
<p>My current VPN set up is:</p>
<ul>
<li>Home gateway running Ubuntu 10.04 (Lucid)</li>
<li>Remote host running the same</li>
<li>Fixed public IPv4 and IPv6 (global) addresses on each.</li>
<li>OpenVPN point-to-point tunnel between them.</li>
<li>Simple PSK authentication.</li>
<li>Shorewall config as appropriate to OpenVPN.</li>
</ul>
<p>To put some detail on it, there is a standard build of OpenVPN installed, with a config file such as <em>/etc/openvpn/otherhost.conf</em>:</p>
<p><span id="more-313"></span></p>
<p><code> </code></p>
<p><code> </code></p>
<p><code> </code></p>
<p><code></p>
<div id="_mcePaste" style="padding-left: 30px;">remote <em>&lt;IPv4 address of the other host&gt;</em></div>
<div id="_mcePaste" style="padding-left: 30px;">dev tun</div>
<div id="_mcePaste" style="padding-left: 30px;">ifconfig 192.168.2.22 192.168.2.1</div>
<div id="_mcePaste" style="padding-left: 30px;">secret topsecret.psk</div>
<div id="_mcePaste" style="padding-left: 30px;">comp-lzo</div>
<div id="_mcePaste" style="padding-left: 30px;">keepalive 60 180</div>
<div id="_mcePaste" style="padding-left: 30px;">ping-timer-rem</div>
<div id="_mcePaste" style="padding-left: 30px;">persist-tun</div>
<div id="_mcePaste" style="padding-left: 30px;">persist-key</div>
<div id="_mcePaste" style="padding-left: 30px;">user nobody</div>
<div id="_mcePaste" style="padding-left: 30px;">group nogroup</div>
<div id="_mcePaste" style="padding-left: 30px;">daemon</div>
<p></code></p>
<p>At the other host we&#8217;ve a similar config, without the &#8220;remote &lt;address&gt;&#8221; part, and with the VPN addresses specified by the ifconfig flipped around.</p>
<p>This all works a treat. It&#8217;s about as plain an OpenVPN config as you could really get &#8211; a simple point to point tunnel using private IPv4 addressing.</p>
<h2>OpenVPN and IPv6</h2>
<p>This is really where things go all over the place. My starting point was <a href="http://openvpn.net/index.php/open-source/faq.html" target="_blank">over at the OpenVPN site</a>, looking for details on IPv6. I found that:</p>
<p><span style="font-family: Arial, Helvetica, sans-serif; line-height: normal; font-size: 12px; color: #003366;"> </span></p>
<blockquote>
<h2 style="font-size: 16px;">Is IPv6 support planned/in the works?</h2>
<p>Currently, there&#8217;s limited support for IPv6.</p>
<p>Point-to-point IPv6 tunnels are supported on OSes which have IPv6 TUN driver support (this includes Linux and the BSDs). IPv6 over TAP is always supported as is any other protocol which can run over Ethernet.</p>
<p>When OpenVPN 2.0 is run in server mode, IPv6 is currently only supported in TAP mode, not TUN mode (Server mode IPv6 TUN support will likely be added post-2.0).</p>
<p>The VPN carrier connection must currently use IPv4 endpoints, however there&#8217;s a patch which can be found in the openvpn-devel archives which adds IPv6 support. This patch will probably be merged into the mainline post-2.0.</p></blockquote>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #000000; font-size: small;"><span style="line-height: 19px;">So just what do we conclude from that? It says that point-to-point works with the TUN driver. But I couldn&#8217;t find any useful information about <em>how</em> to set it up.</span></span></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #000000; font-size: small;"><span style="line-height: 19px;">Researching further, I find that the version of OpenVPN we&#8217;re using with Ubuntu (which is the latest) has very limited IPv6 support indeed. Indeed somewhat less than the OpenVPN web-site led me to believe! Now it may well be that the problem is my inability to understand the nuances of what the OpenVPN folks are saying. But I sure couldn&#8217;t get it working with the installed, standard version.</span></span></p>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #000000; font-size: small;"><span style="line-height: 19px;">So I then find a lot <a href="http://www.greenie.net/ipv6/openvpn.html" target="_blank">more information here</a>, which strongly suggests that I need to use a special IPv6 payload patch to achieve what I want to achieve. Specifically it says:</span></span></p>
<blockquote><p><span style="color: #000000; font-family: 'Times New Roman'; font-size: small;">in point-to-point TUN mode, OpenVPN can transport IPv6 packets with the &#8211;tun-ipv6 option. No support for configuring the IPv6 endpoints and routes from within OpenVPN either, you need to run external &#8220;up&#8221; scripts.</span></p></blockquote>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; color: #000000; font-size: small;"><span style="line-height: 19px;">That implies that I could use the unpatched OpenVPN and then manual scripts. As we&#8217;ll see below, in fact I had to use the patched version <em>and</em> external scripts! Again, likely due to a lack of knowledge on my part. But as a network engineer, I figure if I can&#8217;t work it all out then others will be in the same predicament.</span></span></p>
<h2>VPN addressing</h2>
<p>With IPv6, as discussed previously, the whole notion of private and public is done away with. Or at least, the meaning is seriously changed. Since we no longer have NAT in IPv6 (due to the address space being so very large) we do not have private address ranges for use inside a NATted network. So when choosing IPv6 addresses to use on our VPN it would seem that we can use any values. Well, yes and no. Back in IPv4 we could also have used any values too, while running the risk of accidentally using addresses which do really exist in the public Internet. So it is with IPv6, where we might collide with real addresses. It&#8217;s unlikely in these early days of IPv6, but we want to avoid it.</p>
<p>Another point to note, as with IPv4, is security. If VPN traffic inadvertently &#8221;leaks&#8221; out of a public interface (and this is easier to achieve than you might think, particularly when you are setting things up!) then it would be good to use addresses which any compliant adjacent router will simply drop as unroutable, rather than propagate them in to the wider world. Indeed this desire to avoid &#8220;leaks&#8221; is also a reason to not simply use a chunk of IPv6 addresses out of your allocated pool. It&#8217;s not as if they are scarce &#8211; but mixing VPN addresses and public addresses so intimately is just asking for trouble. In a perfect world, then fine. But I do not live in that world. So an arbitrary addressing barrier betwen my VPN and the Internet is no bad thing.</p>
<p>So for this IPv6 VPN, we shall use so-called Unique Local Addresses, (<a href="http://www.ipsidixit.net/2010/02/24/228/">Over here I touched upon</a> Link Local addresses which are, as the name suggests, valid only within a single network.) as per RFC 4193. The history of all this is damn messy, but the bottom line is you should choose addresses in the range fd00::/8. So I will, merrily ignoring all the rest of RFC 4193, with its try-and-make-it-random stuff, use the following:</p>
<ul>
<li>fd22::22 &#8211; the gateway device</li>
<li>fd22::1 &#8211; the remote host</li>
</ul>
<h2>What does good look like</h2>
<p>What&#8217;s our definition of a working IPv6 VPN? How will I know when &#8220;it&#8217;s working&#8221;? My criteria include:</p>
<ul>
<li>if I do an ifconfig I see a discrete VPN interface.</li>
<li>I can ping6 from one host to another.</li>
<li>during a ping6 I can tcpdump the tunnel interface and see clear traffic.</li>
<li>during a ping6 I can tcpdump the real WAN interface and see encrypted traffic.</li>
</ul>
<h2>Install a patched OpenVPN</h2>
<p>As mentioned in the introduction, I ended up using a patched OpenVPN. I still believe that, based upon what the OpenVPN website says that this should not be required! But I ended up doing it. If you trust the use of a pre-built binary (I did) then it&#8217;s actually pretty easy to install. Bearing in mind that the system being used are running Ubuntu Lucid, follow these steps and you should be good to go:</p>
<ul>
<li>Go to <a href="http://www.greenie.net/ipv6/openvpn.html">this page</a> and have a bit of a read.</li>
<li>Towards the bottom, you should find a link that takes you to <a href="https://launchpad.net/~berni/+archive/ipv6">this page</a>.</li>
<li>At the time of writing, this page only has builds for Intrepid and Karmic. And we&#8217;re Lucid. But fear not, and assume Karmic is correct&#8230;</li>
<li>As per the instructions, add the repository and signing key as per karmic.</li>
<li>Then perform the usual apt-get update followed either by a apt-get install openvpn or just a apt-get upgrade if openvpn was already installed.</li>
</ul>
<p>And you should be all set with the required version.</p>
<h2>Ancillary config</h2>
<p>I&#8217;m just going to cover the IPv6-specific OpenVPN config file. I&#8217;m not going to go in to every last detail required &#8220;around the edges&#8221;. Just a few reminders:</p>
<ul>
<li>You will point to your new IPv6 OpenVPN config from /etc/default/openvpn</li>
<li>You need to add the required config, just as for IPv4, to your shorewall6 config.</li>
</ul>
<h2>Core config</h2>
<p>Here we get to the details. The configs used will actually be very similar to the IPv4 versions, with obvious changes for IPv6.</p>
<p>I&#8217;ll say again: I simply do not understand why the config has to be this way. Based upon the documents and info above, I should be able to put this all neatly within the OpenVPN config. But I could not, and hence the configs below reference simple &#8216;helper&#8217; script to bring the tunnel up correctly.<br />
Here is the config for the home gateway device:</p>
<p style="padding-left: 30px;"><code> local local6address_as_per_hosts_file<br />
remote remote6address_as_per_hosts_file</code></p>
<p style="padding-left: 30px;"><code># Local and remote unique-local addresses<br />
ifconfig-ipv6   fd22::22 fd22::1<br />
# Allow external script to be run<br />
script-security 2<br />
# Script to do the rest of the work...<br />
up /etc/openvpn/helper.up</code></p>
<p style="padding-left: 30px;"><code>proto udp6<br />
dev tun<br />
tun-ipv6<br />
secret topsecret.psk<br />
comp-lzo<br />
keepalive 60 180<br />
ping-timer-rem<br />
persist-tun<br />
persist-key<br />
user root<br />
group root<br />
daemon<br />
</code></p>
<p>And here is the referenced helper script helper.up:</p>
<p style="padding-left: 30px;"><code> #!/bin/bash<br />
ip -6 link set tun0 up<br />
ip -6 addr add fd22::22 dev tun0<br />
ip -6 route add fd22::1 dev tun0<br />
</code></p>
<div>(And remember to make the script executable)</div>
<p>And here&#8217;s one for the remote server:</p>
<p style="padding-left: 30px;"><code> # Local and remote addresses<br />
ifconfig-ipv6 fd22::1 fd22::22</code></p>
<p style="padding-left: 30px;"><code># Allow external script to be run<br />
script-security 2<br />
# Script to do the rest of the work...<br />
up /etc/openvpn/helper.up<br />
proto udp6<br />
dev tun<br />
tun-ipv6<br />
secret supersecret.psk<br />
comp-lzo<br />
keepalive 60 180<br />
ping-timer-rem<br />
persist-tun<br />
persist-key<br />
user nobody<br />
group nogroup<br />
daemon</code></p>
<div>And the helper.up for that one is:</div>
<p style="padding-left: 30px;"><code> #!/bin/bash<br />
ip -6 link set tun0 up<br />
ip -6 addr add fd22::1 dev tun0<br />
ip -6 route add fd22::22 dev tun0<br />
</code></p>
<div>Again, make sure it&#8217;s executable.</div>
<p>Note that each makes use of names, where posible, rather than IPv6 addresses, which have been added to /etc/hosts to make everything easier to read and less prone to typos!</p>
<h2>Static addressing</h2>
<p>Yes, the addressing scheme is kinda static, I know. I wanted to keep this as simple as possible (which already isn&#8217;t so very simple&#8230;) and have everything point-to-point, with all routing being host-specific routing, rather than ranges. The obvious way to slightly adapt this is to allocate two IPv6 subnets within the unique-local adresses being used, and then of course adapt the helper scripts to add the route for the subnets rather than the specific hosts. I&#8217;m sure anyone who has got this far can make that change.</p>
<h2>Success!</h2>
<p>That&#8217;s about all that&#8217;s required. With the above config in place and the firewall set up correctly an ifconfig on the home router returns:</p>
<div style="padding-left: 30px;"><code>tun0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00</code></div>
<div style="padding-left: 90px;"><code>inet6 addr: fd22::22/128 Scope:Global<br />
UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1<br />
RX packets:44 errors:0 dropped:0 overruns:0 frame:0<br />
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0<br />
collisions:0 txqueuelen:100<br />
RX bytes:4576 (4.5 KB)  TX bytes:4576 (4.5 KB)</code></div>
<div></div>
<div>and the routing table shows two new entries:</div>
<p><code></p>
<div style="padding-left: 30px;">fd22::1 dev tun0  metric 1024  mtu 1500 advmss 1440 hoplimit 0</div>
<div style="padding-left: 30px;">fd22::22 dev tun0  proto kernel  metric 256  mtu 1500 advmss 1440 hoplimit 0</div>
<p></code></p>
<div>And if I ping6 the other VPN address I get a response! Checking with tcpdump directly on the virtual tun0 interface I see meaningful ping-like traffic. While a similar scoping of the bearer interface, eth0, shows me the expected random-looking traffic (i.e. my highly sophisticated test for &#8220;Yes, it&#8217;s encrypted&#8221;!)</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2010/06/21/openvpn-over-ipv6/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IPv6 and DNS</title>
		<link>http://www.ipsidixit.net/2010/04/02/243/</link>
		<comments>http://www.ipsidixit.net/2010/04/02/243/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 08:33:37 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ndisc6]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[nslookup]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[rdisc6]]></category>
		<category><![CDATA[rdnss]]></category>
		<category><![CDATA[rdnssd]]></category>
		<category><![CDATA[tcpdump]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/2010/04/02/243/</guid>
		<description><![CDATA[<p>IPv6 DNS &#8211; It works for me&#8230;.. but it shouldn&#8217;t.</p> <p>When in my IPv6 environment I perform a test ping to, say, Google, it seems to work great:</p> ping6 ipv6.google.com PING ipv6.google.com(2a00:1450:8006::6a) 56 data bytes 64 bytes from 2a00:1450:8006::6a: icmp_seq=1 ttl=55 time=49.3 ms 64 bytes from 2a00:1450:8006::6a: icmp_seq=2 ttl=55 time=44.6 ms . . . [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" />IPv6 DNS &#8211; It works for me&#8230;.. but it shouldn&#8217;t.</p>
<p>When in my IPv6 environment I perform a test ping to, say, Google, it seems to work great:</p>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">ping6 ipv6.google.com</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">PING ipv6.google.com(2a00:1450:8006::6a) 56 data bytes</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">64 bytes from 2a00:1450:8006::6a: icmp_seq=1 ttl=55 time=49.3 ms</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">64 bytes from 2a00:1450:8006::6a: icmp_seq=2 ttl=55 time=44.6 ms</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">.</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">.</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">.</span></div>
<p>Which is lovely. But I then ask myself how the ping6 command actually gets to know that name ipv6.google.com lives at IPv6 global address 2a00:1450:8006::6a. How is the domain name being resolved? And I find that I actually don&#8217;t know. I&#8217;m perfectly familiar with IPv4 DNS. So what&#8217;s going on here?</p>
<h2>I&#8217;m cheating</h2>
<p>I discover, upon investigation, that in fact I&#8217;m &#8220;cheating&#8221;. By that I mean that my attempt to set up a &#8220;pure&#8221; IPv6 environment (albeit in parallel with IPv4) that does not rely upon or touch IPv4 in any way has not been achieved &#8211; It turns out that my DNS is currently entirely dependent upon the existing IPv4 infrastructure! And before going ahead and trying to rectify that, it&#8217;s actually rather educational to understand how it is actually working at all.</p>
<p><span id="more-243"></span>So I run tcpdump on the IPv6 interface and take a look at what&#8217;s going on when I kick off the <em>ping6</em>:</p>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">13:28:36.671682 IP (tos 0&#215;0, ttl 64, id 45341, offset 0, flags [DF], proto UDP (17), length 61)</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> 11.11.11.11.48231 &gt; 212.XXX.XXX.XXX: [udp sum ok] 8831+ AAAA? ipv6.google.com. (33)</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">13:28:36.765503 IP (tos 0&#215;0, ttl 60, id 0, offset 0, flags [DF], proto UDP (17), length 250)</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> 212.XXX.XXX.XXX &gt; 11.11.11.11.48231: 8831 q: AAAA? ipv6.google.com. 7/0/0 ipv6.google.com. [1h49m54s] CNAME[|domain]</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">13:28:36.767123 IP (tos 0&#215;0, ttl 64, id 45365, offset 0, flags [DF], proto UDP (17), length 118)</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> 11.11.11.11.56346 &gt; 212.XXX.XXX.XXX: 37833+[|domain]</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">13:28:37.042646 IP (tos 0&#215;0, ttl 60, id 0, offset 0, flags [DF], proto UDP (17), length 178)</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> 212.XXX.XXX.XXX &gt; 11.11.11.11.56346: 37833 NXDomain q:[|domain]</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">.</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">.</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">.</span></div>
<div>So what&#8217;s all that about then?</div>
<div>We appear to have a perfectly standard IPv4 exchange taking place, but with a few odd bits mixed in! Taking it a step at a time&#8230;..</div>
<ul>
<li>A DNS query (UDP &#8211; port 53 &#8211; IPv4 &#8211; standard stuff) goes out for <em>ipv6.google.com</em>. The odd looking bit is the DNS query type: &#8220;AAAA&#8221;. What&#8217;s that? That actually signifies that this is an IPv6 query. Special.</li>
<li>And sure enough we get a response from the IPv4 DNS. It does not decode it here, but in the CNAME response data is the full IPv6 address required.</li>
<li>In fact it returns, as DNS queries often do, more than one address. It returns a selection of 6 of them, of which one gets selected for use.</li>
<li>And we then get a rather odd repeating pattern of subsequent PTR resolution attempts, which is a bit confusing. We&#8217;ll ignore that bit for now.</li>
</ul>
<p>So: in fact our IPv6 DNS is running (with great success!) but&#8230;&#8230;&#8230;&#8230;. over an entirely IPv4 infrastructure.</p>
<p>It&#8217;s fabulous that it all works so easily and seamlessly. <img src='http://www.ipsidixit.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  However, for the purposes of my voyage in to IPv6, I&#8217;d actually rather not use the IPv4 side of things at all. What if IPv4 wasn&#8217;t available to me? So what to do?</p>
<h2>Pure IPv6 Name Resolution &#8211; IPv6 DNS</h2>
<p>So we want to shift the DNS function off IPv4 and to make use of the IPv6 infrastructure. Where to being? Well, since setting up all the IPv6 I had noticed some new bit &#8216;n bobs appearing in my logs, as you do with new things. And I&#8217;d mostly ignored them for now. Again, as you do. But this one was appearing rather regularly, and now seemed rather interesting&#8230;</p>
<pre style="padding-left: 30px;">Mar 30 09:45:30 xxxxx radvd[2351]: RDNSS address 2a01:e00::1 received on eth0 from fe80::207:cbff:fea5:XXX is not advertised by us</pre>
<p>What&#8217;s that all about? Looking at the elements:</p>
<p style="padding-left: 30px;">
<ul>
<li style="padding-left: 30px;"><em>eth0</em> is my external (Internet-facing) interface</li>
<li style="padding-left: 30px;">the <em>fe80:</em> address is the IPv6 <em>link</em> address of my adjacent router (i.e. the ISP&#8217;s IPv6 router)</li>
<li style="padding-left: 30px;"><em>2a01:e00::1</em> is a normalish looking IPv6 global address. And sometimes I see the same log with <em>2a01:e00::2</em> in it instead.</li>
<li style="padding-left: 30px;">The RDNSS rather gives it away! &#8220;DNS.&#8221; Is this to do with DNS perhaps&#8230;?</li>
<li style="padding-left: 30px;">&#8220;&#8230;is not advertised by us&#8221; &#8211; What&#8217;s that all about?</li>
</ul>
<p>&nbsp;</p>
<p>Grabbing the incoming packet that seems to generate these logs I see more when fully decoded. The packet concerned is an expected <em>Router Advertisement</em> (RA) but it has some options on it:</p>
<p style="padding-left: 30px;">
<ul>
<li style="padding-left: 30px;">Prefix Information: this we expect. It tells me the 64-bit prefix that is &#8220;mine&#8221; to use for global IPv6 addresses.</li>
<li style="padding-left: 30px;">Recursive DNS Server: woah! That acronymises as RDNSS. And it hands me two &#8220;Recursive DNS Servers&#8221;: <em>2a01:e00::1</em> and <em>::2</em>. So that&#8217;s where they come from.</li>
<li style="padding-left: 30px;">MTU: an MTU of 1480 is specified in there too. I see that in fact my interface MTU is 1500. Should I worry? perhaps yes. But I&#8217;ll leave that for now and come back to it.</li>
<li style="padding-left: 30px;">Source link-layer address: we can ignore that. <img src='http://www.ipsidixit.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ul>
<p>&nbsp;</p>
<h2>Manual test of IPv6 DNS</h2>
<p>Before jumping in to new software subsystems, let&#8217;s try a manual test and see what happens. Just as one can use nslookup on the command line to check name resolution for IPv4, so one can use it for IPv6 too. Specify the name to be resolved and the server to us (or else we will default as per /etc/resolv.conf) and see what happens, checking with tcpdump:</p>
<pre style="padding-left: 30px;"><span style="font-family: 'Courier New';"> </span><span style="font-size: medium;">nslookup ipv6.google.com 2a01:e00::1</span></pre>
<p>And I see the following packet sequence result:</p>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">10:23:43.522926 IP6 (hlim 64, next-header UDP (17) payload length: 41) 2a01:XXX:8b25:7ea0:240:63ff:fef5:f93c.52838 &gt; dns2.proxad.net.domain: [udp sum ok] 9362+ A? ipv6.google.com. (33)</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"><br />
</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">10:23:43.577684 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::207:cbff:fea5:XXX &gt; ff02::1:fff5:XXX: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2a01:XXX:8b25:7ea0:240:63ff:fef5:f93c</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> source link-address option (1), length 8 (1): 00:07:cb:a5:1a:68</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> 0&#215;0000:  0007 cba5 1a68</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"><br />
</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">10:23:43.577937 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) 2a01:XXX:8b25:7ea0:240:63ff:fef5:f93c &gt; fe80::207:cbff:fea5:XXX: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is 2a01:XXX:8b25:7ea0:240:63ff:fef5:f93c, Flags [router, solicited, override]</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> destination link-address option (2), length 8 (1): 00:40:63:f5:f9:3c</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"> 0&#215;0000:  0040 63f5 f93c</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';"><br />
</span></div>
<div style="padding-left: 30px;"><span style="font-family: 'Courier New';">10:23:43.578294 IP6 (hlim 60, next-header UDP (17) payload length: 112) dns2.proxad.net.domain &gt; 2a01:XXX:8b25:7ea0:240:63ff:fef5:f93c.52838: [udp sum ok] 9362 q: A? ipv6.google.com. 1/1/0 ipv6.google.com. [2h44m2s] CNAME ipv6.l.google.com. ns: l.google.com. [10m] SOA ns4.google.com. dns-admin.google.com. 1411041 900 900 1800 60 (104)</span></div>
<p>Key here are the first and fourth packets: DNS request out, and DNS response back. All in IPv6. No IPv4 there at all. That&#8217;s good. We can see our IPv6 DNS server and, in principle, they work.</p>
<h2>A secret &#8211; ndisc6</h2>
<p>Time to let you in on a little secret to make life much easier&#8230; While tcpdumps and so on are instructive up to a point, and force one to think a little about what is being seen, they are also pretty tedious. A lot of what we need to achieve here can be done using much more accessible tools! Do yourself a big favour and install the ndisc6 package on your linux system. The <a id="p49f" title="creator's web page" href="http://www.remlab.net/ndisc6/"><span style="color: #000000;">creator&#8217;s web page</span></a> gives you a little more information, but just as an example, look at this command + output:</p>
<div><span style="font-size: medium;"><strong>rdisc6  eth0</strong></span></div>
<div><span style="font-family: 'Courier New';">Soliciting ff02::2 (ff02::2) on eth0&#8230;</span></div>
<div><span style="font-family: 'Courier New';">Hop limit                 :           64 (      0&#215;40)</span></div>
<div><span style="font-family: 'Courier New';">Stateful address conf.    :           No</span></div>
<div><span style="font-family: 'Courier New';">Stateful other conf.      :           No</span></div>
<div><span style="font-family: 'Courier New';">Router preference         :       medium</span></div>
<div><span style="font-family: 'Courier New';">Router lifetime           :         1800 (0&#215;00000708) seconds</span></div>
<div><span style="font-family: 'Courier New';">Reachable time            :  unspecified (0&#215;00000000)</span></div>
<div><span style="font-family: 'Courier New';">Retransmit time           :  unspecified (0&#215;00000000)</span></div>
<div><span style="font-family: 'Courier New';"> Source link-layer address: 00:40:63:F5:F9:3C</span></div>
<div><span style="font-family: 'Courier New';"> from fe80::240:63ff:fef5:f93c</span></div>
<div><span style="font-family: 'Courier New';">Hop limit                 :           64 (      0&#215;40)</span></div>
<div><span style="font-family: 'Courier New';">Stateful address conf.    :           No</span></div>
<div><span style="font-family: 'Courier New';">Stateful other conf.      :           No</span></div>
<div><span style="font-family: 'Courier New';">Router preference         :       medium</span></div>
<div><span style="font-family: 'Courier New';">Router lifetime           :         1800 (0&#215;00000708) seconds</span></div>
<div><span style="font-family: 'Courier New';">Reachable time            :  unspecified (0&#215;00000000)</span></div>
<div><span style="font-family: 'Courier New';">Retransmit time           :  unspecified (0&#215;00000000)</span></div>
<div><span style="font-family: 'Courier New';"> Prefix                   : 2a01:XXX:8b25:7ea0::/64</span></div>
<div><span style="font-family: 'Courier New';"> Valid time              :        86400 (0&#215;00015180) seconds</span></div>
<div><span style="font-family: 'Courier New';"> Pref. time              :        86400 (0&#215;00015180) seconds</span></div>
<div><span style="font-family: 'Courier New';"> Recursive DNS server     : 2a01:e00::2</span></div>
<div><span style="font-family: 'Courier New';"> Recursive DNS server     : 2a01:e00::1</span></div>
<div><span style="font-family: 'Courier New';"> DNS servers lifetime    :          600 (0&#215;00000258) seconds</span></div>
<div><span style="font-family: 'Courier New';"> MTU                      :         1480 bytes (valid)</span></div>
<div><span style="font-family: 'Courier New';"> Source link-layer address: 00:07:CB:A5:1A:68</span></div>
<div><span style="font-family: 'Courier New';"> from fe80::207:cbff:fea5:1a68</span></div>
<p>Wow. Look at all that! Useful.</p>
<p>Now to move on to integrating this into the system so all IPv6 names get resolved this was.</p>
<h2>rdnssd &#8211; Recursive DNS Server daemon</h2>
<p>I think I should start out with a warning here: this next step is the entirely logical and sensible thing to do. But in fact read through to the end: it&#8217;s not going to work &#8211; the Linux IPv6 userspace tools are simply not quite here they should be yet&#8230; But it&#8217;s instructive to look at this, if only for the learning it provides.</p>
<p>Let&#8217;s set up the required sub-system to handle IPv6 DNS requests from this system and the users who will later traverse it. The first step is simply to install the required package:</p>
<p style="padding-left: 30px;"><span style="font-family: 'Courier New';">apt-get install rdnssd</span></p>
<p>This package may have other dependencies, which should get automatically fulfilled, e.g. <em>resolvconf</em>)</p>
<div>Just what is rdnssd? The best summary of it I can see is the first paragraph of the associated <em>man</em> page:</div>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">rdnssd is a daemon program providing client-side support for DNS configuration using the Recursive</span></div>
<div><span style="font-family: 'Courier New';">DNS Server (RDNSS) option, as described in RFC 5006. Its purpose is to supply IPv6 DNS resolvers</span></div>
<div><span style="font-family: 'Courier New';">through stateless autoconfiguration, carried by Router Advertisements.</span></div>
<div><span style="font-family: 'Courier New';"><br />
</span></div>
</blockquote>
<p>That pretty much sums it up. It&#8217;s just what we need here!</p>
<div>The second paragraph is also quite illuminating:</div>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">rdnssd parses RDNSS options and keeps track of resolvers to write nameservers entries to a</span></div>
<div><span style="font-family: 'Courier New';">resolv.conf(5) configuration file. By default, it writes its own separate file, and may call an</span></div>
<div><span style="font-family: 'Courier New';">external hook to merge it with the main /etc/resolv.conf. This is aimed at easing coexistence with</span></div>
<div><span style="font-family: 'Courier New';">concurrent daemons, especially IPv4 ones, updating /etc/resolv.conf too.</span></div>
</blockquote>
<p>So, we&#8217;ve installed it. What&#8217;s it doing? Straight after installing the package a ps -ef shows me that the process is running. I rerun my ping6 and nslookup (without specifying th IPv6 DNS this time) and tcpdump shows me no change: the DNS is still taking place over IPv4.</p>
<p>As mentioned at the start of thus sub-section, we have a problem here. A big, fat problem. We want this daemon to pick up our DNS server from the RA and use them. Which is fine. But check out the last para of the rdnssd man page:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">When rdnssd uses a raw socket instead of the netlink kernel interface, it does not validate received</span></div>
<div><span style="font-family: 'Courier New';">Neighbor Discovery traffic in any way. For example, it will always consider Router Advertisement</span></div>
<div><span style="font-family: 'Courier New';">packets, whereas it should not if the host is configured as a router. When the netlink interface is</span></div>
<div><span style="font-family: 'Courier New';">used, such validation is done by the kernel.</span></div>
</blockquote>
<p>What that boils down to is that if we&#8217;re running as a <em>router</em> (and we are, since in <em>/etc/sysctl.conf</em> we have <em>net.ipv6.conf.all.forwarding=1</em>) the kernel will simply not pass the RA up to user-space at all. So rdnssd never gets the chance to see it, and thus never acts upon it. Which is a bummer.</p>
<p>Just to experiment, you can dynamically drop down to <em>/proc/sys/net/ipv6/conf/all/forwarding</em> and set it to &#8217;0&#8242;. (radvd will bitch and moan, but ignore that.) Force a RA refresh if required, using rdisc eth0, and you will see rdnssd do its stuff and change the <em>/etc/resolv.conf</em> to point at the IPv6 servers. But we can&#8217;t leave it that way, alas. We&#8217;ve hit a bit of a blocker here &#8211; picking up the IPv6 DNS servers automatically from the ISP seems to not be achievable at the moment using rdnssd &#8211; the kernel&#8217;s policies for what is allowed and when prevent it.</p>
<h2>So what do we do?</h2>
<p>We now understand what we&#8217;re trying to do. We also understand how it should be doable. But currently there&#8217;s a blocker. What to do?</p>
<p>As always in such matters, there&#8217;s an easy, pragmatic way forward and a tricky, hacky way forward! The sensible path to take is very simple indeed. We know the IPv6 addresses of our DNS servers (and if we forget we can just do a rdisc eth0 to find them out again) The obvious thing to do it to statically configure them in to the existing <em>/etc/resolv.conf</em> and then, when we later use IPv6 from a device on the internal network, configure them there too.</p>
<p>That&#8217;s what I would recommend. That&#8217;s what you should do. You can specify a mixture of IPv6 and IPv4 name-server in the <em>/etc/resolv.conf file</em>. If you specify the IPv6 servers first, then all DNS on the system will (if available) use the IPv6 name servers. I suppose this does slightly violate still our desire to keep IPv4 and IPv6 separate (since IPv4 name resolution will now also use IPv6) but since it tilts the bias in favour if IPv6, with a seamless fallback to IPv4, I think I can live with that.</p>
<h2>OK &#8211; but what about more wacky solutions?</h2>
<div><strong><em>[Remember, stop here unless you're wanting to have some fun</em></strong><em><strong> and</strong></em><strong><em> you are comfortable with building your own software.]</em></strong></div>
<p>One approach that would give us a partial solution would be to admit we were wrong originally, and instead of using radvd to propagate simple prefix information into our internal networks we should instead use a fully-fledged IPv6 DHCP server that can propagate addressing and DNS information. This would solve the problem of devices inside the network needing to have the IPv6 DNSs statically configured on them. However even this would not solve the root issue here: our inability to automatically pick up the IPv6 DNS information from received RAs when we&#8217;re configured to operate as a router.</p>
<p>The problem there is not, directly, rdnssd itself. The problem is the kernel. An architectural decision has been taken to stop the kernel sending RA DNS data up to userspace if the system is functioning as a router. Good or bad decision? Bad in my view. I can understand why it is sensible default behaviour, yes. But I do not understand why it&#8217;s been made unchangeable. But that&#8217;s how it is, for now anyway.</p>
<p>The solution I&#8217;m going to go for is to actually bypass the policing mechanism itself. The kernel only manages to stop the DNS being sent to userspace when userspace uses the Netlink mechanism to talk down. So why not just bypass that and get the raw data we want? This should bre easy enough to do, as rdnssd itself used to work this way, before the kernel started using Netlink to talk to userspace. So we might be able to build rdnssd to behave as it used to and get the data, right?</p>
<h3>Hack and build rdnssd</h3>
<p>The existing rndssd code makes provision for kernels <em>with </em> the netlink capability which causes us problems and for older kernels <em>without</em> that capability. So all the code we need is already in place. All we really need to do is change the default behaviour of <em>rdnssd</em> to the old way and we&#8217;ll be all set. One could of course do this properly and completely using command line options. Here&#8217;s what you might do in terms of changes to the <em>rdnssd</em> code-base:</p>
<h3>Edit rdnssd.c</h3>
<p>In <em>usage()</em>, ad a line such as:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">&#8221;  -n  &#8211;no-netlink  use old method to pick up kernel notificationsn&#8221;</span></div>
</blockquote>
<p>In <em>main() </em>drop in appropriate parameter parsing:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">static const struct option opts[] =</span></div>
<div><span style="font-family: 'Courier New';"> {</span></div>
<div><span style="font-family: 'Courier New';"> { &#8220;foreground&#8221;,         no_argument,            NULL, &#8216;f&#8217; },</span></div>
<div><span style="font-family: 'Courier New';"> { &#8220;no-netlink&#8221;,         no_argument,            NULL, &#8216;n&#8217;},</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
</blockquote>
<p>and an appropriate global:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'courier new';">bool nonetlink = false;</span></div>
</blockquote>
<p>and then in the main parsing switch add:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">case &#8216;n&#8217;:</span></div>
<div><span style="font-family: 'Courier New';"> nonetlink = true;</span></div>
<div><span style="font-family: 'Courier New';"> break;</span></div>
</blockquote>
<p>Then finally up in worker() we act upon it.</p>
<p>Before we had:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">static int worker (int pipe, const char *resolvpath, const char *username)</span></div>
<div><span style="font-family: 'Courier New';">{</span></div>
<div><span style="font-family: 'Courier New';"> sigset_t emptyset;</span></div>
<div><span style="font-family: 'Courier New';"> int rval = 0, sock = -1;</span></div>
<div><span style="font-family: 'Courier New';"> const rdnss_src_t *src;</span></div>
<div><span style="font-family: 'Courier New';">#ifdef __linux__</span></div>
<div><span style="font-family: 'Courier New';"> src = &amp;rdnss_netlink;</span></div>
<div><span style="font-family: 'Courier New';"> sock = src-&gt;setup ();</span></div>
<div><span style="font-family: 'Courier New';">#endif</span></div>
<div><span style="font-family: 'Courier New';"> if (sock == -1)</span></div>
<div><span style="font-family: 'Courier New';"> {</span></div>
<div><span style="font-family: 'Courier New';"> src = &amp;rdnss_icmp;</span></div>
<div><span style="font-family: 'Courier New';"> sock = src-&gt;setup ();</span></div>
<div><span style="font-family: 'Courier New';"> }</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
</blockquote>
<p>Change it to something like:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">static int worker (int pipe, const char *resolvpath, const char *username)</span></div>
<div><span style="font-family: 'Courier New';">{</span></div>
<div><span style="font-family: 'Courier New';"> sigset_t emptyset;</span></div>
<div><span style="font-family: 'Courier New';"> int rval = 0, sock = -1;</span></div>
<div><span style="font-family: 'Courier New';"> const rdnss_src_t *src;</span></div>
<div><span style="font-family: 'Courier New';">#ifdef __linux__</span></div>
<div><span style="font-family: 'Courier New';"> if (!nonetlink) {</span></div>
<div><span style="font-family: 'Courier New';"> src = &amp;rdnss_netlink;</span></div>
<div><span style="font-family: 'Courier New';"> sock = src-&gt;setup ();</span></div>
<div><span style="font-family: 'Courier New';"> }</span></div>
<div><span style="font-family: 'Courier New';">#endif</span></div>
<div><span style="font-family: 'Courier New';"> if (sock == -1)</span></div>
<div><span style="font-family: 'Courier New';"> {</span></div>
<div><span style="font-family: 'Courier New';"> src = &amp;rdnss_icmp;</span></div>
<div><span style="font-family: 'Courier New';"> sock = src-&gt;setup ();</span></div>
<div><span style="font-family: 'Courier New';"> }</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
</blockquote>
<p>and we&#8217;re good. Build, install and use as before, but using the new cli parameter &#8220;-n&#8221; as required to force the old behaviour.</p>
<p><a title="rdnssd.c - proof of concept" href="http://www.ipsidixit.net/wp-content/2010/04/rdnssd.c" target="_blank">Attached is a version of rdnssd.c </a>based off version 0.9.9 for reference.</p>
<p>For finishing touches, set up an rdnssd hook-file which puts the IPv6 nameservers first in /etc/resolv.conf, and then have the original IPv4 servers appended after them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2010/04/02/243/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IPv6 &#8211; Proxy the neighbors (or come back ARP &#8211; we loved you really)</title>
		<link>http://www.ipsidixit.net/2010/03/24/239/</link>
		<comments>http://www.ipsidixit.net/2010/03/24/239/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 09:11:32 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[shorewall]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/2010/03/24/239/</guid>
		<description><![CDATA[<p> After three articles, where am I with my venture in to IPv6? What have we really achieved so far? Well, in functional terms, not so very much yet!!</p> <p>To recap:</p> Here I covered a lot of ground, getting basic IPv6 running on a Linux gateway box connected to an ISP providing native IPv6, [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: medium;"><strong><a href="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png"><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" /></a></strong></span><br />
After three articles, where am I with my venture in to IPv6? What have we really achieved so far? Well, in functional terms, not so very much yet!!</p>
<p>To recap:</p>
<ul>
<li><a id="f3ex" title="Here I covered a lot of ground" href="http://www.ipsidixit.net/2010/02/24/228/">Here I covered a lot of ground</a>, getting basic IPv6 running on a Linux gateway box connected to an ISP providing native IPv6, while remembering stuff like the need to set up a firewall.</li>
<li><a id="qd0y" title="Here I looked at" href="http://www.ipsidixit.net/2010/02/25/231/">Here I looked at</a> the issue of IPv6 firewall logging</li>
<li><a id="f8.l" title="And here I looked at" href="http://www.ipsidixit.net/2010/03/05/ipv6-and-default-routes/">And here I looked at</a> the need to set up a default route out of the gateway device pointing back towards the internet.</li>
</ul>
<p>And what can I now actually <em>do</em>? Well&#8230;&#8230;. from the gateway box I can ping out successfully to any IPv6 device on the Internet. In other words, logged in to the device in green on this diagram, I can ping out of eth0 over the Internet. And <em>from</em> an IPv6 device on the Internet I can successfully ping <em>towards</em> my green box, using the address of eth0. So I can ping from the Internet to (these are of course made-up addresses!) 123::456.</p>
<p><img class="aligncenter size-full wp-image-241" title="ipv6_diag1b" src="http://www.ipsidixit.net/wp-content/2010/03/ipv6_diag1-e1269432148539.png" alt="" width="744" height="350" /><br />
<span id="more-239"></span></p>
<p>However if from my remote Internet location I ping instead the IPv6 address of eth1 (here <span style="font-family: 'Courier New';">123::789</span>) does it work? I might expect it to: after all, eth1 has a global IPv6 address on it, not a private address. So surely I can ping it?</p>
<p>Needless to say, as it stands I cannot. Here we look at why not &#8211; in the process covering an important element of turning our gateway device in to an IPv6 router (which, grand though it sounds, is exactly what we are doing here!) which receives very little coverage elsewhere on the Internet. In fact when researching this I came to a conclusion that the vast majority of folks who have dabbled with IPv6 in the domestic environment have terminated their ISP IPv6 connection on their workstation, and very few have gone the step further and used a device as a gateway to a home network!!</p>
<h2>How to get through the gateway &#8211;  or Come back ARP, all is forgiven</h2>
<p><span style="font-size: small;">So when I </span><span style="font-family: 'Courier New';">ping 123::789</span> what stops it working? The first thought is: firewall. We&#8217;re blocking it, right? A quick trip to the shorewall6 log (<a href="http://www.ipsidixit.net/2010/02/25/231/">glad we set that up, eh?</a>) shows us: nothing. Nowt. Zilch. Nada. Surprisingly, we&#8217;re not dropping the ping. (In fact the firewall config we set up in the first of these articles contains enough already to allow, from a firewall perspective, for this ping to succeed.)</p>
<p><span style="font-size: small;">So we now run <em>tcpdump</em> on eth0 to see just what is going on. Here&#8217;s an example:</span></p>
<h3>From the remote host</h3>
<p>From my remote IPv6 host I do and see:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">ping6 2a01:XXX:8b25:7ea0::22</span></div>
<div><span style="font-family: 'Courier New';">PING 2a01:XXX:8b25:7ea0::22(2a01:XXX:8b25:7ea0::22) 56 data bytes</span></div>
<div><span style="font-family: 'Courier New';">From 2a01:XXX:8b25:7ea0::1 icmp_seq=1 Destination unreachable: Address unreachable</span></div>
<div><span style="font-family: 'Courier New';">From 2a01:XXX:8b25:7ea0::1 icmp_seq=2 Destination unreachable: Address unreachable</span></div>
<div><span style="font-family: 'Courier New';">From 2a01:XXX:8b25:7ea0::1 icmp_seq=3 Destination unreachable: Address unreachable</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
</blockquote>
<p>Which doesn&#8217;t tell me a lot.</p>
<h3>On the gateway</h3>
<p>On my gateway, from tcpdump, I see:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">tcpdump -i eth0 -v ip6</span></div>
<div><span style="font-family: 'Courier New';">tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes</span></div>
<div><span style="font-family: 'Courier New';">08:51:35.315038 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::207:cbff:fea5:XXX &gt; ff02::1:ff00:22: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2a01:XXX:8b25:7ea0::22</span></div>
<div><span style="font-family: 'Courier New';"> source link-address option (1), length 8 (1): 00:07:cb:a5:1a:68</span></div>
<div><span style="font-family: 'Courier New';">08:51:36.315002 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::207:cbff:fea5:XXX &gt; ff02::1:ff00:22: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2a01:XXX:8b25:7ea0::22</span></div>
<div><span style="font-family: 'Courier New';"> source link-address option (1), length 8 (1): 00:07:cb:a5:1a:68</span></div>
<div><span style="font-family: 'Courier New';">08:51:37.315001 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::207:cbff:fea5:XXX &gt; ff02::1:ff00:22: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2a01:XXX:8b25:7ea0::22</span></div>
<div><span style="font-family: 'Courier New';"> source link-address option (1), length 8 (1): 00:07:cb:a5:1a:68</span></div>
</blockquote>
<h3>What does this tell me?</h3>
<p>So the ping is reaching the gateway device alright. Sort of. Well, not really. But there&#8217;s something going on there! What we see in that tcpdump trace is the ISP&#8217;s router to which I&#8217;m connected is sending me a Neighbor Solicitation for the ::22 address (i.e. the global IPv6 address of my eth1 interface on the &#8220;far side&#8221; of my gateway which I&#8217;m trying to ping) While I&#8217;m not keen to draw too many parallels and comparisons with IPv4, it is useful to do so here: A Neighbor Solicitation is, at least as we see it here, pretty much analogous to a good ol&#8217; ARP Request. The ISP is saying to us &#8220;I think this address is somewhere over with you &#8211; Please confirm and let me know how to reach it&#8221;. Which is great, except for the glaring fact that we appear to ignore this NS (Neighbor Solicitation) and hence the ping fails.</p>
<p>So you can guess we need to set something up on the gateway that tells it to reply to such a NS. (Kinda vaguely analogous to a <em>Proxy ARP</em>, if you&#8217;re familiar with that)</p>
<h3>IPv6 Proxy</h3>
<p>A couple of steps here. Firstly the system needs to be told globally to perform the required IPv6 proxying, and we then need to enable it for specific addresses.</p>
<h4>proxy_ndp</h4>
<p>In the<span style="font-family: 'Courier New';"> /etc/sysctl.conf</span> file add a line:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">net.ipv6.conf.all.proxy_ndp = 1</span></div>
</blockquote>
<p>To set this dynamically (without a reboot) you can also do:</p>
<blockquote style="border: none; margin: 0 0 0 40px;"><p><span style="font-family: 'Courier New';">sysctl -w net.ipv6.conf.all.proxy_ndp=1</span></p></blockquote>
<h4>Neighbor proxy</h4>
<p>Then perform:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">ip -6 neigh add proxy 2a01:XXX:8b25:7ea0::22 dev eth0</span></div>
</blockquote>
<p>Note that here the IPv6 address is the address of the interface on the private side of the gateway (eth1 for me). The end part &#8220;&#8230;dev eth0&#8243; is to say &#8220;Proxy that address from this interface&#8221;.</p>
<p>You also, of course, will need to make such configuration permanent. Numerous approaches to that: I settled upon adding this from the interface-up scripts in <span style="font-family: 'Courier New';">/etc/network/if-up.d/</span> but there are so many other methods too. Pick yours.</p>
<p>(Interestingly, I have yet to discover any way at all to <em>display</em> the list of proxied neighbors added in this manner! I&#8217;ve looked pretty hard, but there appears to be no way I can find to have them listed. There must be a way, but I can&#8217;t find it.)</p>
<h3>Success!</h3>
<p>And the ping now works, with a tcpdump like this now showing to us:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">09:18:18.644817 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::207:cbff:fea5:XXX &gt; ff02::1:ff00:22: [icmp6 sum ok] ICMP6, neighbor solicitation, length 32, who has 2a01:XXX:8b25:7ea0::22</span></div>
<div><span style="font-family: 'Courier New';"> source link-address option (1), length 8 (1): 00:07:cb:a5:1a:68</span></div>
<div><span style="font-family: 'Courier New';">09:18:18.868550 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 32) fe80::240:63ff:fef5:XXX &gt; fe80::207:cbff:fea5:XXX: [icmp6 sum ok] ICMP6, neighbor advertisement, length 32, tgt is 2a01:XXX:8b25:7ea0::22, Flags [solicited]</span></div>
<div><span style="font-family: 'Courier New';"> destination link-address option (2), length 8 (1): 00:40:63:f5:f9:3c</span></div>
<div><span style="font-family: 'Courier New';">09:18:18.868958 IP6 (hlim 56, next-header ICMPv6 (58) payload length: 64) ipsi6 &gt; 2a01:XXX:8b25:7ea0::22: ICMP6, echo request, length 64, seq 5</span></div>
<div><span style="font-family: 'Courier New';">09:18:18.869107 IP6 (hlim 64, next-header ICMPv6 (58) payload length: 64) 2a01:XXX:8b25:7ea0::22 &gt; ipsi6: ICMP6, echo reply, length 64, seq 5</span></div>
</blockquote>
<p>Which has 4 elements:</p>
<ol>
<li>The same sort of Neighbor Solicitation we had previously.</li>
<li>This time we send back a Neighbor Advertisement for the ::22 address</li>
<li>With that done, the ping itself can come to us (the ICMP6 echo request)</li>
<li>And we of course respond to the ping with ICMP6 echo reply.</li>
</ol>
<h2>Conclusions and summary</h2>
<p>In the world of IPv6, with no ARP or NAT, life is different. Devices which in IPv4 are thought of as private (both in terms of addressing and functionality) are now, at least from the perspective of addressing, public. We need to make sure that if we want &#8220;The World&#8221; to be able to reach them, we must in turn tell the world about them. Hence the need for IPv6 neighbor proxying. And, thinking ahead a little, the need to take our firewalling ever more seriously. If I make the addresses of a &#8220;private&#8221; workstation globally reachable I&#8217;d better make sure that it&#8217;s protected&#8230;</p>
<p>The last point to make is about scalability: do we really need to add an &#8220;ip -6 neigh add proxy&#8221; for each private device we wish to be able to reach from the Internet? If there are only a few devices (as in the typical home network) then it may well be easiest to do this. However in situations where the private side of the network has many IPv6 addresses which need to be globally reachable, other solutions may be more appropriate and manageable, but will not be covered here. Here we&#8217;re trying to get a small home network IPv6 enabled, not migrate a corporation to IPv6. If you really want to get in to the area of automating these functions you need to read up on implementations of Neighbor Discovery Protocol,  look at &#8220;zeroconfig&#8221; networking, Apple&#8217;s Bonjour service, and so on..</p>
<p>There will come a time when such automation <em>will</em> be required at the domestic level, with the eventual proliferation of networked devices. But for now we keep it simple and statically configure the required addresses.</p>
<p>&nbsp;</p>
<p><span style="font-size: large;"><strong>EDIT 5 Aug 2011: npd6 &#8211; See project here <a href="http://www.ipsidixit.net/2011/08/04/npd6/">http://www.ipsidixit.net/2011/08/04/npd6/</a></strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2010/03/24/239/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>IPv6 and default routes</title>
		<link>http://www.ipsidixit.net/2010/03/05/ipv6-and-default-routes/</link>
		<comments>http://www.ipsidixit.net/2010/03/05/ipv6-and-default-routes/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 15:02:13 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/?p=233</guid>
		<description><![CDATA[<p>Following on from my first tutorial, we have a box set up which has basic IPv6 connectivity. There&#8217;s a firewall in place with a simple but sufficient configuration. And we can ping6 from this box to remote IPv6 destinations.</p> <p>All of this has, so far, made use only of one network interface (in my case eth0) [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" />Following on from <a href="http://www.ipsidixit.net/2010/02/24/228/">my first tutorial</a>, we have a box set up which has basic IPv6 connectivity. There&#8217;s a firewall in place with a simple but sufficient configuration. And we can ping6 from this box to remote IPv6 destinations.</p>
<p>All of this has, so far, made use only of one network interface (in my case <em>eth0</em>) to set things up. However looking ahead to the next step I am aware that I will want devices <em>inside</em> my network (i.e. my workstations, etc.) to have IPv6 connectivity <em>through</em> this device I am setting up. In other words, this device must, as it does today for IPv4, act as a <em>router</em>.</p>
<p>With IPv4 this is, at a basic level (so forgetting about firewalling and so on) very easy: enable IPv4 forwarding and away you go.</p>
<p>For IPv6? A little more complicated&#8230;</p>
<p><span id="more-233"></span></p>
<h2>sysctl.conf</h2>
<p>My first step was to jump in to /etc/sysctl.conf and, just as I have IPv4 forwarding enabled here, do the same for IPv6. There&#8217;s even a (likely commented out) entry already there to help you. So I change it to show:</p>
<pre style="padding-left: 30px;">net.ipv6.conf.all.forwarding = 1</pre>
<p>Reboot (or if you prefer manually involve the same change via sysctl or simply dropping the value in via /proc/sys/) and it takes effect.</p>
<h2>Why has it all stopped working?</h2>
<p>After doing this, the first thing I noticed was that suddenly I could no longer ping6 to my test destination. I find that the default route has disappeared from the route table (ip -6 route show)</p>
<p>It turns out that once the device is defined to be a router (i.e. that IPv6 forwarding is enabled) it stops acting on received Router Advertisements from the ISP, arriving on my WAN link eth0.</p>
<p>I was pretty miffed at first, but of course on reflection this is entirely sensible behaviour &#8211; I do not actually know who is sending me a given router advertisement. I have no knowledge of how the ISP has built its IPv6 infrastructure, and while I would hope that only the ISP can send an IPv6 Router Advertisement towards me, maybe not? What if someone else manages to do it too?</p>
<p>That&#8217;s why an IPv6 router, even in this context, as a home gateway, needs to treat a Router Advertisement with care!</p>
<h2>What to do?</h2>
<p>With IPv6 forwarding enabled it is possible to allow the RA to be accepted. In sysctl.conf set:</p>
<pre style="padding-left: 30px;">net.ipv6.conf.all.accept_ra = 1</pre>
<p>However this then permits the interface(s) to autoconfig so far as addressing is concerned, but still does not pick up a default route. There is also a sysctl of net.ipv6.conf.all.accept_ra_defrtr which could be useful (if you trust your RA in the first place, that is) but anyway I could not make it work as I&#8217;d expect.</p>
<p>So really it comes down to making sure that, once IPv6 forwarding is enabled, that a default route is manually defined. Something along the lines of:</p>
<pre style="padding-left: 30px;">ip -6 route add default via fe80::207:cbff:aaaa:bbbb dev eth0</pre>
<p>seems to do the trick<br />
Of course the difficulty here is how you obtain the address of the required gateway. My ISP had not told me what it was. I obtained it by looking at what the default route had been prior to enabling IPv6 forwarding. Of course I could also have simply run <em>tcpdump -i eth0 ip6</em> and waited for a to show up.To make this permanent, a suitable line can be added to /etc/network.interfaces, so mine now looks similar to:</p>
<pre style="padding-left: 30px;">iface eth0 inet6 static
address 2a01:e35:8b25:aaaa::1
netmask 128
gateway fe80::207:cbff:aaaa:bbbb</pre>
<p>[EDIT: 2 Aug 2011: "netmask 128" previously read "netmask 64" It *could* be 64, but more likely 128!!]</p>
<p>So with IPv6 forwarding enabled <em>and </em> a default route successfully restored, we can now proceed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2010/03/05/ipv6-and-default-routes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>IPv6 &#8211; logging and shorewall6</title>
		<link>http://www.ipsidixit.net/2010/02/25/231/</link>
		<comments>http://www.ipsidixit.net/2010/02/25/231/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 11:42:32 +0000</pubDate>
		<dc:creator>sgroarke</dc:creator>
				<category><![CDATA[FPage]]></category>
		<category><![CDATA[firewall]]></category>
		<category><![CDATA[icmp6]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ping6]]></category>
		<category><![CDATA[shorewall]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.ipsidixit.net/2010/02/25/231/</guid>
		<description><![CDATA[Following on from my early success at get IPv6 running, I soon hit a significant issue: firewall logging. <p>&#160;</p> <p>Now this need not be a &#8220;blocker&#8221; for everyone, but I take my firewall logging duties quite seriously&#8230;!</p> shorewall IPv4 logging <p>Currently I have IPv4 shorewall configured to log not using the standard syslog mechanism, [...]]]></description>
			<content:encoded><![CDATA[<h1><span style="font-weight: normal; font-size: 13px;"><img class="alignleft size-full wp-image-227" style="margin-top: 10px; margin-bottom: 10px; margin-left: 15px; margin-right: 15px;" title="IPv6 Logo" src="http://www.ipsidixit.net/wp-content/2010/02/IPv6-logo.png" alt="" width="100" height="60" />Following on from <a href="http://www.ipsidixit.net/2010/02/24/228/" target="_blank"><span style="color: #000000;">my early success at get IPv6 running</span></a>, I soon hit a significant issue: firewall logging.</span></h1>
<p>&nbsp;</p>
<p>Now this need not be a &#8220;blocker&#8221; for everyone, but I take my firewall logging duties quite seriously&#8230;!</p>
<h2>shorewall IPv4 logging</h2>
<p>Currently I have IPv4 <a id="mn7m" title="shorewall IPv4 logging configuration and options" href="http://www.shorewall.net/shorewall_logging.html"><span style="color: #000000;">shorewall configured to log</span></a> not using the standard syslog mechanism, but instead to use <a id="w_zy" title="ulogd" href="http://www.netfilter.org/projects/ulogd/index.html"><span style="color: #000000;">ulogd</span></a>. This allows me to easily log firewall activity to an entirely separate set of log files very easily. It is absolutely not mandatory, but it&#8217;s neat and tidy. I then have <a id="pe_m" title="fwlogwatch" href="http://fwlogwatch.inside-security.de/"><span style="color: #000000;">fwlogwatch</span></a> to nightly analyse the logs and automatically email the interesting bits to me for occasional checking.</p>
<p>To enable this I have appropriate pointers to use of ULOG in shorewall&#8217;s <span style="font-family: 'Courier New';">policy</span> and <span style="font-family: 'Courier New';">rules </span>files as follows:</p>
<div><span id="more-231"></span></div>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';"><span style="text-decoration: underline;">policy</span></span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">ext all DROP ULOG<br />
</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
</blockquote>
<p>and, for example:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';"><span style="text-decoration: underline;">rules</span></span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<div><span style="font-family: 'Courier New';">.</span></div>
<p><span style="font-family: 'Courier New';">ACCEPT:ULOG all fwall 47<br />
.<br />
.<br />
.</span></p></blockquote>
<p>One then has an appropriate config in <span style="font-family: 'Courier New';">/etc/ulogd.conf</span> to file things where you want them.</p>
<h2>shorewall6 IPv6 logging</h2>
<div>Having installed <em>shorewall6</em> in a simple form and got it working, I naively assumed I could log in a similar manner as with the IPv4 version of shorewall. Oh no &#8211; I find <em>ulogd</em> is no longer supported in <em>shorewall6</em> and the choices are:</div>
<ul>
<li>syslog</li>
<li>nflog</li>
</ul>
<p>The <em>syslog</em> option I specifically did not want, so I decided I&#8217;d better find out about <em>nflog</em> (Net Filter Log). It turns out that nflog is actually more commonly referred to as <em>ulogd2</em>, and is a dramatically enhanced version of the original <em>ulog</em>. In fact it&#8217;s so different that it is, for all practical purposes, an entirely different thing. Trying to relate <em>ulog</em> to <em>ulog2</em> is a pretty futile exercise. Work on the basis that they are unrelated and it&#8217;ll prove less frustrating.</p>
<div>
<p>Anyway, the learning curve with <em>ulogd2</em> was a bit steep, but it turns out to be a very neat product. Here I will present some key points that should help you to get it up, running and integrated on a Ubuntu system. Oh, and it&#8217;s not available as a pre-built package&#8230; Sorry &#8211; didn&#8217;t I mention that?</p>
</div>
<h2>Implementing NFLOG (aka ulogd2) on a Ubuntu firewall</h2>
<p>The first step to follow is to get hold of the <em>ulogd2</em> source tree and build it. I worried that this would take me some time, but found a <a id="cgq:" title="Pollux's blog" href="https://www.wzdftpd.net/blog/index.php?2008/04/05/19-ulogd2-the-new-userspace-logging-daemon-for-netfilter-iptables-part-2">tremendously helpful article</a> someone had already written which aided me a lot. (Thank you Pollux!)</p>
<div>If you&#8217;re familiar with building from source, that page will give you most of what you need. Here are a few points to add:</div>
<ul>
<li>I&#8217;d suggest leaving the build <span style="font-family: 'Courier New';">PREFIX</span> unspecified (i.e. default) so it will ultimately install in the <span style="font-family: 'Courier New';">/usr/local/</span> hierarchy. This means you can get it all working in parallel with an existing <em>ulogd</em> installation &#8211; much cleaner and safer!</li>
<li>Since we want to emulate <em>ulogd</em> just in so far as we are able to log to a disk file, disable any of the <em>Postgres</em> or <em>MySQL</em> build options to make things more compact and simple (unless of course you want to make use of these neat new features within <em>ulogd2</em>!)</li>
<li>Much of the article referenced assume that you <em>will</em> be logging to a database &#8211; keep it simple for now and ignore that.</li>
</ul>
<h2>ulogd2 config highlights</h2>
<div>Once <em>ulogd2</em> is installed, you need to copy the supplied <span style="font-family: 'Courier New';">ulogd.conf </span>from the source tree you used to build into <span style="font-family: 'Courier New';">/usr/local/etc</span>.</div>
<div>The contents of this file took a little working out, but here I present the key elements required in order to have <em>ulogd2</em> set up to allow:</div>
<ul>
<li>IPv6 to be logged to one file</li>
<li>IPv4 to be logged to another file (this used to be done using the original <em>ulogd</em>)</li>
</ul>
<div>Once completed and the two shorewall configs tweaked to make use of it, this new ulogd2 <em>replaces</em> the previously used ulogd. Note that this is optional: you can have both versions of ulogd coexist. However it&#8217;s a lot cleaner and easier to maintain if just one subsystem is used. But that&#8217;s entirely a personal choice.</div>
<h3>plugins section</h3>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div>
<pre>plugin="/usr/local/lib/ulogd/ulogd_inppkt_NFLOG.so"
plugin="/usr/local/lib/ulogd/ulogd_inppkt_ULOG.so"
plugin="/usr/local/lib/ulogd/ulogd_inpflow_NFCT.so"
plugin="/usr/local/lib/ulogd/ulogd_filter_IFINDEX.so"
plugin="/usr/local/lib/ulogd/ulogd_filter_IP2STR.so"
plugin="/usr/local/lib/ulogd/ulogd_filter_IP2BIN.so"
plugin="/usr/local/lib/ulogd/ulogd_filter_PRINTPKT.so"
plugin="/usr/local/lib/ulogd/ulogd_filter_HWHDR.so"
plugin="/usr/local/lib/ulogd/ulogd_filter_PRINTFLOW.so"
#plugin="/usr/local/lib/ulogd/ulogd_filter_MARK.so"
plugin="/usr/local/lib/ulogd/ulogd_output_LOGEMU.so"
plugin="/usr/local/lib/ulogd/ulogd_output_SYSLOG.so"
#plugin="/usr/local/lib/ulogd/ulogd_output_OPRINT.so"
#plugin="/usr/local/lib/ulogd/ulogd_output_NACCT.so"
#plugin="/usr/local/lib/ulogd/ulogd_output_PCAP.so"
#plugin="/usr/local/lib/ulogd/ulogd_output_PGSQL.so"
#plugin="/usr/local/lib/ulogd/ulogd_output_MYSQL.so"
#plugin="/usr/local/lib/ulogd/ulogd_output_DBI.so"
plugin="/usr/local/lib/ulogd/ulogd_raw2packet_BASE.so"</pre>
</div>
</blockquote>
<h3>stacks section</h3>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div>
<pre># this is a stack for logging packets to syslog after a collect via NFLOG
stack=log4:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu4:LOGEMU
stack=log6:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,emu6:LOGEMU</pre>
</div>
</blockquote>
<h3>log section</h3>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div>
<pre># Using log4 for IPv4
[log4]
group=4
numeric_lable=4
# Using log6 for IPv6
[log6]
group=6
numeric_label=6</pre>
</div>
</blockquote>
<h3>log-specific sections</h3>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div>
<pre># IPv4
[emu4]
file="/var/log/firewall/nflog4.log"
sync=1
# IPv6
[emu6]
file="/var/log/firewall/nflog6.log"
sync=1</pre>
</div>
</blockquote>
<h2>Changes to shorewall configs</h2>
<div>And finally we need to tweak <em>shorewall</em> and <em>shorewallt6</em> to use the new log facility. For shorewall6 that means simply adding the appropriate <span style="font-family: 'Courier New';">NFLOG</span> references within the policies and/or rules. For shorewall IPv4 one simply has to replace existing <span style="font-family: 'Courier New';">ULOG</span> references with an appropriate <span style="font-family: 'Courier New';">NFLOG</span> reference.</div>
<h3>shorewall6 additions</h3>
<p>So my (very very over-logged &#8211; but then my IPv6 is still at the experimental stage&#8230;!) <span style="font-family: 'Courier New';">policy</span> file is now:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">#Source         Dest            Policy          Log             Burst/Limit</span></div>
<div><span style="font-family: 'Courier New';">fwall           all             DROP            NFLOG(6)</span></div>
<div><span style="font-family: 'Courier New';">int             all             DROP            NFLOG(6)</span></div>
<div><span style="font-family: 'Courier New';">ext             all             DROP            NFLOG(6)</span></div>
<div><span style="font-family: 'Courier New';">all             all             DROP            NFLOG(6)</span></div>
</blockquote>
<div>And to test logging from individual rules I&#8217;ve specified <span style="font-family: 'Courier New';">rules</span> as:</div>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">ACCEPT:NFLOG(6) ext     fwall   ipv6-icmp</span></div>
<div><span style="font-family: 'Courier New';">ACCEPT:NFLOG(6) fwall   ext     ipv6-icmp</span></div>
</blockquote>
<h3>shorewall (IPv4) changes</h3>
<p>And over in my IPv4 shorewall I just changed any reference to <span style="font-family: 'Courier New';">ULOG</span> to read <span style="font-family: 'Courier New';">NFLOG(4)</span>, for example, where <span style="font-family: 'Courier New';">policy</span> previously read:</p>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">office all DROP ULOG</span></div>
</blockquote>
<div>it now reads</div>
<blockquote style="border: none; margin: 0 0 0 40px;">
<div><span style="font-family: 'Courier New';">office all DROP NFLOG(4)</span></div>
<div><span style="font-family: 'Courier New';"><br />
</span></div>
</blockquote>
<h2>In Summary</h2>
<div>If you are implementing IPv6 with <em>shorewall6</em>, <em>ulog</em> cannot be used for logging. You must either go back to the crude-but-efective use of <em>syslog</em> or go forward to <em>NFLOG</em> / <em>ulogd2</em>. Implementing <em>ulogd2</em> is not entirely trivial, since it is not yet a pre-built package for Ubuntu. However building and implementing it is far from impossible if you&#8217;ve a little experience in such matters. And as a bonus, once implemented you can drop the original ulog and integrate both IPv4 and IPv6 logging within NFLOG.</div>
<div>Worth noting is that while we&#8217;ve achieved an elegant split between IPv4 and IPv6 firewall logs using <em>ulog2d</em>, while I can continue to process my IPv4 logs every night using <em>fwlogwatch</em>, as before, the processing and analysis of the IPv6 logs is another issue altogether! <em>fwlogwatch</em> is an old tool and does not process IPv6 log files. I&#8217;ll sort that out in a later article.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.ipsidixit.net/2010/02/25/231/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

