<?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>Kris Davidson</title> <atom:link href="http://www.krisdavidson.org/feed/" rel="self" type="application/rss+xml" /><link>http://www.krisdavidson.org</link> <description>The musings of a geek</description> <lastBuildDate>Fri, 22 Mar 2013 09:00:04 +0000</lastBuildDate> <language>en-US</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Icinga plugin state UNKNOWN after upgrade</title><link>http://www.krisdavidson.org/2013/02/14/icinga-plugin-state-unknown-after-upgrade/</link> <comments>http://www.krisdavidson.org/2013/02/14/icinga-plugin-state-unknown-after-upgrade/#comments</comments> <pubDate>Thu, 14 Feb 2013 11:16:15 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Misc]]></category> <category><![CDATA[Tips and Tweaks]]></category> <category><![CDATA[Icinga]]></category> <category><![CDATA[Monitoring]]></category> <category><![CDATA[Nagios]]></category> <category><![CDATA[NMS]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=244</guid> <description><![CDATA[I was updating the monitoring setup at work the other day and suddenly got hit by a few State: UNKNOWN - **ePN /usr/lib/nagios/plugins/check_rbl: plugin did not call exit() messages. When the plugin was executed outside of Icinga it worked fine, online searches revealed nothing of use, I spent ages trying to adjust the config file [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="I" class="cap"><span>I</span></span> was updating the monitoring setup at work the other day and suddenly got hit by a few <code>State: UNKNOWN - **ePN /usr/lib/nagios/plugins/check_rbl: plugin did not call exit()</code> messages.</p><p>When the plugin was executed outside of Icinga it worked fine, online searches revealed nothing of use, I spent ages trying to adjust the config file and check command for the plugin but with no success.</p><p>Eventually I was able to track it down to the embedded Perl interpreter used by Icinga. The solution was fairly simple I just had to add <code>nagios: -epn</code> as a comment within the <em>first 10</em> lines of the script. This told Nagios to use an external Perl interpreter when running this plugin.</p><p>This solution should apply to anything based on Nagios by the way: Icinga, Shinken, Centreon-Engine, Opsview, etc.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2013/02/14/icinga-plugin-state-unknown-after-upgrade/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Fear not for I have returned</title><link>http://www.krisdavidson.org/2012/07/05/fear-not-for-i-have-returned/</link> <comments>http://www.krisdavidson.org/2012/07/05/fear-not-for-i-have-returned/#comments</comments> <pubDate>Thu, 05 Jul 2012 09:31:18 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Tips and Tweaks]]></category> <category><![CDATA[Databases]]></category> <category><![CDATA[MySQL]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=240</guid> <description><![CDATA[It&#8217;s been a while since I last updated and the truth is I just don&#8217;t have time to write proper blog posts. Keeping that in mind, but still wishing to keep this up-to-date. I&#8217;ve decided to post quick tips and snippets that I find useful. Here&#8217;s the first: I&#8217;ve been doing some database work recently [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="I" class="cap"><span>I</span></span>t&#8217;s been a while since I last updated and the truth is I just don&#8217;t have time to write <em>proper</em> blog posts. Keeping that in mind, but still wishing to keep this up-to-date. I&#8217;ve decided to post quick tips and snippets that I find useful. Here&#8217;s the first:</p><p>I&#8217;ve been doing some database work recently and I wanted to unify the character set and collation for all databases and tables. Changing the database collation was easy to do in bulk. The tables less so and I was not manually changing 13,014 tables, eventually I came up with this:</p><pre class="brush: bash; light: true; title: ; notranslate">mysql --batch --skip-column-names --user=username --password=password --execute=&quot;select CONCAT('alter table ',TABLE_SCHEMA,'.',TABLE_NAME,' convert to character set utf8 collate utf8_general_ci;') from information_schema.TABLES WHERE TABLE_SCHEMA != 'information_schema' AND TABLE_SCHEMA != 'mysql' AND TABLE_SCHEMA != 'performance_schema';&quot; | mysql --user=username --password=password</pre><p>That should generate a bunch of statements that look like this:</p><pre class="brush: sql; light: true; title: ; notranslate">alter table database_name.table_name convert to character set utf8 collate utf8_general_ci;</pre><p>For every table in every database except the information_schema, mysql and performance_schema databases. I just pipe these right back in to MySQL but you can output them to a text file and run that later if you prefer. This snippet should also to be useful for any mass/multiple/bulk table edits or changes.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2012/07/05/fear-not-for-i-have-returned/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>I don&#8217;t know how that got on there</title><link>http://www.krisdavidson.org/2011/09/22/i-dont-know-how-that-got-on-there/</link> <comments>http://www.krisdavidson.org/2011/09/22/i-dont-know-how-that-got-on-there/#comments</comments> <pubDate>Thu, 22 Sep 2011 14:06:39 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Misc]]></category> <category><![CDATA[Computer Forensics]]></category> <category><![CDATA[Data Recovery]]></category> <category><![CDATA[Sysadmin]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=237</guid> <description><![CDATA[Someone handed me a couple of floppy disks the other day and wanted me to get some important files from them, these disks had been sitting in the back of a cabinet since 1996. I had three USB floppy drives and a couple of hardware floppy drives handy so I thought I&#8217;d give it a [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="S" class="cap"><span>S</span></span>omeone handed me a couple of floppy disks the other day and wanted me to get some important files from them, these disks had been sitting in the back of a cabinet since 1996. I had three USB floppy drives and a couple of hardware floppy drives handy so I thought I&#8217;d give it a go and tried both disks in each drive. All I got was erroring on almost every sector with messages like:</p><pre class="brush: bash; light: true; title: ; notranslate">sd 5:0:0:0: [sdc] CDB: Read(10): 28 00 00 00 01 1e 00 00 01 00 00 00 end_request: critical target error, dev sdc, sector 286
sd 5:0:0:0: [sdc] Unhandled sense code
sd 5:0:0:0: [sdc]  Result: hostbyte=invalid driverbyte=DRIVER_SENSE
sd 5:0:0:0: [sdc]  Sense Key : Medium Error [current] Info fld=0x11f
sd 5:0:0:0: [sdc]  Add. Sense: Recorded entity not found</pre><p>It&#8217;s most likely that these errors were caused by age but floppy disk drives also have differing alignment between the drive the data was written with and the drive used for reading the data.</p><p>There was only one thing I could do really and that was give ddrescue a try. There are two utilities called ddrescue, to be exact it was GNU ddrescue version 1.11. What I decided to do was try running ddrescue using three different read methods, on each disk in every drive (different alignments). My hope being that by writing to the same image file and using the logfile feature of ddrescue that I could amalgamate the good parts of each read into one complete image file.</p><p><em>Note: You&#8217;ll probably need to change the options below for each floppy device, file location, etc, if the drives are in different computers it&#8217;s probably easiest to save the files to some central location.</em></p><p>First we try to copy as much data as possible, without splitting sectors or retrying on failures:</p><pre class="brush: bash; light: true; title: ; notranslate">sudo ddrescue --verbose --no-split --cluster-size=1 /dev/sdc floppy1.img floppy1.log</pre><p>Now we retry any previous errors twice, using uncached reads:</p><pre class="brush: bash; light: true; title: ; notranslate">sudo ddrescue --verbose --direct --max-retries=2 --cluster-size=1 /dev/sdc floppy1.img floppy1.log</pre><p>Finally we try again but with the retrim option set, so that ddrescue will try to reread full sectors:</p><pre class="brush: bash; light: true; title: ; notranslate">sudo ddrescue --verbose --direct --retrim --max-retries=2 --cluster-size=1 /dev/sdc floppy1.img floppy1.log</pre><p>At this point you hopefully have a complete floppy disk image (I only had to use three of the available floppy drives) and then depending on the situation and damage you can either run the image through fsck, mount it, write it to a new disk or run it through a file carver.</p><p>In my situation I was able to use the mtools suite to copy the required files directly from the floppy disk image files.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2011/09/22/i-dont-know-how-that-got-on-there/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Kris&#8217; rules of IT</title><link>http://www.krisdavidson.org/2011/09/07/kris-rules-of-it/</link> <comments>http://www.krisdavidson.org/2011/09/07/kris-rules-of-it/#comments</comments> <pubDate>Wed, 07 Sep 2011 15:24:08 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Blogging]]></category> <category><![CDATA[Geekery]]></category> <category><![CDATA[Advice]]></category> <category><![CDATA[Sysadmin]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=228</guid> <description><![CDATA[I really need to post more but I&#8217;m just too busy (and lazy), it&#8217;s a pity I couldn&#8217;t script it like everything else I do. Anyway I was going through some old files of mine and I found this set of rules I put together for some colleagues a while back: No one reads anything. [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="I" class="cap"><span>I</span></span> really need to post more but I&#8217;m just too busy (and lazy), it&#8217;s a pity I couldn&#8217;t script it like everything else I do. Anyway I was going through some old files of mine and I found this set of rules I put together for some colleagues a while back:</p><ol><li>No one reads anything.</li><li>They forget what they read.</li><li>They deny what they have read.</li><li>Users and clients will lie.</li><li>Fast, cheap, reliable. Pick two.</li><li>Always cover your ass, but come clean when it&#8217;s your fault</li><li>Always backup even when told not to.</li><li>If you don&#8217;t have a replacement it will break soon.</li><li>Generally no one understands what you&#8217;re talking about or doing.</li><li>Rebooting while not ideal will usually fix a problem.</li></ol><dl><dt><strong>No one reads anything, They forget what they read, They deny what they have read</strong></dt><dd>All three of these are variations of the same principle, basically don&#8217;t make assumptions and expect people to have read anything. While it would be nice if they did review documentation, guides and announcements I&#8217;m not holding my breath.</dd><dt><strong>Users and clients will lie</strong></dt><dd>Some people will lie when you&#8217;re trying to troubleshoot, usually because they think they know what is wrong or because they&#8217;re feeling stupid or guilty and trying to cover themselves.</dd><dt><strong>Fast, cheap, reliable. Pick two</strong></dt><dd>Pretty self explanatory, something can be fast and cheap, fast and reliable or cheap and reliable, but not all three.</dd><dt><strong>Always cover your ass, but come clean when it&#8217;s your fault</strong></dt><dd>Don&#8217;t go overboard with this, I simply mean that you should get written confirmation (e-mail will do) whenever you&#8217;re asked to do something you think is illegal or whenever you want to do something that will potentially cause downtime. If you do happen to cause downtime then come clean immediately and explain what happened.</dd><dt><strong>Always backup even when told not to</strong></dt><dd>This is kind of like the covering your ass rule, but always backup and test those backups.</dd><dt><strong>If you don&#8217;t have a replacement it will break soon</strong></dt><dd>I don&#8217;t know why, call it unprecedented coincidence but every time I&#8217;ve ran out of replacements for something, even if it&#8217;s something that never needs replacing or was just replaced last week then I&#8217;ll need one.</dd><dt><strong>Generally no one understands what you&#8217;re talking about or doing</strong></dt><dd>This can be annoying but try to explain things in a simple and clear manner, using the terminology of the person you&#8217;re talking to while avoiding being patronising. As IT departments need to justify their existence sometimes it never hurts to keep time sheets or maintain a trouble/incident/help ticket system.</dd><dt><strong>Rebooting while not ideal will usually fix a problem</strong></dt><dd>We&#8217;re all aware of the &#8216;Have you tried turning it off and on again?&#8217; stuff, it usually works but a lot of the time it just fixes the symptoms instead of the underlying problem and it&#8217;s good to keep that in mind.</dd></dl> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2011/09/07/kris-rules-of-it/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>By your command</title><link>http://www.krisdavidson.org/2011/07/21/by-your-command/</link> <comments>http://www.krisdavidson.org/2011/07/21/by-your-command/#comments</comments> <pubDate>Thu, 21 Jul 2011 07:56:06 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[bash]]></category> <category><![CDATA[command line]]></category> <category><![CDATA[shell]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=223</guid> <description><![CDATA[It&#8217;s been a while since my last update, but as with any good IT guy I&#8217;ve been both too busy and too lazy to write anything. Anyway, I thought I&#8217;d make a note of some commands more for my own use that anyone else&#8217;s, but if someone else does find one useful then that&#8217;s a [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="I" class="cap"><span>I</span></span>t&#8217;s been a while since my last update, but as with any good IT guy I&#8217;ve been both too busy and too lazy to write anything. Anyway, I thought I&#8217;d make a note of some commands more for my own use that anyone else&#8217;s, but if someone else does find one useful then that&#8217;s a bonus.</p><p><strong>Split a file at a word or pattern into multiple files:</strong></p><pre class="brush: bash; light: true; title: ; notranslate">awk '/Pattern to split at/{n++}{print &gt; &quot;split&quot; n &quot;.txt&quot;}' FILE</pre><p><em>Notes:</em> Replace FILE with the file name you wish to run the command against.</p><p><strong>Take a screenshot via SSH:</strong></p><pre class="brush: bash; light: true; title: ; notranslate">DISPLAY=:0.0 import -window root /path/to/directory/screenshot.png</pre><p><em>Notes:</em> None.</p><p><strong>Search for something that looks like an e-mail address:</strong></p><pre class="brush: bash; light: true; title: ; notranslate">egrep -io '([[:alnum:]_.-]+@[[:alnum:]_.-]+?\.[[:alpha:].]{2,6})'</pre><p><em>Notes:</em> If don&#8217;t have egrep, replace <code> egrep -io</code> with <code>grep -Eio</code>.</p><p><strong>Run a query on multiple tables in a database matching a pattern</strong></p><pre class="brush: bash; light: true; title: ; notranslate">mysql -uUSER -pPASSWORD -D DATABASE_NAME -e &quot;show tables&quot; -s | egrep &quot;SEARCH_PATTERN&quot; | xargs -I &quot;@@&quot; mysql -uUSER -pPASSWORD -D DATABASE_NAME -e &quot;DROP TABLE @@;&quot;</pre><p><em>Notes:</em> Replace the markers where indicated (USER, PASSWORD etc) and obviously change the example query.</p><p><strong>Command line screencast</strong></p><pre class="brush: bash; light: true; title: ; notranslate">mkfifo /tmp/fifo;(nc -q0 -k -l -p 5000 &lt; /tmp/fifo &gt; /dev/null &amp;);script -f /tmp/fifo</pre><p><em>Notes:</em> Run <code>nc ADDRESS 5000</code> to connect and watch.</p><p><strong>Empty all log files</strong></p><pre class="brush: bash; light: true; title: ; notranslate">for file in $(find /var/log -type f); do &gt; $file; done;</pre><p><em>Notes:</em> None.</p><p><strong>Watch MySQL queries</strong></p><pre class="brush: bash; light: true; title: ; notranslate">watch -n 1 mysqladmin --user=USER --password=PASSWORD processlist</pre><p><em>Notes:</em> Replace the markers where indicated (USER, PASSWORD etc).</p><p><strong>Find potential duplicate files</strong></p><pre class="brush: bash; light: true; title: ; notranslate">find -not -empty -type f -printf &quot;%s\n&quot; | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate</pre><p><em>Notes:</em> None.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2011/07/21/by-your-command/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Mounting a case-insensitive filesystem on Linux</title><link>http://www.krisdavidson.org/2010/11/25/mounting-a-case-insensitive-filesystem-on-linux/</link> <comments>http://www.krisdavidson.org/2010/11/25/mounting-a-case-insensitive-filesystem-on-linux/#comments</comments> <pubDate>Thu, 25 Nov 2010 15:47:03 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Tips and Tweaks]]></category> <category><![CDATA[Case-insensitive]]></category> <category><![CDATA[Sysadmin]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=213</guid> <description><![CDATA[Recently I had a web developer who was coding on a Linux server, he was used to working on Windows servers and was having problems dealing with the case sensitivity of the EXT3 filesystem. I looked into it and in addition to using the Apache mod_speling [sic] module, also decided to go a step further. As [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="R" class="cap"><span>R</span></span>ecently I had a web developer who was coding on a Linux server, he was used to working on Windows servers and was having problems dealing with the case sensitivity of the EXT3 filesystem. I looked into it and in addition to using the Apache mod_speling [sic] module, also decided to go a step further. As root or using sudo do the following:</p><ol><li>Create a file of the size you wish the filesystem to be, 1GB in this example:<pre class="brush: bash; gutter: false; title: ; notranslate">dd if=/dev/zero of=fat32.disk bs=1K count=1M</pre></li><li>Format the filesystem, fat32 in this example but you can use NTFS or another case-insensitive file system:<pre class="brush: bash; light: true; title: ; notranslate">mkfs.vfat fat32.disk</pre></li><li>Mount the filesystem and test it, you may wish to use <code>uid=</code> and <code>gid=</code> to mount it as a specific user and you&#8217;ll probably want to adjust the <code>umask</code> to something less permissive:<pre class="brush: bash; light: true; title: ; notranslate">mount /media/fat32.disk /var/www/fat32 -t vfat -o loop,owner,group,umask=000</pre></li><li>Add it to <code>/etc/fstab</code> so that it gets mounted after a reboot:<pre class="brush: bash; light: true; title: ; notranslate">/media/fat32.disk /var/www/fat32 vfat loop,owner,group,umask=000 0 0</pre></li></ol><p>I wouldn&#8217;t use this for production systems, in that situation I&#8217;d recommend a dedicated FAT32 or NTFS partition. If you do have to run this on a production system it should be fine for 99% of setups, it just feels like a quick hack to me.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2010/11/25/mounting-a-case-insensitive-filesystem-on-linux/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Starting services in safe mode</title><link>http://www.krisdavidson.org/2010/09/11/starting-services-in-safe-mode/</link> <comments>http://www.krisdavidson.org/2010/09/11/starting-services-in-safe-mode/#comments</comments> <pubDate>Sat, 11 Sep 2010 17:23:42 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Windows]]></category> <category><![CDATA[Sysadmin]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=206</guid> <description><![CDATA[Recently I was trying to figure out how to start additional services in Windows safe mode. I had a user whose laptop kept crashing at login, I had a quick look and several theories came to mind but uptime was important, so as a temporary workaround I set it up in safe mode with networking. [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="R" class="cap"><span>R</span></span>ecently I was trying to figure out how to start additional services in Windows safe mode. I had a user whose laptop kept crashing at login, I had a quick look and several theories came to mind but uptime was important, so as a temporary workaround I set it up in safe mode with networking.</p><p>A few days later the user calls and wants to be able to print in safe mode. I look into it, do some searching, but the prevailing wisdom seemed to be that it wasn&#8217;t doable. This sounded like an MCP party line to me so I decide to explore the registry. Eventually I find the <code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control</code> key which has sub-keys of Minimal and Network. Minimal being safe mode, Network being safe mode with networking. It seems to be a whitelist of services, drivers and drive groups that are allowed to start or load.</p><p>Therefore it is possible to start additional services and load additional drivers in safe mode &#8211; just add a key for the service or driver short name, then a string for type. The below entry (if in a .reg file) would allow the Print Spooler to start in safe mode with networking.</p><pre class="brush: powershell; light: true; title: ; notranslate">[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Spooler]
@=&quot;Service&quot;
</pre><p>If you want a list of all drivers, driver groups and services starting in normal mode and their corresponding short names check <code>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services</code>.</p><p>I&#8217;d caution against whitelisting too much as it kind of defeats the purpose of safe mode, though in certain situations as a quick hack it can useful. It may also be something worth checking the next time you&#8217;re dealing with a particularly nasty malware infection. I haven&#8217;t seen anything which exploits it yet, but I imagine something does.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2010/09/11/starting-services-in-safe-mode/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Vim SnipMate plugin error and how to fix it</title><link>http://www.krisdavidson.org/2010/07/28/vim-snipmate-plugin-error-and-how-to-fix-it/</link> <comments>http://www.krisdavidson.org/2010/07/28/vim-snipmate-plugin-error-and-how-to-fix-it/#comments</comments> <pubDate>Wed, 28 Jul 2010 14:20:16 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Tips and Tweaks]]></category> <category><![CDATA[Vim]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=202</guid> <description><![CDATA[I have been moving back and forth between Emacs and Vim for about two years trying to pick one, I think Vim has finally won. I&#8217;ve been putting together a .vimrc and plugin set since then. I may write more on why I went with Vim and on my setup later, but I had a [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="I" class="cap"><span>I</span></span> have been moving back and forth between Emacs and Vim for about two years trying to pick one, I think Vim has finally won. I&#8217;ve been putting together a .vimrc and plugin set since then. I may write more on why I went with Vim and on my setup later, but I had a problem recently and I thought I&#8217;d post the fix I used:</p><p>I had just installed the SnipMate plugin which mimics the snippet functionality of TextMate, and every time I restarted I got an error stating:</p><pre class="brush: plain; gutter: false; title: ; notranslate">No mapping found</pre><p>I did some troubleshooting and narrowed it down to the <em>cpoptions=ces$</em> line in my .vimrc. This line makes the <code>cw</code> command and similar commands put a $ at the end instead of just deleting text and replacing it. I could see no reason for me to need this and just removed the line. That setting then defaulted back to <em>cpoptions=aABceFs</em> and the error was gone.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2010/07/28/vim-snipmate-plugin-error-and-how-to-fix-it/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>IPv6: Part 1 &#8211; I could see you all ignore the fact we&#8217;d fill up IPv4</title><link>http://www.krisdavidson.org/2010/06/03/ipv6-part-1-i-could-see-you-all-ignore-the-fact-wed-fill-up-ipv4/</link> <comments>http://www.krisdavidson.org/2010/06/03/ipv6-part-1-i-could-see-you-all-ignore-the-fact-wed-fill-up-ipv4/#comments</comments> <pubDate>Thu, 03 Jun 2010 05:21:00 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Networking]]></category> <category><![CDATA[IPv6]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[TCP/IP]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=115</guid> <description><![CDATA[After several friends asked about it, and because of the recent featured article on the BBC technology news site, I thought I would do a series on IPv6. I consider myself somewhat of an authority, because my honours project, dissertation and paper were on IPv6 &#8211; the actual title being IPv6, its implementation and migrating [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="A" class="cap"><span>A</span></span>fter several friends asked about it, and because of the recent featured article on the <a
title="BBC tech news article on dwindling IPv4 addresses" href="http://news.bbc.co.uk/1/hi/technology/10105978.stm">BBC technology news site</a>, I thought I would do a series on IPv6. I consider myself somewhat of an authority, because my honours project, dissertation and paper were on IPv6 &#8211; the actual title being IPv6, its implementation and migrating from IPv4 &#8211; I had what I thought were better ideas for a project but I figured IPv6 knowledge would increase my employability in the coming years.</p><p>The series starts with theory and need, then a few posts on local implementation, a couple of scenarios for wider implementation, then a final article on the reticence of the IT world to IPv6 and what I think is causing it.</p><p>So starting with theory and the need for IPv6, I know they&#8217;re not glamorous, I know to some they may be mind numbing and they&#8217;d rather just get on and do it, the whole don&#8217;t talk or discuss just do mentality. I can sympathise with this opinion. That being said, sorry no dice, you need a good mix of practical and theory otherwise you get into the area of call cargo cult system administration &#8211; I&#8217;ll probably discuss that phrase more in a future post &#8211; where you follow something like a ritual with no actual understanding.<span
id="more-115"></span></p><h3><strong>Why do we need IPv6?</strong></h3><p>The Internet currently runs on IPv4 whose addresses are 32 bits long, with an address space of 2<sup>32</sup> resulting in 4,294,967,296 or about 4.3 billion addresses. This was considered a suitably large number when IPv4 was created, but its running out, estimates vary from the conservative one year to the liberal five years &#8211; which assumes a lot of tinkering by the IANA, such tinkering would be prohibitively expensive in places and by no means certain &#8211; It doesn&#8217;t really matter which one is right, in the long run IPv4 is running out of addresses.</p><p>IPv6 addresses are 128 bits long with an address space of 2<sup>128</sup> resulting in 340,282,366,920,938,463,463,374,607,431,768,211,456 &#8211; having trouble saying that, well it&#8217;s 340-undecillion, 282-decillion, 366-nonillion, 920-octillion, 938-septillion, 463-sextillion, 463-quintillion, 374-quadrillion, 607-trillion, 431-billion, 768-million, 211-thousand, 456 or about 340 trillion, trillion, trillion addresses. This is currently considered a suitably large number with a high degree of future proofing. To give it some scale:</p><ul><li>Its enough addresses for many trillions of them to be assigned to every person on the planet. Assuming the earth has 6.5 billion people, each person could be assigned 2<sup>95</sup> or 3,961,481,257,132,168,796,771,975,168 addresses</li><li>The Earth is about 4.5 billion years old. If we had been assigning IPv6 addresses at a rate of 1 billion per second since then, we would have by now only used up less than one trillionth of the address space.</li></ul><p>For a more extensive and always up-to-date report on the exhaustion I&#8217;d recommend <a
title="IPv4 exhaustion report and counter." href="http://www.potaroo.net/tools/ipv4/index.html">Potaroo</a> (it also has a nice countdown widget).</p><h3><strong>You&#8217;re wrong, NAT and CIDR will save me?</strong></h3><p>No they won&#8217;t. The IT community saw this exhaustion coming in the early nineties, at the time they created NAT and CIDR to delay it while they worked on IPv6. NAT and CIDR have bought us about twenty years, we can&#8217;t really expect much more from them. I realise some of the imaginary people reading this may be insulted by my assumption in asking this question, I make it because one fairly senior internal IT guy from Abertay (my former university) who talked to me during the end of  year open day, tried to lecture me on how my project was crap because of NAT, after face-palming I proceeded to rip his argument apart. Since then though a friend from Dundee College IT support has conveyed similar opinions. I&#8217;m guessing that&#8217;s the preferred opinion of the alpha-geek in the area. I know it&#8217;s not a <a
title="The UKs academic research network" href="http://www.ja.net/">JANET</a> member opinion, so I&#8217;m guessing it&#8217;s just Dundee College and Abertay University or perhaps the prevailing opinion of <a
title="Fife and Tayside Metropolitan Area Network" href="http://www.fatman.net.uk/">FaTMAN</a> (Fife and Tayside Metropolitan Area Network).</p><p>The problem, the reason for this opinion is a lot of educational establishments still use public routable IPv4 addresses for clients, so they think they can just switch to NAT, sell on the addresses and that&#8217;ll be that. They fail to realise the scale of exhaustion, lets say they moved to NAT and it freed about two to ten thousand addresses per campus, that&#8217;s not going to make much of a difference; its negligible with current demand and that assumes no growth, also renumbering those addresses may not be practical or cost effective. I&#8217;ll probably cover this aversion to IPv6 in more details for the last article.</p><h3><strong>Wait what about IPv5?</strong></h3><p>There was an IPv5, also called the Internet Stream Protocol or ST. It was created in the late 1970s, IPv5 was designed to deal with streaming media &#8211; sending video, audio, and simulations over the Internet &#8211; It used IPv4 addressing, its main advantage over IPv4 UDP for media was that it offered connections and guaranteed QoS. For a while it gained a small following in places like IBM, Apple and Sun, they even revised it into ST+/ST2/ST2+. IPv5 was never accepted as a standard, the work done on it was not lost however, much of its concepts were implemented in MPLS. And That is why the next generation internet protocol is called IPv6 and not IPv5.</p><h3><strong>IPv6 addresses are too complicated?</strong></h3><p>IPv6 addresses are too complicated, the average user has trouble with IPv4, I mean 2001:41c8:0001:5a19:0000:0000:0000:0002 who&#8217;s going to remember that.</p><p>When I was first made aware of IPv6 I thought this also, since then after looking at it more closely, I&#8217;ve changed my mind. Lets explain the address hierarchy then break down that example address.</p><p>All IPv6 addresses consist of 8, 16 bit HEX blocks, separated by colons &#8211; this is known<br
/> as colon hexadecimal notation &#8211; as illustrated in the above example. IPv6 uses an address hierarchy &#8211; which incidentally also helps with routing &#8211; that looks like this:</p><pre class="brush: bash; light: true; title: ; notranslate"> Internet backbone -&gt; ISP -&gt; Organisation (building or individual connection) -&gt; Subnets -&gt; Hosts</pre><p>32 bits are assigned to each ISP from the Internet backbone and from this the ISP allocates 48 bit addresses to organisations. 48 bits are assigned to the organisation &#8211; combining the 32 bits from the ISP plus 16 bits for the organisation &#8211; and are globally unique, this is not assigned to the organisations entire global presence but rather to each site; to each external connection to the internet, so each will receive its own /48 address. 16 bits can then be used for organisational subnetting this gives us 65535 potential subnets. Leaving 64 bits to define unique hosts per subnet, giving us a potential 18,446,744,073,709,551,616 or eighteen quintillion, four-hundred-forty-six quadrillion, seven-hundred-forty-four trillion, seventy-three billion, seven-hundred-nine million, five-hundred-fifty-one thousand, six hundred and sixteen per each of the 65535 subnets. That last portion, which is just being assigned to hosts is twice the bit length of the entire IPv4 address pool. So a 128 bit IPv6 address can be viewed as two 64 bit addresses. The 64 bit address to the left defines the globally unique prefix or the 48 bits assigned by ISP and the 16 bits used for subnetting. The remaining 64 bits to the right are assigned to the host interface on an appropriate subnet.</p><p>Taking this back to the 2001:41c8:0001:5a19:0000:0000:0000:0002 example:</p><ul><li>2001:41c8 = 32-bits, which denotes the ISP.</li><li>2001:41c8:0001 = 48 bits (ISP + 16 bits) which are globally unique and assigned by the ISP from its /32 address.</li><li>5a19 = 16 bits to be used for subnetting purposes.</li><li>0000:0000:0000:0002 = 64 bits to be used to identify the host or network interface.</li></ul><p>There are perhaps some security or privacy concerns about hierarchical addressing but I&#8217;ll discuss them later.</p><p>Moving on to address complexity, in IPv6 addresses contiguous blocks of 16 bit zeros can be replaced with :: only one set of :: may be used per IPv6 address to avoid expansion confusion, leading zeros may be dropped. Notation may combine :: and dropped leading zeros to form a compressed IPv6 address, the following are all the same address and all considered valid:</p><ul><li>2001:41c8:0001:5a19:0000:0000:0000:0002</li><li>2001:41c8:0001:5a19:0:0:0:2</li><li>2001:41c8:1:5a19::2</li></ul><p>I&#8217;ll admit the addresses could still get complicated in certain situations, I think we need to move towards properly implemented DNS to solve this problem, but I have an unhealthy love and fascination for DNS so I would say that.</p><h3><strong>So what are the features of IPv6</strong></h3><p>IPv6 has a lot of features and improvements over IPv4 and while I won&#8217;t enumerate them all here, a few notable examples are listed below.</p><p>IPv6 has a new header format which is fixed length, this improves performance, lessens fragmentation and when combined with the use of link-local addresses offloads a lot of work from the router and networking layer to the protocol and transport layer.</p><p>IPv6 allows two types of configuration:</p><p><strong>Stateless -</strong> this is like a better version of the current APIPA 169.254.x.x addresses. With this method the host configures itself via multicast without a DHCPv6 server and/or router.</p><p><strong>Stateful -</strong> which is where the host configures itself with information provided from DHCPv6 server and/or router.</p><p>True automatic configuration is now possible, a link-local address is auto-configured for each IPv6 connected host. Each host will perform router solicitation via ICMPv6 router discovery messages, that is, it will search its default subnet for a router, which it will communicate with in order to gain further insight into the network and how it should configure itself. In addition IPv6 hosts can perform DHCPv6 solicitation, though DHCP is all but obviated in IPv6 networks not requiring advanced DHCP options. Router solicitation is preferable and has priority, both may be used in conjunction if certain DHCP specific configuration options are required. Generally routers pass along prefixes to be autoconfigured on IPv6 hosts and DHCPv6 servers pass along prefixes and/or additional settings, such as where to find NTP or WINS servers.</p><p>IPv6 supports three types of addresses:</p><p><strong>A unicast address -</strong> unique address for a device (host/router/phone/etc).</p><p><strong>A multicast address -</strong> groups common systems (routers/hosts/etc).</p><p><strong>An anycast address -</strong> represents the closest address, used heavily in multihomed environments, so if a server had three interface cards on different subnets and was providing the same service to each subnet an anycast address would represent the closest address to your subnet to contact that service. These address types lower overhead and increase network performance.</p><p>IPv6 hosts uses Neighbour Discovery (ND) over multicast to find hosts, ND replaces ARP and other broadcast-based techniques and lowers network overhead.</p><p>IPv6 obviates the need for NAT because all hosts/devices, including mobile devices are assigned a Globally Unique ID (GUID) based on the prefix assigned to your service provider. Devices are still secure with the use of a firewall or properly configured network, they just now have the potential of being public routable.</p><p>The minimum MTU is 1280-bytes compared to 576-bytes for IPv4, this means larger packets can be sent assuming bandwidth is available. IPv6 supports JumboGrams &#8211; packets larger than 64k; each IPv4 packet could only have a payload of up to 64 KB, while each IPv6 packet can have a payload of up to 4GB. While such large packets are unlikely to be a regular occurrence they have uses in high-MTU networks, such as upstream or back-end providers</p><h3><strong>Conclusion</strong></h3><p>Okay we&#8217;re done here, if you have any questions on the theory or need, post a comment. Beyond that be on the look out for part 2.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2010/06/03/ipv6-part-1-i-could-see-you-all-ignore-the-fact-wed-fill-up-ipv4/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>I am the gatekeeper&#8230;</title><link>http://www.krisdavidson.org/2010/05/22/i-am-the-gatekeeper/</link> <comments>http://www.krisdavidson.org/2010/05/22/i-am-the-gatekeeper/#comments</comments> <pubDate>Sat, 22 May 2010 18:17:54 +0000</pubDate> <dc:creator>Kris</dc:creator> <category><![CDATA[Networking]]></category> <category><![CDATA[BOFH]]></category> <category><![CDATA[DNS]]></category> <category><![CDATA[IPTables]]></category> <category><![CDATA[Sysadmin]]></category> <guid
isPermaLink="false">http://www.krisdavidson.org/?p=58</guid> <description><![CDATA[Are you the keymaster. Or how to stop some joker messing up your beautiful network by screwing with client side DNS. Scenario: You&#8217;re a system administrator/network administrator/IT guy (whatever you want to call it) with an excellent setup, and while you sit staring at the blinking lights in the comms room pondering the quintessential meaning [...]]]></description> <content:encoded><![CDATA[<p
class="first-child "><span
title="A" class="cap"><span>A</span></span>re you the keymaster. Or how to stop some joker messing up your beautiful network by screwing with client side DNS.</p><p><strong>Scenario:</strong> You&#8217;re a system administrator/network administrator/IT guy (whatever you want to call it) with an excellent setup, and while you sit staring at the blinking lights in the comms room pondering the quintessential meaning of things, or more realistically chatting on IRC (whatever floats your boat) you&#8217;re interrupted for the fifteenth time that week by <em>that</em> <span
style="text-decoration: line-through;">luser</span>, um user<sup>[<a
id="ref1" class="ref" href="#note1">1</a>]</sup> you were forced to give local admin access to. Turns out now they can&#8217;t access the intranet or send e-mail.</p><p>Upon investigating you find that once again this user has changed the DNS settings on their computer, breaking Active Directory/OpenLDAP/e-mail whatever, despite repeated warnings. They&#8217;re operating under the mistaken belief that using the DNS servers provided by OpenDNS, Google DNS or any number of resolvers found <a
title="DNS Server List - A website with a list of public DNS resolvers" href="http://www.dnsserverlist.org/">here</a>. Will make their Interweb downloads of funny cat pictures faster, you&#8217;ve tried chatting and explaining it to the guy, you tried approaching their line manager with no success. Short of beating the user with a hammer you need to find a way to resolve this situation, what do you do? You could block external DNS but that&#8217;s only half an answer. If they do it again it will break more connectivity.<span
id="more-58"></span></p><p><strong>Solution:</strong> What you need to do is intercept and redirect all DNS requests to a local server, so no matter what the user configures, no matter what dig or nslookup tells them they&#8217;re using, your local DNS will handle the queries. If you&#8217;re using something based on IPTables then the follow commands should do it, assuming a basic 192.168.1.0/24 network:</p><pre class="brush: bash; light: true; title: ; notranslate">iptables -t nat -A PREROUTING -p udp -i br0 --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -A PREROUTING -p tcp -i br0 --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -I PREROUTING -p udp -s 192.168.1.0/24 -d ! 192.168.1.0/24 --dport 53 -j DNAT --to 192.168.1.1
iptables -t nat -I PREROUTING -p tcp -s 192.168.1.0/24 -d ! 192.168.1.0/24 --dport 53 -j DNAT --to 192.168.1.1
</pre><p>Of course this depends on the nuances of your setup. Both sets of commands do the same thing but in slightly different ways, I tend to prefer the former set, but again it depends on your configuration. To test simply set a client to use external DNS and try to resolve an internal host, or you could even set a client to use an IP address you know runs no DNS server if you want to be extra sure it&#8217;s working. If you happen to use a Cisco device, I&#8217;m sure this can be done on them. I haven&#8217;t got my lab setup to check the syntax but I believe a transparent proxy or DNS doctoring will handle it depending on the device.</p><p>There you have it folks some words of wisdom from your uncle Kris, try not abuse them and say redirect every third to ninth DNS request to kittenwar.com. My final word on this is: Suck in the guts, guys, we&#8217;re the Ghostbusters.</p><hr
/><p><sup><a
id="note1" href="#ref1">Back</a></sup> &#8211; <strong>[1]</strong> &#8211; You know the guy I&#8217;m talking about. Most companies have at least one. The guy with just enough knowlege to be dangerous. He&#8217;s the wannabe, fancies himself in your job, constantly bad mouthing you, boasting about his audio-visual setup or how much he has overclocked something.</p> ]]></content:encoded> <wfw:commentRss>http://www.krisdavidson.org/2010/05/22/i-am-the-gatekeeper/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>