<?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>Adam Sherman &#187; IPv6</title>
	<atom:link href="http://www.sherman.ca/archives/category/system/ipv6/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sherman.ca</link>
	<description>Mostly random thoughts on software, gear and the great outdoors.</description>
	<lastBuildDate>Fri, 06 Jan 2012 18:39:35 +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>Zeroconf under Debian Linux</title>
		<link>http://www.sherman.ca/archives/2005/03/19/zeroconf-under-debian-linux/</link>
		<comments>http://www.sherman.ca/archives/2005/03/19/zeroconf-under-debian-linux/#comments</comments>
		<pubDate>Sat, 19 Mar 2005 21:07:12 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.sherman.ca/2005/03/19/zeroconf-under-debian-linux/</guid>
		<description><![CDATA[This afternoon I quickly setup enough infrastructure on my test server to enable it to use Multicast DNS to resolve local names and answer local queries. Multicast DNS is part of the Zeroconf specification, which Apple has implemented and refers &#8230; <a href="http://www.sherman.ca/archives/2005/03/19/zeroconf-under-debian-linux/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This afternoon I quickly setup enough infrastructure on my test server to enable it to use <a href="http://www.multicastdns.org/">Multicast DNS</a> to resolve local names and answer local queries. <a href="http://www.multicastdns.org/">Multicast DNS</a> is part of the <a href="http://www.zeroconf.org/">Zeroconf</a> specification, which <a href="http://www.apple.com/">Apple</a> has implemented and refers to as <a href="http://www.apple.com/macosx/features/rendezvous/">Rendezvous</a>.</p>

<p>In order for this to work, your system needs to both <em>answer</em> and <em>perform</em> multicast DNS queries. The two pieces you need for this are:</p>

<ul>
<li><a href="http://packages.debian.org/mdnsresponder">mDNSResponder</a>: From <a href="http://www.apple.com/">Apple</a>, and covered under the APSL, but included in [Porchdog Software]&#8216;s <a href="http://www.porchdogsoft.com/products/howl/">Howl</a> package.</li>
<li><a href="http://0pointer.de/lennart/projects/nss-mdns/">nss-mdns</a>: Written by  Lennart Poettering, provides <em>a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing host name resolution via <a href="http://www.multicastdns.org/">Multicast DNS</a></em></li>
</ul>

<p>As of <code>0.3</code>, nss-mdns is already <a href="http://www.debian.org">Debian</a>-ready, simply build a package executing <code>fakeroot dpkg-buildpackage</code> from the unpacked tarball. There is an mDNSResponder package in <em>Sarge</em> which is rumored to be removed shortly due to license problems with APSL, so grab a copy soon.</p>

<p>Once these are installed, simply add <code>mdns</code> to the <code>hosts</code> line of <code>/etc/nsswitch.conf</code> and you&#8217;re done.</p>

<p>You will now be able to resolve &#8220;.local&#8221; hosts from your Debian system and also resolve this system&#8217;s hostname on other local hosts. By editing <code>/etc/mdnsresponder/mDNSResponder.conf</code>, you can advertise any service you want.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sherman.ca/archives/2005/03/19/zeroconf-under-debian-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IPsec with Linux 2.6.9 &amp; Shorewall</title>
		<link>http://www.sherman.ca/archives/2004/12/09/ipsec-with-linux-269-shorewall/</link>
		<comments>http://www.sherman.ca/archives/2004/12/09/ipsec-with-linux-269-shorewall/#comments</comments>
		<pubDate>Thu, 09 Dec 2004 17:33:01 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.sherman.ca/2004/12/09/ipsec-with-linux-269-shorewall/</guid>
		<description><![CDATA[My previous post promised some information about how firewall rules interact with IPsec under Linux 2.6, well here it is. The Shoreline Firewall has full support for declaratively defining IPsec tunnels and hosts under the new IPsec support. To do &#8230; <a href="http://www.sherman.ca/archives/2004/12/09/ipsec-with-linux-269-shorewall/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>My previous <a href="http://www.sherman.ca/archives/2004/11/21/linux-26-ipsec-vpns/" title="Linux 2.6 IPsec VPNs">post</a> promised some information about how firewall rules interact with IPsec under Linux 2.6, well here it is.</p>

<p>The <a href="http://www.shorewall.net/">Shoreline Firewall</a> has full support for declaratively defining IPsec tunnels and hosts under the new IPsec support. To do this however, you will need the <em>policy match</em> netfilter extension from the <a href="http://netfilter.org/patch-o-matic/index.html">Patch-o-Matic NG</a> and also 4 other patches:</p>

<ul>
<li>ipsec-01-output-hooks.patch</li>
<li>ipsec-02-input-hooks.patch</li>
<li>ipsec-03-policy-lookup.patch</li>
<li>ipsec-04-policy-checks.patch</li>
</ul>

<p>While these patches are in the <a href="http://netfilter.org/patch-o-matic/index.html">POM-NG</a>, they will not cleanly apply to linux 2.6.9. Ronald Moesbergen was nice enough to port the patches are are available from the <a href="https://lists.netfilter.org/pipermail/netfilter-devel/2004-October/017254.html" title="[Patch] ipsec-nat patches for 2.6.9">list archive</a>.</p>

<p>To apply the patches, simply run <code>patch -p1 &lt; ipsec-*</code> from the top of our kernel source tree. Also copy the policy match extension&#8217;s files from the POM-NG directory into your kernel tree and insert the contents of the two <code>.ladd</code> files into the relevant <code>Makefile</code> and <code>Kconfig</code> file. Then reconfigure, enabling the <em>policy match</em>, and rebuild. Then follow the <a href="http://www.shorewall.net/IPSEC-2.6.html" title="IPSEC using Linux Kernel 2.6">documentation</a>.</p>

<p>If I have time, I&#8217;ll try and add some more information here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sherman.ca/archives/2004/12/09/ipsec-with-linux-269-shorewall/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux 2.6 IPsec VPNs</title>
		<link>http://www.sherman.ca/archives/2004/11/21/linux-26-ipsec-vpns/</link>
		<comments>http://www.sherman.ca/archives/2004/11/21/linux-26-ipsec-vpns/#comments</comments>
		<pubDate>Sun, 21 Nov 2004 10:41:54 +0000</pubDate>
		<dc:creator>adam</dc:creator>
				<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[System]]></category>

		<guid isPermaLink="false">http://www.sherman.ca/2004/11/21/linux-26-ipsec-vpns/</guid>
		<description><![CDATA[Update: Howtoforge has a good tutorial about setting up &#8220;roadwarrior&#8221; VPNs using IPsec &#38; KAME. Since I was unable to find a clear description of setting up an IPSec-based VPN using the native IPSec stack from USAGI and KAME userland &#8230; <a href="http://www.sherman.ca/archives/2004/11/21/linux-26-ipsec-vpns/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> Howtoforge has a good <a href="http://www.howtoforge.com/racoon_roadwarrior_vpn">tutorial</a> about setting up &#8220;roadwarrior&#8221; VPNs using IPsec &amp; KAME.</p>

<p>Since I was unable to find a clear description of setting up an IPSec-based VPN using the native IPSec stack from <a href="http://www.linux-ipv6.org/">USAGI</a> and <a href="http://www.kame.net">KAME</a> userland tools that are part of Linux 2.6.x, I thought I would post a short explanation.</p>

<p><strong>Software</strong></p>

<ul>
<li>Linux Kernel 2.6.8 from <a href="http://www.debian.org">Debian</a> Sarge</li>
<li><a href="http://ipsec-tools.sourceforge.net/">ipsec-tools</a> 0.3.3 from <a href="http://www.debian.org">Debian</a> Sarge</li>
<li><a href="http://www.kame.net">racoon</a> 0.3.3 from <a href="http://www.debian.org">Debian</a> Sarge (This package includes racoon-tool.)</li>
</ul>

<p><strong>Network Topology</strong></p>

<p>I am going to explain a very straightforward topology often found in the field. You have two networks, network A (10.0.0.0/24) and network B (10.0.1.0/24). Each network has router/gateway/firewall system, gateway A (10.0.0.1) and gateway B (10.0.1.1). Each of these gateway systems as an external, public, IP address: 3.3.3.3 &amp; 2.2.2.2.</p>

<p>In this topology, our end goal is to allow a hosts on network A, say 10.0.0.123, to securely contact a host on network B, say 10.0.1.158, via an IPSec tunnel.</p>

<p><strong>Note:</strong> In many cases, I will provide only a single example. You must ensure the other gateway is configured similarly, often by reversing the configuration. This is left as an exercise to the reader.</p>

<p><strong>IPSec</strong></p>

<p>Setting up IPSec involves two steps: keying and policy. Normally, you use <em>racoon</em> to provide keying and <em>setkey</em> to establish policy. I will instead use <em>racoon-tool</em> as convenient shortcut. This tool was written by the <a href="http://www.debian.org">Debian</a> Maintainer of the racoon package in order to emulate some of the nice configuration syntaxt of the <a href="http://www.freeswan.org/">FreeS/WAN</a>, an older IPSec implementation for Linux. It dynamically generates a racoon.conf (<code>/var/lib/racoon/racoon.con</code>) and also sets up the policy based on a single configuration file.</p>

<p>First, we simply state that racoon should use the <code>notify</code> priority when sending messages to syslogd:</p>

<pre><code>global:
        log: notify
</code></pre>

<p>It is helpful to create a <code>%default</code> peer and connection in order to avoid duplication of configuration directives:</p>

<pre><code>peer(%default):
        verify_identifier: on
        hash_algorithm[0]: sha1
        encryption_algorithm[0]: aes
connection(%default):
        src_ip: 3.3.3.3
</code></pre>

<p>The above <code>src_ip</code> directive simply says that our connections will be using our public IP.</p>

<p>Next, we define our peer, gatewayB, identifying it by address:</p>

<pre><code>peer(2.2.2.2):
        peers_identifier: address
</code></pre>

<p>Finally, we define a policy so that packets from networkA to networkB are encrypted via gatewayB:</p>

<pre><code>connection(to-gatewayB):
        dst_ip: 2.2.2.2
        src_range: 10.0.0.0/24
        dst_range: 10.0.1.0/24
        admin_status: enabled
</code></pre>

<p>Unfortunately, I have no idea what the <code>admin_status: enabled</code> directive does, or even whether it is required.</p>

<p>You must also add a key to <code>/etc/racoon/psk.txt</code> for the remote gateway:</p>

<pre><code># Entry for gatewayB
2.2.2.2 0x2eba016ffc2314869ae9f9a3b8901a173242f0c8
</code></pre>

<p>A randomly generated key is best, and can be created with the following command:</p>

<pre><code>$ dd if=/dev/random count=20 bs=1 | xxd -ps
</code></pre>

<p>(The <code>xxd</code> command is part of the <em>vim</em> package.)</p>

<p>Make sure that you can the racoon package configured to use <em>racoon-tool</em> by either editing <code>/etc/defaults/racoon</code> or reconfiguring the package. Also, you should probably reload the tool by executing <code>/etc/init.d/racoon reload</code>. You can then check that your policy is in effect by running <code>setkey -DP</code>. You should get something like the following, followed by a bunch of default policies:</p>

<pre><code>10.0.1.0/24[any] 10.0.0.0/24[any] any
        in ipsec
        esp/tunnel/2.2.2.2-3.3.3.3/unique#16385
        created: Nov 18 23:01:24 2004  lastused:
        lifetime: 0(s) validtime: 0(s)
        spid=1512 seq=9 pid=9800
        refcnt=1
10.0.0.0/24[any] 10.0.1.0/24[any] any
        out ipsec
        esp/tunnel/3.3.3.3-2.2.2.2/unique#16384
        created: Nov 18 23:01:24 2004  lastused: Nov 18 23:05:31 2004
        lifetime: 0(s) validtime: 0(s)
        spid=1505 seq=8 pid=9800
        refcnt=1
</code></pre>

<p>Now that the policy is in effect, the kernel will ask the racoon daemon for a <em>security association</em> (SA), when it needs to deal with a packet matching the policy. Racoon will negotiate an SA with the remote gateway on the fly. (This will not happen until after we&#8217;ve setup the routing, below, but you can see it by using the <code>setkey -D</code> command.)</p>

<p><strong>Routing</strong></p>

<p>In order for a packet to match the policy we have setup, and also be forwarded to the remove gateway, we must adjust the routing table using the <code>ip</code> command (Provided by the <a href="http://www.debian.org">Debian</a> <em>iproute2</em> package.).</p>

<p>The policy we have setup, says that packets coming from 10.0.0.0/24 and going to 10.0.1.0/24 must be encrypted and authenticated. This is achieved by adding a slightly weird entry to the routing table on gatewayA:</p>

<pre><code>$ ip route add 10.0.1.0/24 via 2.2.2.2 src 10.0.0.1
</code></pre>

<p>And on gatewayB:</p>

<pre><code>$ ip route add 10.0.0.0/24 via 3.3.3.3 src 10.0.1.1
</code></pre>

<p>Once you have added the new entries to the routing tables on both gateways, we test the tunnel. If you ping 10.0.1.0 from gatewayA, and then execute <code>setkey -D</code>, you will see the new <em>SA</em> that has been automatically created.</p>

<p>This is the routing table you should have on gateway &#8220;A&#8221;:</p>

<pre><code>root@gatewayA:/tmp# ip route show
3.3.3.0/24 dev eth1  proto kernel  scope link  src 3.3.3.3
10.0.1.0/24 via 3.3.3.1 dev eth1  src 10.0.0.1
10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.1
default via 3.3.3.3 dev eth1
</code></pre>

<p>Followed by the routing table present on gateway &#8220;B&#8221;:</p>

<pre><code>root@gatewayB:/tmp# ip route show
2.2.2.0/24 dev eth1  proto kernel  scope link  src 2.2.2.2
10.0.1.0/24 dev eth0  proto kernel  scope link  src 10.0.1.1
10.0.0.0/24 via 2.2.2.1 dev eth1  src 10.0.0.1.1
default via 2.2.2.1 dev eth1
</code></pre>

<p>In the above examples, 2.2.2.1 &amp; 3.3.3.1 are the default gateways that connect your public networks. (The routers usually provided by your ISP.)</p>

<p><strong>Note:</strong> if you have any firewall rules enabled, you are going to have hassles. Notice that the IPSec tunnel doesn&#8217;t have it&#8217;s own device: the encrypted packets are going through a public interface. This will confuse any firewall rules that expect to be able to categorize packets by interface. I intend to figure out a good solution and post it at a later date.</p>

<p><strong>Update:</strong> I now have a fully working IPsec gateway/router/firewall. See <a href="http://www.sherman.ca/archives/2004/12/09/ipsec-with-linux-269-shorewall/" title="IPsec with Linux 2.6.9 &amp; Shorewall">this</a> other post.</p>

<p><strong>Update:</strong> It seems that when the external addresses of the gateways on are different subnets, which was not the case during my testing, you must add a route like <code>ip route add OTHER_NETWORK via LOCAL_DEFAULT_GW src INTERNAL_IP</code>. Otherwise, you will get an error: <code>RTNETLINK answers: Network is unreachable</code>. Please leave a comment if you can clarify this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sherman.ca/archives/2004/11/21/linux-26-ipsec-vpns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

