{"id":12,"date":"2006-03-19T21:29:14","date_gmt":"2006-03-19T21:29:14","guid":{"rendered":"https:\/\/www.bishnet.net\/tim\/blog\/2006\/03\/19\/router-rebuild-or-an-excuse-to-play-with-ipv6\/"},"modified":"2010-11-11T13:02:09","modified_gmt":"2010-11-11T13:02:09","slug":"router-rebuild-or-an-excuse-to-play-with-ipv6","status":"publish","type":"post","link":"https:\/\/www.bishnet.net\/tim\/blog\/2006\/03\/19\/router-rebuild-or-an-excuse-to-play-with-ipv6\/","title":{"rendered":"Router rebuild (or, an excuse to play with IPv6?)"},"content":{"rendered":"<p>So recently my router decided it didn&#8217;t want to whir its fans anymore and consequently gave up on life. It&#8217;s a dual CPU machine and both CPU fans had managed to wedge. After fixing them and getting things running again I heard klunking noises coming from the front of the case; one of the disks in the mirror had failed. I rapidly copied everything off the remaining disk, but didn&#8217;t have a spare to hand. Next morning the remaining disk went too. I wasn&#8217;t having much luck really, but on the positive side I did have a full backup.<\/p>\n<p>After a day or so of fiddling with hardware I got something that resembled a working machine; I&#8217;d gone through a stack of various old disks by this point, most of which were dead. For a while I&#8217;d been pondering a fresh install for the machine, so this was the perfect opportunity. I decided to think about what I wanted it to do &#8211; this is what I came up with.<\/p>\n<ol>\n<li>Obviously needs ADSL connection (via rather old, but working, USB modem)<\/li>\n<li>I&#8217;d quite like a VPN connection to work for various (but not all) work servers<\/li>\n<li>IPv6 routing both internally and out to the world<\/li>\n<li>Internal NIC with my private and public address ranges<\/li>\n<li>A second internal NIC for my wireless network<\/li>\n<li>A better firewall setup (I decided on PF in the end)<\/li>\n<\/ol>\n<p>Rather predictably I decided to do all this with FreeBSD. Nothing exciting about the install, other than I used gmirror this time. I&#8217;m still trying to find the best RAID solution on FreeBSD. So far I think gmirror has impressed me most compared to ataraid and gvinum.<\/p>\n<p>So most of the things I wanted the router to do are things it did before. The new things were the VPN, IPv6 and PF. Those are what I&#8217;ll write about.<\/p>\n<p>Setting up the VPN was straightforward. I installed the <a href=\"http:\/\/www.freshports.org\/net\/pptpclient\/\">net\/pptpclient<\/a> port, bunged the sample config and my credentials in \/etc\/ppp\/ppp.conf, and knocked up a quick RC script (let me know if you&#8217;d like a copy). I also added specific entries to ppp.conf for the hosts I wanted to route over the VPN, rather than letting it route whole subnets.<\/p>\n<p>Something worth noting about ppp is the -unitN flag. Using this you can make sure ppp always uses the same numbered tun device. For example, my VPN connection has -unit1 ensuring it is always tun1. This makes firewall configuration a bit more manageable.<\/p>\n<p>I&#8217;ve also knocked up a slightly better RC script for starting the ADSL connection (compared to the one provided with <a href=\"http:\/\/www.freshports.org\/net\/pppoa\/\">net\/pppoa<\/a>) that checks the line is up before returning. This allows subsequent startup scripts to be pretty much guaranteed access to the Internet. Again, let me know if you&#8217;d like a copy.<\/p>\n<p>The next task was getting the IPv6 connection going. I decided to use the <a href=\"https:\/\/tb.ipv6.btexact.com\/\">BT IPv6 Tunnel Broker<\/a> service. In retrospect this might not have been the best choice; it&#8217;s been down for the last few days. I&#8217;ll let you know how I decide to proceed with that, but I&#8217;m reluctant to change because I&#8217;ll get a whole new address range. Getting this set up was pleasantly simple, particularly when compared with my past experiences trying to set up an IPv6 tunnel. Upon registering I was allocated an IP range and given a FreeBSD-compatible script to bring the link up. I decided to set things up more permanently using the <a href=\"http:\/\/www.freebsddiary.org\/ipv6.php\">excellent guide<\/a> on the FreeBSD Diary website and the details from the broker&#8217;s script.<\/p>\n<p>Surprisingly with the relevant tunneling, routing, and advertisments going setting up clients was a doddle. On my FreeBSD desktop machine I turned on ipv6_enable in rc.conf and it sprang to life (after a reboot). Even on our Windows systems it was as simple as running \u00e2\u20ac\u0153ipv6 install\u00e2\u20ac\u009d.<\/p>\n<p>This finally left PF. Now that I&#8217;ve finished setting it up I can happily say it seems much nicer than IPFW, but I won&#8217;t pretend the journey was easy. It took a while to get my head around the differences, the main one being last-match versus first-match rules. I still need to figure out some of the ALTQ stuff though; my last attempt left me throttling internal traffic to 0.5Mb\/s \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So recently my router decided it didn&#8217;t want to whir its fans anymore and consequently gave up on life. It&#8217;s a dual CPU machine and both CPU fans had managed to wedge. After fixing them and getting things running again I heard klunking noises coming from the front of the case; one of the disks in the mirror had failed. &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-computing","category-freebsd"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":1,"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":398,"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions\/398"}],"wp:attachment":[{"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bishnet.net\/tim\/blog\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}