<?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>Long-term Memory</title>
	<atom:link href="http://blog.dest-unreach.be/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.dest-unreach.be</link>
	<description>A collection of note-to-self&#039;s</description>
	<lastBuildDate>Sun, 29 Jan 2012 16:05:00 +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>iMax B6 charger protocol reverse engineered</title>
		<link>http://blog.dest-unreach.be/2012/01/29/imax-b6-charger-protocol-reverse-engineered</link>
		<comments>http://blog.dest-unreach.be/2012/01/29/imax-b6-charger-protocol-reverse-engineered#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:04:37 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[RCheli]]></category>
		<category><![CDATA[charger]]></category>
		<category><![CDATA[protocol]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2195</guid>
		<description><![CDATA[I briefly mentioned that the iMax B6 Quattro charger has a computer interface. I already was disappointed that the interface is per charger and only half of the chargers has it. Another disappointment came when I tried the software. The provided software only supports the bare minimum, both in functionality and user interface: It&#8217;s Windows [...]]]></description>
			<content:encoded><![CDATA[<p>I briefly <a href="/2012/01/15/imax-quattro-b6-charger">mentioned</a> that the iMax B6 Quattro charger has a computer interface. I already was disappointed that the interface is per charger and only half of the chargers has it. Another disappointment came when I tried the software.</p>
<p><span id="more-2195"></span></p>
<p>The provided software only supports the bare minimum, both in functionality and user interface:</p>
<p><a href="/wp-content/uploads/2012/01/Charger-monitor.1.png"><img class="alignnone size-medium wp-image-2220" title="Charger monitor.1" src="/wp-content/uploads/2012/01/Charger-monitor.1-300x187.png" alt="" width="300" height="187" /></a> <a href="/wp-content/uploads/2012/01/Charger-monitor.2.png"><img class="alignnone size-medium wp-image-2221" title="Charger monitor.2" src="/wp-content/uploads/2012/01/Charger-monitor.2-300x219.png" alt="" width="300" height="219" /></a></p>
<p>It&#8217;s Windows only, there is no zooming functionality and no exact value readout. The file format for the &#8220;Log file&#8221; is some obscure binary format. In short, inadequate.</p>
<h3>The hardware</h3>
<p>The provided communications hardware is decent. It&#8217;s a small ~1*3cm PCB with a female <a href="http://en.wikipedia.org/wiki/USB#Mini_and_Micro_connectors">mini-USB</a> connector on one side and a pigtail leading to a female <a href="http://aircraft-world.com/prod_datasheets/hp/motorguide/imgfutaba.gif">Futaba J-type connector</a> on the other side, which plugs into the charger.</p>
<p><a href="/wp-content/uploads/2012/01/iMax-PC-Link.jpg"><img class="alignnone size-medium wp-image-2222" title="iMax PC Link" src="http://blog.dest-unreach.be/wp-content/uploads/2012/01/iMax-PC-Link-300x134.jpg" alt="" width="300" height="134" /></a></p>
<p>This board is actually just an USB-to-Serial convertor <a href="http://www.silabs.com/products/interface/usbtouart/Pages/usb-to-uart-bridge.aspx">by SiLabs</a>. SiLabs <a href="http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx">provides drivers</a> for Windows, Mac (<a href="/wp-content/uploads/2012/01/SiLabsUSBDriverDisk.dmg">local copy</a>) &amp; Linux<br />
(<a href="/wp-content/uploads/2012/01/cp210x-3.1.0.tar.gz">local copy</a>).</p>
<h3>The protocol</h3>
<p>The protocol seems to be fairly simple. Just connecting the charger to PC already produces a stream of bytes. There is no need for the computer to send any requests. I use <a href="/wp-content/uploads/2012/01/read_serial.pl">a simple perl script</a> that opens the serial port in the correct mode and produces the read bytes on STDOUT. The bytestream consists of 74 byte long messages wrapped in curly braces (`{` (0x7b) and `}` (0x7d)).</p>
<blockquote>
<pre>7B 9E 84 84  D0 85 80 EE  81 81 81 80  81 94 8A 80
81 96 82 8A  82 8E 86 81  81 80 8A 80  8A 80 8C B2
80 82 95 87  CC 80 80 80  80 8D CF 80  BA 83 D8 83
D6 80 80 80  80 80 80 80  80 80 80 80  80 80 80 80
80 80 80 80  80 80 81 8F  A4 38 30 7D</pre>
</blockquote>
<p>The last two bytes each contain 4 bits of the 8-bit checksum of the first 72 bytes:</p>
<pre>(0x9e + 0x84 + … + 0x8f + 0xa4) % 0x100 = 0x80 -&gt; 0x<span style="color: #999999;">3</span>8 0x<span style="color: #999999;">3</span>0</pre>
<p>The 72 data-bytes all have their high 0&#215;80 bit set, it only contains 7 bits of data. For the rest of this discussion, I&#8217;m only referring to the lower 7 bits of each byte. Here are the data-pieces that I discovered. Byte numbers start at 0 for the first data byte (i.e. 0x9e).</p>
<ul>
<li>Byte 7 contains part of the state</li>
<ul>
<li>bit 0&#215;01 is set when charging, clear when discharging</li>
<li>bit 0&#215;10 is set when cycling, clear when single charging or discharging</li>
</ul>
<li>Byte 8 contains the set NiCd charge current in dA</li>
<li>Byte 9 contains the set NiCd discharge current in dA</li>
<li>Byte 12 contains the set NiMH charge current in dA</li>
<li>Byte 13 contains the set NiMH discharge current in dA</li>
<li>Byte 14, bit 0&#215;01 contains the cycle mode, set for {Charge,Discharge}, clear for {Discharge,Charge}</li>
<li>Byte 15 contains the cycle count</li>
<li>Byte 16 contains the set Li__ charge current in dA</li>
<li>Byte 17 contains the set Li__ charge cell count</li>
<li>Byte 18 contains the set Li__ discharge current in dA</li>
<li>Byte 19 contains the set Li__ discharge cell count</li>
<li>Byte 20 contains the set Pb charge current in dA</li>
<li>Byte 21 contains the set Pb cell count</li>
<li>Byte 22 contains the mode:</li>
<ul>
<li>0&#215;80: Config</li>
<li>0&#215;81: Li</li>
<li>0&#215;82: NiMH</li>
<li>0&#215;83: NiCd</li>
<li>0&#215;84: Pb</li>
<li>0&#215;85: Save</li>
<li>0&#215;86: Load</li>
</ul>
<li>Byte 23 contains the running state: bit 0&#215;01 is set when running, cleared when standby</li>
<li>Byte 24 &amp; 25 contain the set NiMH discharge voltage in daV and cV</li>
<li>Byte 26 &amp; 27 contains the set NiCd discharge voltage in daV and cV</li>
<li>Byte 32 &amp; 33 contain the actual current in A and cA</li>
<li>Byte 34 &amp; 35 contain the catual voltage in V and cV</li>
<li>Byte 40 &amp; 41 contain the input voltage in V and cV</li>
<li>Byte 42 &amp; 43 contain the charge in dAh and mAh</li>
<li>Bytes 44 &amp; 45; 46 &amp; 47; 48 &amp; 49; 50 &amp; 51; 52 &amp; 53; 54 &amp; 55 contain the individual Li__ cell voltages in V and cV</li>
<li>Byte 69 contains the time in minutes</li>
</ul>
<p>Or if you&#8217;re lazy, just feed in the bytes into <a href="/wp-content/uploads/2012/01/decode.pl">this perl script</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2012/01/29/imax-b6-charger-protocol-reverse-engineered/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iMax Quattro B6 Charger</title>
		<link>http://blog.dest-unreach.be/2012/01/15/imax-quattro-b6-charger</link>
		<comments>http://blog.dest-unreach.be/2012/01/15/imax-quattro-b6-charger#comments</comments>
		<pubDate>Sun, 15 Jan 2012 20:48:30 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[RCheli]]></category>
		<category><![CDATA[charger]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2190</guid>
		<description><![CDATA[I bought a new &#8220;multi-charger&#8221;, the iMax Quattro B6. Here is my review. The specs The charger is run from DC power. It accepts 11-15V DC, so it&#8217;s designed to run of a car battery or an equivalent power supply. Make sure your power supply can provide enough power! I used an 28A 13.8V switched-mode [...]]]></description>
			<content:encoded><![CDATA[<p>I bought a new &#8220;multi-charger&#8221;, the <a href="http://www.skyrc.com/index.php?route=product/product&amp;path=20&amp;product_id=8">iMax Quattro B6</a>. Here is my review.</p>
<p><img class="alignnone" title="iMax Quattro B6" src="http://www.skyrc.com/image/cache/data/proshow/B6M0-690x450.jpg" alt="" width="276" height="180" /></p>
<p><span id="more-2190"></span></p>
<h3>The specs</h3>
<p>The charger is run from DC power. It accepts 11-15V DC, so it&#8217;s designed to run of a car battery or an equivalent power supply. Make sure your power supply can provide enough power! I used an 28A 13.8V <a href="http://en.wikipedia.org/wiki/Switched-mode_power_supply">switched-mode power supply</a>.</p>
<p>The box contains 4 independent chargers, with only their input connected together. In fact, they are so independent, that they even crash independent:<br />
<a href="http://blog.dest-unreach.be/wp-content/uploads/2012/01/imax_crash.jpg"><img class="alignnone size-medium wp-image-2193" title="imax_crash" src="http://blog.dest-unreach.be/wp-content/uploads/2012/01/imax_crash-224x300.jpg" alt="" width="224" height="300" /></a></p>
<p>Each of the 4 chargers can charge:</p>
<ul>
<li>Lithium-based batteries (<a href="http://en.wikipedia.org/wiki/Lithium-ion_battery">Lithium-ion</a>, <a href="http://en.wikipedia.org/wiki/Lithium-ion_polymer_battery">Lithium Polymer</a> and the newer <a href="http://en.wikipedia.org/wiki/Lithium_iron_phosphate_battery">Lithium Iron Phosphate</a>), up to 6 cells in series (22.2V) with built-in <a href="http://en.wikipedia.org/wiki/Lithium-ion_polymer_battery#Prolonging_life_in_multiple_cells_through_cell_balancing">balancer</a></li>
<li>Nickel-based batteries (<a href="http://en.wikipedia.org/wiki/Nickel%E2%80%93metal_hydride_battery">NiMH</a> and <a href="http://en.wikipedia.org/wiki/Nickel%E2%80%93cadmium_battery">NiCd</a>), up to 15 cells (18V)</li>
<li><a href="http://en.wikipedia.org/wiki/VRLA">Lead-Acid batteries</a>, up to 10 cells (20V)</li>
</ul>
<p>It supports charging at up to 5A or 50W (whichever limit is reached first) per charger, which isn&#8217;t particularly fast. However, this isn&#8217;t particularly important when charging Lithium-based batteries. These require a CC-CV charging process: batteries are charged with a constant current (CC-phase) until they reach 4.2V/cell. After that, the charger switches to constant voltage (CV-phase) and maintains that 4.2V/cell by decreasing the charge current. When the charge current reaches 0 (or practically, 2% of the original charge current), the battery is considered full. This means that the CV-phase will always take the same amount of time, independent of the charge current during the CC-phase. <a href="http://www.rcgroups.com/forums/showthread.php?t=930251&amp;page=2">This graph</a> suggests that the CV-phase takes ~24 minutes.</p>
<h3>The hardware interface</h3>
<p>The input side consists of two <a href="http://en.wikipedia.org/wiki/Banana_connector">4mm &#8220;banana&#8221; bullet connectors</a> which plug right in to most power supplies. They also provide clamps, so you can clamp on to a car battery.</p>
<p>The side of the batteries has 4 pairs of <a href="http://en.wikipedia.org/wiki/Banana_connector">4mm sockets</a>. The included accessories include conversions to <a href="http://en.wikipedia.org/wiki/Crocodile_clip">crocodile clips</a>, <a href="http://en.wikipedia.org/wiki/DC_connector#Tamiya_connectors">male Tamiya connector</a>, <a href="http://www.bw-design.be/shop/published/publicdata/BWDESIGSHOPDB/attachments/SC/products_pictures/charge_jr.jpg">female Futaba connector</a> and <a href="http://www.bw-design.be/shop/published/publicdata/BWDESIGSHOPDB/attachments/SC/products_pictures/JST.jpg">female JST/BEC connector</a>.</p>
<p>The <a href="http://sites.google.com/site/tjinguytech/charging-how-tos/balance-connectors/">balance connections</a> are unkeyed and spaced 2.54mm (0.1&#8243;) apart, so you can plug JST-XH connectors straight into the charger. The box also provided a board that receive 2S-6S FP/TP, and a second board that receives 2S-6S JST-XH.</p>
<h3>The computer interface</h3>
<p>The charger also supports a <a href="http://www.skyrc.com/index.php?route=product/product&amp;path=20_71&amp;product_id=18">computer interface</a>. To be honest, it was a bit of a disappointment. For one I expected to be able to get detailed voltage/current from all 4 chargers simultaneously. Turns out that not only I&#8217;m limited to one charger at a time, only charger 1 and 2 have the needed output port to connect to! Also, the software was provided on an <a href="http://en.wikipedia.org/wiki/Mini_CD">8cm CD-ROM</a>, which I can&#8217;t read in my <a href="http://en.wikipedia.org/wiki/Slot-loading#Slot_loading">slot-loading drive</a>! More on this in my <a href="/2012/01/29/imax-b6-charger-protocol-reverse-engineered">next post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2012/01/15/imax-quattro-b6-charger/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>For sale: Raptor 50</title>
		<link>http://blog.dest-unreach.be/2011/12/24/for-sale-raptor-50</link>
		<comments>http://blog.dest-unreach.be/2011/12/24/for-sale-raptor-50#comments</comments>
		<pubDate>Sat, 24 Dec 2011 11:41:47 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[RCheli]]></category>
		<category><![CDATA[raptor]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2161</guid>
		<description><![CDATA[I&#8217;m selling my Thunder Tiger Raptor 50 Titan: This is a great helicopter for beginners. Its setup is very gentle and it can take some gusty winds. The governor allows you to concentrate on flying before having to fine-tune the engine. It&#8217;s also fast to refuel (in contrast with recharging a LiPo battery). I&#8217;m selling [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m selling my Thunder Tiger Raptor 50 Titan:</p>
<p><a href="/wp-content/uploads/2008/06/flying.jpg"><img class="alignnone size-medium wp-image-15" title="Flying" src="/wp-content/uploads/2008/06/flying-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p>This is a great helicopter for beginners. Its setup is very gentle and it can take some gusty winds. The governor allows you to concentrate on flying before having to fine-tune the engine. It&#8217;s also fast to refuel (in contrast with recharging a LiPo battery).</p>
<p>I&#8217;m selling it because my new club does not allow nitro.</p>
<p>I&#8217;m selling, preferably as a whole:</p>
<ul>
<li>The helicopter itself, including manual</li>
<li>All servos (3x Futaba 3152, 1x 9206, 1x 9254)</li>
<li>OS 50SX-H Hyper motor (incl manual)</li>
<li>Gy401 tail gyro (incl manual)</li>
<li>GV-1 governor (incl manual)</li>
<li>Rx battery 3600mAh 4.8V, not new but still usable</li>
<li>battery-monitor: shows the charge-state of the Rx battery</li>
<li>NO receiver</li>
<li>fuelpump</li>
<li>Starter engine &amp; pin</li>
<li>4 liters of fuel</li>
<li>glow heater</li>
</ul>
<p>In summary: everything you need to fly expect the transmitter, the receiver &amp; a battery charger</p>
<p>I prefer you come and pick it up near Brussels, Belgium; that way I can show you it still flies.</p>
<p>If you are interested, feel free to propose a price.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/12/24/for-sale-raptor-50/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flight log 2011-10-15</title>
		<link>http://blog.dest-unreach.be/2011/10/16/flight-log-2011-10-15</link>
		<comments>http://blog.dest-unreach.be/2011/10/16/flight-log-2011-10-15#comments</comments>
		<pubDate>Sun, 16 Oct 2011 09:46:30 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[RCheli]]></category>
		<category><![CDATA[checkup]]></category>
		<category><![CDATA[logbook]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[miniTitan]]></category>
		<category><![CDATA[raptor]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2048</guid>
		<description><![CDATA[After way to long, I finally found some time/weather combination to fly again. I&#8217;m a little embarrassed it took so long&#8230; Of course, all my batteries were fairly dead. The glow heater was completely gone (0V), but was still usable after charging. My starter-battery was dead beyond repair. The LiPo&#8217;s of the miniTitan were is [...]]]></description>
			<content:encoded><![CDATA[<p>After way to long, I finally found some time/weather combination to fly again. I&#8217;m a little embarrassed it took so long&#8230;</p>
<p>Of course, all my batteries were fairly dead. The glow heater was completely gone (0V), but was still usable after charging. My starter-battery was dead beyond repair. The LiPo&#8217;s of the miniTitan were is fairly good shape after more than a year in the fridge: 3/4th charged.</p>
<p>Before the flights, I upgrade my CastleLink software to version <a href="/wp-content/uploads/2011/06/CastleLinkInstall_3.40.0.exe">3.40.0</a>, and upgraded the ESC firmware to 3.27 along with <a href="/wp-content/uploads/2011/06/ESC-2011-06-16.dat">these</a> (<a href="/wp-content/uploads/2011/06/Phoenix-ICE-setup-2011-06-16.pdf">PDF</a>) new settings.<br />
<span id="more-2048"></span><strong>Place</strong>: Roeselare<br />
<strong>Tanks flown</strong>: 2<br />
<strong>Time flown</strong>: 0h29 (cumulative model timer: 32h51)<br />
<strong></strong></p>
<p>I was glad the Raptor still started without much trouble after collecting dust for over a year. The engine sounded like before and I did not notice any drop in power.</p>
<p>However, for the first time, I&#8217;m starting to feel the limits of my servo&#8217;s. They&#8217;re fairly low-end Futaba 3152&#8242;s which are great to learn to fly, but can&#8217;t keep up in more aggressive maneuvers.</p>
<p>I also took the miniTitan out for a fly (<a href="/wp-content/uploads/2010/08/logviewer/?logfile=/wp-content/uploads/2011/10/mini-titan-2011-10-15.csv">log</a>). It hoovered well, but felt underpowered. Didn&#8217;t take long to figure out why: 2000RPM isn&#8217;t particularly fast for a 450-sized heli, and <a href="/2010/08/09/flight-log-2010-08-09">I already figured out to set the governor gain higher than low</a>.</p>
<p><strong>Time flown</strong>: 0h18 (cumulative model timer: 4h58)<br />
<strong></strong><strong>Flight battery recharged with</strong>: (2) 539 mAh</p>
<p>After the flight, I had some trouble connecting to the Castle ESC to download the logs: I had to bypass the <a href="http://www.castlecreations.com/products/quick_connect.html">QuickConnect</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/10/16/flight-log-2011-10-15/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding OpenVPN to dd-wrt mini</title>
		<link>http://blog.dest-unreach.be/2011/08/30/adding-openvpn-to-dd-wrt-mini</link>
		<comments>http://blog.dest-unreach.be/2011/08/30/adding-openvpn-to-dd-wrt-mini#comments</comments>
		<pubDate>Tue, 30 Aug 2011 17:18:16 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2105</guid>
		<description><![CDATA[As described before, I chose to use the mini-build of dd-wrt on my Linksys WRT320N. Since I wanted OpenVPN support, I needed to add it myself. Installing I again used the openwrt modules, openvpn has its own package. There are, however, several dependencies: libssl.so.0.9.8 and libcrypto.so.0.9.8 from libopenssl liblzo2.so.2.0.0 (and symlinks) from liblzo I already had [...]]]></description>
			<content:encoded><![CDATA[<p>As described <a href="/2010/11/30/converting-a-wrt320n-to-dd-wrt">before</a>, I chose to use the <a href="http://www.dd-wrt.com/wiki/index.php/What_is_DD-WRT%3F#V24_pre_sp2_K26">mini-build</a> of dd-wrt on my Linksys WRT320N. Since I wanted <a href="http://openvpn.net/index.php/open-source.html">OpenVPN</a> support, I needed to add it myself.</p>
<h3>Installing</h3>
<p>I again used the <a href="http://downloads.openwrt.org/kamikaze/8.09.2/brcm47xx/packages/">openwrt modules</a>, openvpn has its own <a href="http://downloads.openwrt.org/kamikaze/8.09.2/brcm47xx/packages/openvpn_2.0.9-5.1_mipsel.ipk">package</a>. There are, however, several dependencies:</p>
<ul>
<li><em>libssl.so.0.9.8</em> and <em>libcrypto.so.0.9.8</em> from <a href="http://downloads.openwrt.org/kamikaze/8.09.2/brcm47xx/packages/libopenssl_0.9.8i-3.2_mipsel.ipk">libopenssl</a></li>
<li><em>liblzo2.so.2.0.0</em> (and symlinks) from <a href="http://downloads.openwrt.org/kamikaze/8.09.2/brcm47xx/packages/liblzo_2.03-1_mipsel.ipk">liblzo</a></li>
</ul>
<p>I already had <em>libcrypto</em> <a href="/2010/12/06/using-nsupdate-in-dd-wrt">installed</a>, so I only needed 713kB of free space.</p>
<h3>Configuring</h3>
<p>Setup was fairly straightforward. Just make sure to do all heavy calculations on your desktop computer (i.e. generating keys). I installed the CA and host certificate into <em>/jffs/etc/ssl</em>, and added my openvpn-specific config files into <em>/jffs/etc/openvpn</em>. I did <a href="/wp-content/uploads/2011/08/verify-cn.sh">rewrite</a> the <em>verify-cn</em> script from perl to bash, since dd-wrt doesn&#8217;t come with perl.</p>
<p>Next, I wrote a very simple <a href="http://www.dd-wrt.com/wiki/index.php/Script_Execution">wanup script</a> to get openvpn (re)started at the appropriate time:</p>
<blockquote>
<pre># openvpn.wanup
if [ -e /tmp/openvpn.pid ] ; then
    kill -HUP `cat /tmp/openvpn.pid`
else
    /jffs/sbin/openvpn --cd /jffs/etc/openvpn --config server.conf --daemon --log /tmp/openvpn.log --writepid /tmp/openvpn.pid
fi</pre>
</blockquote>
<p>Obviously: don&#8217;t forget to add the corresponding configuration to the firewall.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/08/30/adding-openvpn-to-dd-wrt-mini/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring OpenVPN to support IPv6</title>
		<link>http://blog.dest-unreach.be/2011/06/27/configuring-openvpn-to-support-ipv6</link>
		<comments>http://blog.dest-unreach.be/2011/06/27/configuring-openvpn-to-support-ipv6#comments</comments>
		<pubDate>Mon, 27 Jun 2011 08:50:47 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[VPN]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2070</guid>
		<description><![CDATA[As mentioned before, when switching to IPv6 (or more realistically, to dual stack) one of the things that might not work out of the box is VPNs. I decided to put some effort in it to get it to work anyway. Since we currently already have an OpenVPN tunnel, I preferred to stay with OpenVPN [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="/2011/06/14/world-ipv6-day-lessons-learned">mentioned before</a>, when switching to <a href="http://en.wikipedia.org/wiki/IPv6">IPv6</a> (or more realistically, to <a href="http://en.wikipedia.org/wiki/IPv6#Dual_IP_stack_implementation">dual stack</a>) one of the things that might not work out of the box is <a href="http://en.wikipedia.org/wiki/Virtual_private_network">VPN</a>s. I decided to put some effort in it to get it to work anyway.</p>
<p><span id="more-2070"></span>Since we currently already have an <a href="http://openvpn.net/index.php/open-source/overview.html">OpenVPN</a> tunnel, I preferred to stay with OpenVPN rather than switch to a different stack. Turns out OpenVPN supports IPv6, but under a series of assumptions. Among others, you need OpenVPN 2.3 on both the client and the server to be able to use the new config directives such as <em>route-ipv6</em>. At this moment, 2.3 is still beta. While I enjoy beta-software on a daily basis, rolling it out as a production VPN seems a bit to risky.</p>
<p>To provide maximal compatibility, I decided to stay with OpenVPN 2.2 and use the <a href="http://en.wikipedia.org/wiki/TUN/TAP">tap</a>-interface. I wrote my own up-scripts to take care of the required IPv6 configuration steps.</p>
<h3>Communicating the parameters</h3>
<p>OpenVPN has a <a href="http://openvpn.net/index.php/open-source/documentation/manuals/69-openvpn-21.html#lbAG"><em>setenv</em></a> config directive, which sets additional <a href="http://en.wikipedia.org/wiki/Environment_variable">environment variables</a> for the up-script. Its brother <em>setenv-safe</em> (which prefixes all variables with <em>OPENVPN_</em>) can also be pushed from server to client, allowing arbitrary parameters to be communicated from server to client. I use these three:</p>
<blockquote>
<pre>push "setenv-safe IP6_PREFIX 2001:db8:0:1::/64"
push "setenv-safe IP6_GW 2001:db8:0:1::1"
push "setenv-safe IP6_ROUTES '2001:db8:0:0::/48 2001:db8:1234::/48'"</pre>
</blockquote>
<h3>Configuring the client</h3>
<p>The client now has all the information it needs to enable IPv6 on the tunnel-connection. It just needs to apply that knowledge. I wrote some very basic shell scripts to accomplish this. Basically, the script looks for the <a href="http://en.wikipedia.org/wiki/MAC_address">MAC-address</a> of the (virtual) VPN interface, which it uses to form a <a href="http://en.wikipedia.org/wiki/IPv6#Stateless_address_autoconfiguration_.28SLAAC.29">SLAAC</a> address together with the supplied prefix. At this moment, it does not check for duplicate IP addressing. Next, it configures the calculated IP onto the interface and adds the supplied routes to the routing table.</p>
<p>For those interested, I provide, without any warranty &lt;insert legalese disclamer here&gt;</p>
<ul>
<li><a href="/wp-content/uploads/2011/06/up-macosx.sh">The MacOSX version</a>, written in bash</li>
<li><a href="/wp-content/uploads/2011/06/up-linux.sh">The Linux version</a>, written in bash</li>
<li><a href="/wp-content/uploads/2011/06/up-windows.cmd">The Windows version</a>, a batch-file and powershell hacked together</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/06/27/configuring-openvpn-to-support-ipv6/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>World IPv6 day &#8211; lessons learned</title>
		<link>http://blog.dest-unreach.be/2011/06/14/world-ipv6-day-lessons-learned</link>
		<comments>http://blog.dest-unreach.be/2011/06/14/world-ipv6-day-lessons-learned#comments</comments>
		<pubDate>Tue, 14 Jun 2011 12:22:26 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[crypto]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[Ethernet]]></category>
		<category><![CDATA[IPsec]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MacOSX]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2032</guid>
		<description><![CDATA[Together with most of the internet, we tested IPv6 on World IPv6 day last week. I won&#8217;t go into details on what IPv6 is and why it&#8217;s important. Although IPv6 has been tested intensely in isolated networks, this is the first time it was tested on such a large scale. Technically, the participants would just [...]]]></description>
			<content:encoded><![CDATA[<p>Together with <a href="http://googleblog.blogspot.com/2011/01/world-ipv6-day-firing-up-engines-on-new.html">most</a> <a href="http://www.facebook.com/notes/facebook-engineering/world-ipv6-day-solving-the-ip-address-chicken-and-egg-challenge/484445583919">of</a> <a href="http://www.yahoo.com/">the</a> <a href="http://www.akamai.com/ipv6">internet</a>, we tested IPv6 on <a href="http://www.worldipv6day.org/">World IPv6 day</a> last week. I won&#8217;t go into details on what <a href="http://en.wikipedia.org/wiki/IPv6">IPv6</a> is and why it&#8217;s <a href="http://en.wikipedia.org/wiki/IPv6#Motivation_and_origins">important</a>. Although IPv6 has been tested intensely in isolated networks, this is the first time it was tested on such a large scale. Technically, the participants would just add <a href="http://en.wikipedia.org/wiki/IPv6_address#IPv6_addresses_in_the_Domain_Name_System">AAAA-records</a> for their websites to <a href="http://en.wikipedia.org/wiki/Domain_Name_System">DNS</a>. This small change causes a huge effect. Since most browsers are configured to prefer IPv6 AAAA-records over IPv4 A-records, this causes all IPv6-connected users to suddenly connect over IPv6 instead of IPv4.</p>
<p>For the most part, this major changeover happened without as much of a hitch. In fact, if I hadn&#8217;t known it was World IPv6 day, I wouldn&#8217;t have noticed anything. But I&#8217;m not a normal web-user, so I did notice some issues.</p>
<h3><span id="more-2032"></span>Where it did went wrong</h3>
<p>After some troubleshooting, they all boiled down to a single cause of oversight. They were not bugs or issues with IPv6 per se, just some &#8220;expected behavior&#8221; that we didn&#8217;t anticipate: IPv4-only VPNs.</p>
<p>Most servers in our datacenter are not publicly accessible; none of them are manageable over the public internet. In order to connect to them, you need a <a href="http://en.wikipedia.org/wiki/Virtual_private_network">VPN</a> connection. This serves multiple purposes: it secures all communication between client and server (so even plain-text http can be used securely to manage servers), it limits the number of users with access and most importantly (in the IPv4 world) it allows us to use <a href="http://www.apps.ietf.org/rfc/rfc1918.html">RFC1918 addresses</a> internally and still get the routing to work out. Technically it behaves an an extra (virtual) network card with a (virtual) cable connected straight to the datacenter. Additionally, some routes are configured automatically on the client to make sure traffic to the servers is sent over this &#8220;cable&#8221;.</p>
<p>We use two kinds of VPN-connections, but none of them was IPv6 enabled (i.e. could carry IPv6 data through the tunnel). Since by default client software prefers IPv6 connections, this caused the IPv6-internet connection to be preferred above the IPv4-VPN connection. Obviously, the firewall at the datacenter didn&#8217;t agree and refused access.</p>
<p>The solution was fairly obvious to state (enable IPv6 through the tunnels) but difficult to implement. In fact, I have not been able to get it to work well enough to install it on someone else&#8217;s computer.</p>
<h3>The attempts</h3>
<h4>IPsec in transport mode</h4>
<p>The &#8220;natural&#8221; solution would be to secure the IPv6 packets with <a href="http://en.wikipedia.org/wiki/IPsec">IPsec</a>, preferably in <a href="http://en.wikipedia.org/wiki/IPsec#Transport_mode">transport mode</a>, between the client and the firewall. Since there are no <a href="http://en.wikipedia.org/wiki/Network_address_translation">NAT</a>-issues, <a href="http://en.wikipedia.org/wiki/IPsec#Tunnel_mode">tunnel mode</a> is not required.</p>
<p><img class="alignnone size-full wp-image-2034" title="Network diagram" src="http://blog.dest-unreach.be/wp-content/uploads/2011/06/server-fw-client.png" alt="network diagram:  server (2001:db8:0:1::1) — (2001:db8:0:1::2) Firewall (2001:db8:1:0::2) — (2001:db8:1:1::3) client" width="700" height="143" /></p>
<p>However, I was not able to get this to work, even in manual keying mode (i.e. without <a href="http://en.wikipedia.org/wiki/Internet_Security_Association_and_Key_Management_Protocol">ISAKMP</a>). I couldn&#8217;t get <em>setkey</em> to accept the <em>src-dst</em> parameter in the SPD:</p>
<blockquote>
<pre># setkey -c
spdadd 2001:db8:0:1::1 2001:db8:1:1::3 any -P fwd ipsec esp/transport/2001:db8:1:0:2-2001:db8:1:1::3/require;
<em>^D</em>
# setkey -DP
2001:db8:0:1::1[any] 2001:db8:1:1::3[any] any
 fwd prio def ipsec
 esp/transport//require
 created: Jun 14 12:13:53 2011  lastused:                    
 lifetime: 0(s) validtime: 0(s)
 spid=1641 seq=1 pid=10485
 refcnt=1</pre>
</blockquote>
<p>This seems to be a Linux issue (Ubuntu 10.04 LTS with kernel 2.6.32-28-generic and ipsec-tools 0.7.1), since this does work on MacOSX (10.6.7).</p>
<h4>IPsec tunnel mode</h4>
<p>Since I&#8217;m not entirely sure that what I tried above (transport mode) is even supposed to work, I also tried tunnel mode. This worked, but is a pain to configure. I only tried manual keying, but using racoon to do username/password authentication will be even harder to explain to users…</p>
<p>The Mac built-in VPN client only supports &#8220;<a href="/2011/03/03/iphone-compatible-ipsec-vpn-on-an-ubuntu-server-with-ldap-authentication">Cisco IPsec</a>&#8220;. This uses the mode configuration stage to communicate the set of &#8220;networks&#8221; to tunnel (i.e. the SPD). However, according to <a href="http://netbsd.gw.com/cgi-bin/man-cgi?racoon.conf+5+NetBSD-current">racoon.conf man-page</a>, I can only push IPv4 networks in the <em>split_network</em> directive.</p>
<h4>OpenVPN with tun driver</h4>
<p>According to the <a href="http://openvpn.net/index.php/open-source/faq/77-server/287-is-ipv6-support-plannedin-the-works.html">OpenVPN FAQ</a>, IPv6 is only supported if the underlying <a href="http://en.wikipedia.org/wiki/TUN/TAP">TUN-driver</a> supports it. The <a href="http://tuntaposx.sourceforge.net/">tuntaposx-page</a> does not mention IPv6 at all and hasn&#8217;t been updated for almost 2 years, so this seems unlikely to work.</p>
<p>Also, OpenVPN does not provide configuration directives to push IPv6 routes over from server to client.</p>
<h4>OpenVPN with tap driver</h4>
<p>Even when using the TAP-driver and <a href="http://en.wikipedia.org/wiki/IPv6#Stateless_address_autoconfiguration_.28SLAAC.29">router advertisements</a>, MacOSX does not seem to like enabling IPv6… Even after manually enabling it, MacOSX still doesn&#8217;t pick up its SLAAC address:</p>
<blockquote>
<pre># ifconfig tap0
tap0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
 ether 7e:95:80:00:90:0e
 inet 192.0.2.10 netmask 0xffffff00 broadcast 10.90.9.255
 open (pid 3847)

# ip6config start-v6 tap0
Starting IPv6 on tap0.

# sleep 60 # Wait for Router advertisement to show up

# ifconfig tap0
tap0: flags=8843&lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&gt; mtu 1500
 ether 7e:95:80:00:90:0e
 inet 192.0.2.10 netmask 0xffffff00 broadcast 10.90.9.255
 inet6 fe80::7c95:80ff:fe00:900e%tap0 prefixlen 64 tentative scopeid 0xa
 open (pid 3847)</pre>
</blockquote>
<p>And this still doesn&#8217;t allow me to push IPv6 routes to the clients upon connecting.</p>
<h3>The conclusion</h3>
<p>IPv6 is very stable and capable, but there are certain network-issues where there is still some work to do. If you happen to know a VPN-solution which supports IPv6 and works on Windows, linux and Mac, please let me know!</p>
<p>Edit: I <a href="/2011/06/27/configuring-openvpn-to-support-ipv6">worked out my own solution</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/06/14/world-ipv6-day-lessons-learned/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>What Time Machine does not back up</title>
		<link>http://blog.dest-unreach.be/2011/05/11/what-time-machine-does-not-back-up</link>
		<comments>http://blog.dest-unreach.be/2011/05/11/what-time-machine-does-not-back-up#comments</comments>
		<pubDate>Wed, 11 May 2011 17:25:45 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[fail]]></category>
		<category><![CDATA[MacOSX]]></category>
		<category><![CDATA[TimeMachine]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2029</guid>
		<description><![CDATA[I was under the illusion that a Time Machine backup would do as they claim: You can set up Time Machine to automatically back up all your important files, including your documents, music, photos, applications, and any other items you keep on your hard disk. I consider my iTunes authorizations important, but apparently Apple does [...]]]></description>
			<content:encoded><![CDATA[<p>I was under the illusion that a Time Machine backup would do as they claim:</p>
<blockquote><p>You can set up Time Machine to automatically back up all your important files, including your documents, music, photos, applications, and any other items you keep on your hard disk.</p></blockquote>
<p>I consider my iTunes authorizations <em>important</em>, but apparently Apple does not. <a href="http://hymn-project.org/forums/viewtopic.php?p=19132">Seems</a> that these are specifically excluded from backups… Removing the &#8220;SC Info&#8221; line from the <em>/System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist</em> file solved this.</p>
<p>I know I should have de-authorized my machine before reinstalling, and I know you can &#8220;de-authorize all&#8221; to fix this as well; but it&#8217;s pretty disturbing to see iTunes remove all your applications from your iPhone…</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/05/11/what-time-machine-does-not-back-up/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting a public IPv4 address with Belgacom&#8217;s BBox-2</title>
		<link>http://blog.dest-unreach.be/2011/04/12/getting-a-public-ipv4-address-with-belgacoms-bbox-2</link>
		<comments>http://blog.dest-unreach.be/2011/04/12/getting-a-public-ipv4-address-with-belgacoms-bbox-2#comments</comments>
		<pubDate>Tue, 12 Apr 2011 12:43:30 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[b-box2]]></category>
		<category><![CDATA[dd-wrt]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[Ethernet]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=2006</guid>
		<description><![CDATA[The new installs of Belgacom&#8217;s DSL internet connection are actually fairly descend. They provide a &#8220;b-box 2&#8221; which provides 2 wired 10/100base-T ports and an 802.11g access point. It consumes 10.1W of power once booted (21VA with a cosφ of .47, measured with 241Vac), which costs around €22/year at the current prices. The box has a [...]]]></description>
			<content:encoded><![CDATA[<p>The new installs of <a href="http://www.belgacom.be/private/en/jsp/dynamic/productCategory.jsp?dcrName=internet_l&amp;rid=B_CBUPREHPATNAinternet_EN">Belgacom&#8217;s DSL internet connection</a> are actually fairly descend. They provide a &#8220;<a href="http://support.en.belgacom.be/app/answers/detail/a_id/14453">b-box 2</a>&#8221; which provides 2 wired 10/100base-T ports and an <a href="http://en.wikipedia.org/wiki/IEEE_802.11g-2003">802.11g</a> access point. It consumes 10.1W of power once booted (21VA with a cosφ of .47, measured with 241Vac), which costs around €22/year at the current prices. The box has a built-in router which performs the <a href="http://en.wikipedia.org/wiki/PPPoE">PPPoE</a> connection and does the <a href="http://en.wikipedia.org/wiki/NAT">NAT</a>. While this setup is perfectly fine for a regular setup, obviously I wanted something more…</p>
<p><span id="more-2006"></span>So I wanted my own router to establish the PPPoE connection and obtain a public IPv4 address. It seems that even here the default setup of the b-box2 is good: PPPoE passthrough is enabled by default. This technique allows you to establish a PPPoE connection from the &#8220;LAN&#8221;-side of the router, effectively bypassing it. There are <span class="removed_link" title="http://patrick.vande-walle.eu/belgacom-bbox-2-tricks/bbox-2-in-bridge/">numerous posts</span> how to reconfigure the b-box into <a href="http://tools.ietf.org/html/rfc1483">RFC 1483 bridge-mode</a>, but this is not required! So just plugging in my router and configuring PPPoE on it was enough!</p>
<p>There are some finishing touches however that can be learned from the bridge-posts:</p>
<ul>
<li>I disabled my PPPoE connection on the b-box itself. I will not be using it, so there is no need to waste a public IPv4 address here.<br />
In the webinterface (http://192.168.1.1/ by default) go to <em>Advanced Settings</em> – <em>Network Interfaces</em>. Open the <em>Wan PPPoE</em> and <em>Disable</em> it, confirm by clicking <em>OK</em>.</li>
<li>I also disabled the built-in WiFi access point, since I have my own 802.11n access point right next to it. This is even <a href="http://support.en.belgacom.be/app/answers/detail/a_id/14608/~/how-do-i-disable-the-wireless-function-of-my-b-box2%3F">officially documented</a>.<br />
<em>Advanced Settings</em> – <em>Wireless</em> and click <em>Deactivate</em>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/04/12/getting-a-public-ipv4-address-with-belgacoms-bbox-2/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tail-ing logfiles with visual timing</title>
		<link>http://blog.dest-unreach.be/2011/03/09/tail-ing-logfiles-with-visual-timing</link>
		<comments>http://blog.dest-unreach.be/2011/03/09/tail-ing-logfiles-with-visual-timing#comments</comments>
		<pubDate>Wed, 09 Mar 2011 09:45:33 +0000</pubDate>
		<dc:creator>Niobos</dc:creator>
				<category><![CDATA[Networking & Security]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://blog.dest-unreach.be/?p=1996</guid>
		<description><![CDATA[I regularly watch log files in real time using the highly appreciated tail -f command. But I usually find myself manually inserting newlines to give a visual clue of which log-lines happened together. Obviously the timestamps in the lines tell you the full story, but it&#8217;s not that visually appealing. So I wrote a very [...]]]></description>
			<content:encoded><![CDATA[<p>I regularly watch log files in real time using the highly appreciated <em>tail -f</em> command. But I usually find myself manually inserting newlines to give a visual clue of which log-lines happened together. Obviously the timestamps in the lines tell you the full story, but it&#8217;s not that visually appealing.</p>
<p><span id="more-1996"></span>So I wrote <a href="/wp-content/uploads/2011/03/logtail.pl">a very simple perl-script</a> that automates this for me. It behaves like <em>cat</em>, but inserts empty lines between input lines proportional to the amount of time between them. The numbers of lines inserted in logarithmically proportional to the elapsed time: one line for the first second, a second line for the next two seconds, a third line for the next 4 seconds, …</p>
<blockquote>
<pre>$ tail -f /var/log/mail.log | logtail.pl | sed 's/ .*//'
2011-03-09T10:33:02+01:00
2011-03-09T10:33:02+01:00
2011-03-09T10:33:02+01:00
2011-03-09T10:33:02+01:00
 
 
 
 
2011-03-09T10:33:36+01:00
2011-03-09T10:33:36+01:00
2011-03-09T10:33:36+01:00
 
 
 
 
2011-03-09T10:34:01+01:00
2011-03-09T10:34:01+01:00
 
 
 
 
 
2011-03-09T10:34:36+01:00
2011-03-09T10:34:36+01:00
2011-03-09T10:34:36+01:00
 
 
 
2011-03-09T10:34:48+01:00
2011-03-09T10:34:48+01:00
2011-03-09T10:34:48+01:00</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.dest-unreach.be/2011/03/09/tail-ing-logfiles-with-visual-timing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

