<?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>froztbyte.getBlog() &#187; dns</title>
	<atom:link href="http://blog.froztbyte.net/tag/dns/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.froztbyte.net</link>
	<description>returns the contents of froztbyte.blog</description>
	<lastBuildDate>Mon, 13 Oct 2014 20:19:25 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0</generator>
	<item>
		<title>Elegua</title>
		<link>http://blog.froztbyte.net/2012/09/elegua/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=elegua</link>
		<comments>http://blog.froztbyte.net/2012/09/elegua/#comments</comments>
		<pubDate>Wed, 26 Sep 2012 10:28:31 +0000</pubDate>
		<dc:creator><![CDATA[froztbyte]]></dc:creator>
				<category><![CDATA[minipost]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[elegua]]></category>
		<category><![CDATA[psa]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://blog.froztbyte.net/?p=309</guid>
		<description><![CDATA[Public Service Announcement Anyone who makes use of elegua, the transition of services on it is now complete and I&#8217;ve updated the main A and AAAA records to point at the new host. If you have any issues, you know &#8230;<p class="read-more"><a href="http://blog.froztbyte.net/2012/09/elegua/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<h3>Public Service Announcement</h3>
<p>Anyone who makes use of elegua, the transition of services on it is now complete and I&#8217;ve updated the main A and AAAA records to point at the new host.</p>
<p>If you have any issues, you know where to find me.</p>
<p>(That said, the original TTLs were like six gazillion years or something, so caches might flush later as they go. Query the upstream NS for the new record if you need it.)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.froztbyte.net/2012/09/elegua/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Everything is not &#8220;just a string&#8221;</title>
		<link>http://blog.froztbyte.net/2012/08/everything-is-not-just-a-string/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=everything-is-not-just-a-string</link>
		<comments>http://blog.froztbyte.net/2012/08/everything-is-not-just-a-string/#comments</comments>
		<pubDate>Thu, 23 Aug 2012 10:26:27 +0000</pubDate>
		<dc:creator><![CDATA[froztbyte]]></dc:creator>
				<category><![CDATA[minipost]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[punycode]]></category>
		<category><![CDATA[strings]]></category>
		<category><![CDATA[text]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://blog.froztbyte.net/?p=287</guid>
		<description><![CDATA[During a quick conversation on unicode and punycode, I managed to find http://☁→❄→☃→☀→☺→☂→☹→✝.ws Cute, and a sad reminder of how many people still fight this.]]></description>
				<content:encoded><![CDATA[<p>During a quick conversation on unicode and punycode, I managed to find <a href="http://☁→❄→☃→☀→☺→☂→☹→✝.ws">http://☁→❄→☃→☀→☺→☂→☹→✝.ws</a></p>
<p>Cute, and a sad reminder of how many people still fight this.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.froztbyte.net/2012/08/everything-is-not-just-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS Platform Migration Fun</title>
		<link>http://blog.froztbyte.net/2011/08/dns-platform-migration-fun/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dns-platform-migration-fun</link>
		<comments>http://blog.froztbyte.net/2011/08/dns-platform-migration-fun/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 00:14:17 +0000</pubDate>
		<dc:creator><![CDATA[froztbyte]]></dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://blog.froztbyte.net/?p=23</guid>
		<description><![CDATA[This post could go by the alternative title &#8220;Screw you, ISC, and thanks for making software that makes me hate DNS even more&#8221;. So let&#8217;s dive right in, shall we? (to those who don&#8217;t care for the intermediate ranting and &#8230;<p class="read-more"><a href="http://blog.froztbyte.net/2011/08/dns-platform-migration-fun/">Read more &#187;</a></p>]]></description>
				<content:encoded><![CDATA[<p>This post could go by the alternative title &#8220;Screw you, ISC, and thanks for making software that makes me hate DNS even more&#8221;. So let&#8217;s dive right in, shall we?</p>
<p><em>(to those who don&#8217;t care for the intermediate ranting and DNS explanations, page down for the tech bits)</em></p>
<p>There are various criticisms of the Domain Name System — the thing which enables anything on the internet to turn &#8220;www.google.com&#8221; or any other such name into something that is meaningful to a computer (see <a href="http://cr.yp.to/djbdns/intro-dns.html">here</a>) — but for the most part it works reasonably well. You set up some DNS software, perhaps battle with the config for a while, and then it works. But as a quote I&#8217;ve seen somewhere (and can&#8217;t find the origin of now with a quick search) says, &#8220;you can&#8217;t truly recommend some software [tool] until you can tell me why it sucks.&#8221; And ISC&#8217;s BIND is arguably a highly irritating piece of software, which has over the years led to a rise in popularity for various other options. Amongst these you&#8217;ll find some general free/opensource implementations, as well as some commercial platforms:</p>
<ul>
<li><a href="http://www.maradns.org/">MaraDNS</a></li>
<li><a href="http://cr.yp.to/djbdns.html">djbdns</a></li>
<li><a href="http://www.powerdns.com/content/home-powerdns.html">PowerDNS</a></li>
<li><a href="http://www.infoblox.com/en/home.html">Infoblox</a></li>
<li><a href="http://www.bluecatnetworks.com/solutions/dns_dhcp">Bluecat Adonis</a></li>
<li><a href="http://aws.amazon.com/route53/">Route53</a></li>
</ul>
<div><span class="Apple-style-span" style="line-height: 18px;">(That&#8217;s the nice thing about diversity and openness — in this regard, an open protocol — you always get some choice and you can pick which one best suits your needs.)</span></div>
<p>&nbsp;</p>
<div>Some years ago, long before my time at my current employer, there was a business requirement for some DNS support in our product suite. And BIND was chosen as the platform, since it&#8217;s a fairly well-known one. As time progresses, so do the things we do, and one day we found BIND was no longer sufficient to do what we needed to. Amongst others, things like a supermaster (a master from which a slave will accept all domain information, regardless of whether that slave knows of such a domain) and dynamic backend functionality were some of those needs.<br />
Now some options like <a href="http://bind-dlz.sourceforge.net/">bind-dlz</a> and friends existed, but none of these really suited us. In the end we decided upon PowerDNS with our own custom software written to handle the dynamic things as business rules would require, and set forth on this path. Some time passes with <a href="http://geekz.za.net/">Rossi</a> writing all the backend code which we&#8217;ve then successfully been running in combination with PowerDNS for some time now.</div>
<p>&nbsp;</p>
<div>Of course, we still have all those old BIND-based installations to get upgraded, and this is that tale. Thankfully, the latest version of our platform was designed with exactly this sort of scenario in mind, since we have to inter-operate with other AXFR-speaking nameservers. So I think &#8220;let&#8217;s just use the config interface to add the migration host as a second slave, massage the data as required on there and then port that data over to the new platform&#8221; even as a tiny voice in my head says &#8220;it&#8217;s never that simple and you know it.&#8221; About 2 hours later I&#8217;m found at my desk swearing violently about all manner of things, which is my out when dealing with frustrating software. This is because I&#8217;d ended up trying to find out why BIND wasn&#8217;t actually slaving anything to my &#8220;new&#8221; nameserver, even though all the configs and zonefiles were right. Not just that, it had also at some point stopped slaving everything it should to the secondary nameserver, which at this point isn&#8217;t a worry since I&#8217;m replacing it anyway.</div>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;">:: TECH ::</span></p>
<div>After figuring out the bits of the migration that matter — such as fixing up the SQL output (from the handy</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">zone2sql</div></td></tr></tbody></table></div>
<p>tool from pdns) that had some oddities due to what looked like multiple $ORIGIN statements in one file — had been figured out, it was pretty painless to move. There were some fun points, like handling multiple $INCLUDE statements in a zonefile, and *hattip* to <a href="http://vhata.net">Jonathan Hitchcock</a> (for the pre- and post-insert idea) and <a href="http://bryndivey.co.za/">Bryn Divey</a> (for googling better than I).</div>
<p>&nbsp;</p>
<div>So, sed trick 1, splitting the file into parts:</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat foo.zone | sed -n '1,/match/p' &amp;gt; firstbit<br />
cat foo.zone | sed -n '1,/match/!p' &amp;gt; secondbit<br />
cat firstbit secondbit &amp;gt; newfoo</div></td></tr></tbody></table></div>
<div>Sed trick 2, reading in an external file to use it as the replacement text. We have:</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># grep INCLUDE 10_in-addr_arpa.zone<br />
$INCLUDE &quot;/var/cache/bind/10_in-addr_arpa.zone.ns&quot;;<br />
$INCLUDE &quot;/var/cache/bind/10_in-addr_arpa.zone.mx&quot;;</div></td></tr></tbody></table></div>
<div>We do:</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sed -i '/$INCLUDE.*\.ns.*$/ r 10_in-addr_arpa.zone.ns' 10_in-addr_arpa.zone<br />
sed -i '/$INCLUDE.*\.mx.*$/ r 10_in-addr_arpa.zone.mx' 10_in-addr_arpa.zone<br />
&lt;code&gt;</div></td></tr></tbody></table></div>
<p></code></p>
<div>And tada, instant awesome. This reads the 10_in-addr_arpa.zone.mx file for us, and replaces from the appropriate &#8220;$INCLUDE&#8221; start to end with the contents of said file.</div>
<p>&nbsp;</p>
<div>Another issue I ran into was having the generate the appropriate reverse-entry zones for all the public IP netblocks, and with two /21s and a /18 to worry about I wasn&#8217;t planning to do myself if I could help it, so I employed a quick hack with ipcalc and dnspython to transform my /18 into its various component /24s, and then generate reverses:</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ipcalc 11.22.33.0/18 /24 | grep 'Network.*/24' | awk '{print $2}' | cut -d&quot;/&quot; -f 1<br />
11.22.0.0<br />
11.22.1.0<br />
11.22.2.0<br />
...</div></td></tr></tbody></table></div>
<div>We can then easily manipulate these in python or sed or cut, depending on how hacky we feel, but I went with python since I was already using MySQLdb to insert the records after massaging them into the right form.</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&amp;gt;&amp;gt;&amp;gt; import dns.reversename<br />
&amp;gt;&amp;gt;&amp;gt; range = &quot;10.22.0.0&quot;<br />
&amp;gt;&amp;gt;&amp;gt; print dns.reversename.from_address(range).to_text().split(&quot;.&quot;,1)[1]<br />
0.22.10.in-addr.arpa.</div></td></tr></tbody></table></div>
<div>And that&#8217;s it for somewhat useful little tricks. There was a bit of a discussion had about delimited formats like this, and Piet Delport (see blogroll) hacked up a neat little delimited datatype which you can find over <a href="http://elegua.za.net/~froztbyte/delimited.py">here</a>. Quick usage instructions:</div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&amp;gt;&amp;gt;&amp;gt; d = delimited('foo.bar.baz', '.'); d.sort(); print d<br />
bar.baz.foo<br />
d[1:] -&amp;gt; 'bar.baz'<br />
d[1:2] = ['x', 'y', 'z']; d -&amp;gt; 'foo.x.y.z.baz'<br />
&amp;gt;&amp;gt;&amp;gt; d = delimited('0.2.1.10.in-addr.arpa', '.'); del d[0]; print d<br />
2.1.10.in-addr.arpa.</div></td></tr></tbody></table></div>
<div>And now as the sounds of Mogwai, Flunk and Placebo massage my tired noggin, it&#8217;s time for me to go to bed.</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.froztbyte.net/2011/08/dns-platform-migration-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
