<?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>BrainDeadProjects.com</title>
	<atom:link href="http://www.braindeadprojects.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.braindeadprojects.com/blog</link>
	<description>A place for low-grade evil.</description>
	<lastBuildDate>Mon, 20 Feb 2012 23:26:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>An upgrade to Ubiquiti</title>
		<link>http://www.braindeadprojects.com/blog/what/an-upgrade-to-ubiquiti/</link>
		<comments>http://www.braindeadprojects.com/blog/what/an-upgrade-to-ubiquiti/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 23:26:24 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[Engenius]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[OpenWRT]]></category>
		<category><![CDATA[What?!]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1637</guid>
		<description><![CDATA[I&#8217;ve been _extremely_ impressed with the quality of Engenius&#8216; products, most specifically the EOC-2610. For the 2 years that I&#8217;ve had my two units in service, I&#8217;ve had very little issue with them. Recently my workplace ordered a batch of Ubiquiti products from DoubleRadius. Ubiquiti is loved by the WISP world, and (mostly) utilize Atheros [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been _extremely_ impressed with the quality of <a title="Engenius" href="http://www.engeniustech.com/" target="_blank">Engenius</a>&#8216; products, most specifically the <a title="EOC-2610" href="http://www.engeniustech.com/business-networking/discontinued-eol/287-80211g-outdoor-high-power-600mw-bridge-access-point-with-dual-antennas" target="_blank">EOC-2610.</a> For the 2 years that I&#8217;ve had my two units in service, I&#8217;ve had very little issue with them.</p>
<p>Recently my workplace ordered a batch of <a title="Ubiquiti" href="http://www.doubleradius.com/Products/Ubiquiti-UBNT-Wireless" target="_blank">Ubiquiti products from DoubleRadius</a>. Ubiquiti is loved by the <a title="WISPA" href="http://wispa.org" target="_blank">WISP</a> world, and (mostly) utilize <a title="Atheros" href="http://www.qca.qualcomm.com/" target="_blank">Atheros</a> boards &#8211; just as the Engenius products do. Both also have stock firmware that&#8217;s also based off <a title="OpenWRT" href="https://openwrt.org/" target="_blank">OpenWRT</a>. Being inspired, I purchased some equipment myself.</p>
<p>Part of the reason the Ubiquiti gear seems to be more popular is their excellent support and web forum. Engenius is notoriously difficult to get any answers out of. I&#8217;ve still yet to get a copy of their firmware source required by the GPL, and I gave up long ago trying to get anywhere. Luckily, the few questions I did have were answered by simply expirementing.</p>
<p>This weekend I began the migration to Ubiquiti. My first rollout involves a <a title="RocketM2" href="www.ubnt.com/downloads/rocketM2_DS.pdf" target="_blank">Rocket M2</a> and a <a title="120 degree sector" href="ubnt.com/downloads/AirMax5GSectors.pd" target="_blank">120 degree sector antenna</a>. For the past few weeks I&#8217;ve been working on adding a more recent version of the excellent CoovaChilli to the device. I have located a version of the <a title="CoovaAP" href="http://coova-ap.s3.amazonaws.com/ubnt/index.html" target="_blank">CoovaAP firmware </a>that runs natively on a Rocket M2, however it lacked a number of features (non-Chilli related) that I was hoping for. After much searching, I&#8217;ve been able to locate a 5.3 SDK (which features AirControl and the built-in spectrum analyzer).</p>
<div id="attachment_1757" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/AirView.png"><img class="size-medium wp-image-1757" title="AirView" src="http://www.braindeadprojects.com/blog/wp-content/AirView-300x218.png" alt="AirView" width="300" height="218" /></a><p class="wp-caption-text">The AirView built in spectrum analyzer</p></div>
<p>As I mentioned, it took quite a bit of searching to obtain the SDK. According to Kevin Perry at Ubiquiti  &#8220;We&#8217;ve had to temporarily remove the SDKs from our site to comply with US export control regulations. Once approved, we will be able to continue providing SDKs. &#8220;  I&#8217;ve not heard anything new, and that correspondence is from September of 2011.</p>
<p>Of course, the Internet is a not only a compendium of 140-word-or-less Tweets about what someone just ate for dinner, it&#8217;s also a <a title="The Wayback Machine" href="http://www.archive.org/index.php" target="_blank">giant archive of the past</a>. And with a bit of searching, I came across the SDK still hosted (albeit hidden) on Ubiquiti&#8217;s site.</p>
<p>Unfortunately the latest SDK is 5.5, and not 5.3. I&#8217;ve not had luck locating it (and it does contain the patch for the <a title="The SkyNet worm" href="http://forum.ubnt.com/showthread.php?t=45169&amp;highlight=exploit" target="_blank">SkyNet worm</a>), so I&#8217;m working off 5.3 for the time being. I&#8217;ve locked down access to the web interface to prevent infection from the worm.</p>
<div id="attachment_1762" class="wp-caption aligncenter" style="width: 185px"><a href="http://coova.org/"><img class="size-full wp-image-1762" title="CoovaLogo2_0" src="http://www.braindeadprojects.com/blog/wp-content/CoovaLogo2_0.png" alt="CoovaLogo2_0" width="175" height="175" /></a><p class="wp-caption-text">The CoovaChilli Captive Portal</p></div>
<p>With the SDK in tow, I began the work of inserting <a title="CoovaChilli" href="http://coova.org/CoovaChilli" target="_blank">CoovaChilli</a> into the system. Ubiquiti ensures important services stay running by having them spawned (and respawned if needed) via inittab. The stock inittab on the system is basic, handling only login and a couple of runlevel items. Prior to /sbin/init starting, the system runs a bash script /init. This in turn handles filesystem mounts, makes a handful of device nodes, copies a number of files into place, partially configures sysinit, and sets the timezone. It also calls ubntconf which gleans information from the nvram variables, prior to executing the traditional /sbin/init.</p>
<p>ubntconf is a closed source application, although it&#8217;s pretty easy to glean most of it&#8217;s operations by simply running <a title="Strings!" href="http://linux.about.com/library/cmd/blcmdl1_strings.htm" target="_blank">strings</a> on it (It is an <a title="Elves in my binaries" href="http://en.wikipedia.org/wiki/Executable_and_Linkable_Format" target="_blank">ELF</a> not a script). Depending upon nvram variables that are set, different scripts are dropped into /etc/sysinit. Additionally, items are added to /etc/inittab like this:</p>
<blockquote><p>null::respawn:/bin/pppd eth0<br />
null::respawn:/bin/lighttpd -D -f /etc/lighttpd.conf<br />
null::respawn:/bin/dropbear -F -d /etc/persistent/dropbear_dss_host_key -r /etc/<br />
persistent/dropbear_rsa_host_key -p 22</p>
</blockquote>
<p>Each of these entries will respawn the corresponding service should it crash. Using their system as a model, I created my own config creator &#8220;chilliconf&#8221; to add entries to inittab for the chilli daemon, in addition to the necessary iptables rules in /etc/sysinit, and a few modifications to their use of dnsmasq (I wanted to syslog DNS queries offsite). When I later added <a title="NProbe" href="http://www.ntop.org/products/nprobe/" target="_blank">NProbe</a> to my firmware, I also used my chilliconf configurator to add it to the inittab.</p>
<p>My chilliconf configurator, like ubntconf, is called from the /init script.</p>
<p>One thing of note &#8211; any daemon listed in the inittab file needs to actually run in the foreground (so calling the process a daemon isn&#8217;t entirely accurate). This is for the obvious reason that the initiating process <a title="Fork information" href="http://linux.die.net/man/2/fork" target="_blank">fork()s</a> then exits &#8211; so inittab will continually respawn the service until you run out of resources.</p>
<div id="attachment_1642" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/UBNTmainmenu1.png"><img class="size-medium wp-image-1642" title="No Strings Attached" src="http://www.braindeadprojects.com/blog/wp-content/UBNTmainmenu1-300x230.png" alt="No Strings Attached" width="300" height="230" /></a><p class="wp-caption-text">All original functionality is still there. It&#39;s a like a cyborg version of itself.</p></div>
<p>I used the <a title="CoovaAP for 3.3" href="http://coova-ap.s3.amazonaws.com/ubnt/index.html" target="_blank">3.6SDK version of CoovaAP</a> as a model for my web interface. Adding a tab was fairly easy &#8211; the web interface is maintained as the ubnt-web package in the SDK. Most of the web CGI is <a title="PHP/FI" href="http://php.net/manual/phpfi2.php" target="_blank">PHP/FI</a> (with a couple of functions added to PHP to facilitate saving configs and reading values). The code is extremely readable, and easy to figure out.</p>
<p>When you save your settings in the Ubiquiti web interface, you&#8217;re presented with a blue message bar asking if you&#8217;d like to test or apply your settings. In either case, you&#8217;ll be disconnected for a moment while the system reconfigures itself. This appears to be done via a call to the original /init script. The blue bar is a bit of a problem when adding a new tab to the menu.</p>
<p>The background image for the blue bar (msg.png) is originally  745 pixels, and the screen width is set to 790 pixels. With an added tab, the screen width becomes 866 pixels. Using <a title="GIMP, my good friend" href="http://www.gimp.org/" target="_blank">GIMP</a> I resized this image to 821 pixels.</p>
<div id="attachment_1644" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/BlueMenu.png"><img class="size-medium wp-image-1644" title="The Blue Message Menu" src="http://www.braindeadprojects.com/blog/wp-content/BlueMenu-300x57.png" alt="The Blue Message Menu" width="300" height="57" /></a><p class="wp-caption-text">Resize the blue background to fit.</p></div>
<ul>
<li>Originally it was 745, with the original screen width of 790.
<ul>
<li>790-745 = 45.</li>
<li>866-45 = 821 &#8212; our newly resized image.</li>
</ul>
</li>
</ul>
<p>The web interface went through a few iterations before I had all the options I presently needed. CoovaChilli&#8217;s <em>dnsdomainlocal</em> option is problematic &#8211; causing any DNS query that returns an NXDOMAIN error for an A record to cause a redirect to the portal. Unfortunately the portal (from my experience) doesn&#8217;t properly track in this instance if the MAC associated with the request is authenticated &#8211; and redirects the user back to the UAMSERVER with the &#8220;res=notyet&#8221; variable. This means the user is prompted with a login screen unnecessarily.</p>
<p>In other words, visit &#8220;adfasjzc9vdsa0f9jdsaf.com&#8221;, and you&#8217;re presented with a login screen even after you&#8217;re logged in.  Adding the option to disable <em>dnsdomainlocal</em> fixes this problem.</p>
<div id="attachment_1652" class="wp-caption alignnone" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/coovamenu.png"><img class="size-medium wp-image-1652" title="The CoovaChilli Tab" src="http://www.braindeadprojects.com/blog/wp-content/coovamenu-300x240.png" alt="The CoovaChilli Tab" width="300" height="240" /></a><p class="wp-caption-text">The CoovaChili tab (with NProbe)</p></div>
<p>By default, I have the &#8220;<em>dhcpradius</em>&#8221; option enabled. With this feature, when a DHCP request is received by the CoovaChilli server, it forwards the MAC address to the radius server (as both the username and password) for authentication. If it doesn&#8217;t authenticate, the system redirects the user back to the UAMServer for a captive portal login.</p>
<div class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/img/Ubiquiti/IMAG0948.JPG" target="_blank"><img class="  " title="The North Facing Access Point" src="http://www.braindeadprojects.com/img/Ubiquiti/IMAG0948.JPG" alt="The North Facing Access Point" width="300" height="240" /></a><p class="wp-caption-text">Broadcasting throught the stratosphere</p></div>
<p>For the time being, the system is a bit overkill, but the options it presents for the future are many. CoovaChilli can rate-limit individual users based on login or MAC address. This alone opens the door for a pay-for-bandwidth model. If a user is found to be filesharing (legal or not) or otherwise consuming an inordinate amount of bandwidth, they can be easily ratelimited.</p>
<p>I still have a few minor items to add to the firmware (including the ability to pull <a title="RSSI" href="http://en.wikipedia.org/wiki/Received_signal_strength_indication" target="_blank">RSSI</a> information per client), but in the meantime it&#8217;s been fun working with the Rocket M2. The access point is now being tested in the neighborhood.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/an-upgrade-to-ubiquiti/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Midtown Wifi &#8211; the internals.</title>
		<link>http://www.braindeadprojects.com/blog/what/midtown-wifi-the-internals/</link>
		<comments>http://www.braindeadprojects.com/blog/what/midtown-wifi-the-internals/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 01:49:40 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[Blender]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Engenius]]></category>
		<category><![CDATA[GIMP]]></category>
		<category><![CDATA[What?!]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1658</guid>
		<description><![CDATA[In the next few days, I&#8217;ll be upgrading my north facing access point from Engenius to Ubiquiti. The firmware is already written, and I have most everything prepped for the rooftop mount. Before I post about working with the (hidden) Ubiquiti 5.3 SDK, I thought I&#8217;d give a quick tour of my system so far. [...]]]></description>
			<content:encoded><![CDATA[<p>In the next few days, I&#8217;ll be upgrading my north facing access point from <a title="The Engenius Website" href="http://www.engeniustech.com/" target="_blank">Engenius</a> to <a title="The Ubiquiti Homepage" href="http://www.ubnt.com/" target="_blank">Ubiquiti</a>. The firmware is already written, and I have most everything prepped for the rooftop mount. Before I post about working with the (hidden) Ubiquiti 5.3 SDK, I thought I&#8217;d give a quick tour of my system so far.</p>
<p>With Midtown Wifi I had the following goals:</p>
<ol>
<li>Work more in the <a title="C" href="http://en.wikipedia.org/wiki/C_%28programming_language%29" target="_blank">C language.</a></li>
<li>Build a stable and (mostly) embedded captive portal system with a minimal ToS acceptance screen.</li>
<li>Let the surrounding neighborhood use the Internet for free in exchange for helping me build and test the system.</li>
<li>Use the system as a way to introduce neighbors, let them post local interest items (missing pets, crime reports, events, etc).</li>
<li>Provide maps of recently reported crimes via the Harrisburg, PA online Police Blotter.</li>
</ol>
<p>Over the years I&#8217;ve accomplished all of this, to one degree or another. <a title="Harrisburg PA" href="http://harrisburgpa.gov/" target="_blank">Harrisburg, PA</a> is in the midst of some serious financial problems, so their online police blotter has gone away  &#8211; preventing me from easily obtaining local crime information. People are what they are, and as Google+, MySpace, and any other Social Site knows &#8212; getting people to truly use your social portal is a trick that requires sheer genius. Getting them to log into it and push a &#8220;Free Wifi&#8221; button however, is easy.</p>
<div id="attachment_1659" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiLogin.png"><img class="size-medium wp-image-1659" title="MidtownWifiLogin" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiLogin-300x240.png" alt="MidtownWifiLogin" width="300" height="240" /></a><p class="wp-caption-text">The Midtown Wifi Login Screen (as of Feb 15, 2012)</p></div>
<h3>How it works:</h3>
<p>After connecting to one of the open access points, the end user is redirected (courtesy of a patched <a title="NoDogSplash" href="http://kokoro.ucsd.edu/nodogsplash/" target="_blank">NoDogSplash</a>) to a captive web portal. The web portal is based off <a title="The Elgg Social Networking Engine" href="http://www.elgg.org/" target="_blank">Elgg</a>, a fairly easy to use Social Network Engine written in PHP. I&#8217;ve made a few modifications to the base system, adding a more recent <a title="JQuery" href="http://jquery.com/" target="_blank">JQuery</a> and <a title="JQuery UI" href="http://jqueryui.com/" target="_blank">JQueryUI</a> (so that I can create interactive <a title="JQuery UI Dialogs" href="http://jqueryui.com/demos/dialog/" target="_blank">Dialogs</a>), and writing a few plugins to handle <a title="Netflow" href="http://en.wikipedia.org/wiki/Netflow" target="_blank">Netflow</a> display, wireless signal strength reports (per user), user speed tests, and to verify that they have a picture set before allowing them to use the Free Wifi.</p>
<p>By nature, people won&#8217;t set a profile picture when all they want is Free Wifi. I had to enforce a profile picture (&#8220;it doesn&#8217;t have to be you, it can be anything non-offensive&#8221;) to make the site NOT appear like a barren wasteland.</p>
<p>I eventually limited account creation strictly to the access points as registrations from outside those IPs were mostly just spam.</p>
<p>After a user creates an account and logs in, they are directed to the &#8220;Dashboard&#8221;, which is a listing of recent posts from any of the users. Most are quick &#8220;Hey you!&#8221;, but sometimes people post something more substantive. When my rear car window was broken, I used the system as a venting forum.</p>
<div id="attachment_1660" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiDashboard.png"><img class="size-medium wp-image-1660" title="MidtownWifiDashboard" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiDashboard-300x240.png" alt="MidtownWifiDashboard" width="300" height="240" /></a><p class="wp-caption-text">All the names and 1 dirty word have been removed.</p></div>
<p>I&#8217;ve consolidated most of my customizations relative to the wireless users into a single Elgg plugin I named &#8220;TSA Patdown&#8221;. Initially TSA Patdown only verified that a user had a profile image set, but now it does quite a bit more. Every 30 seconds I export <a title="RSSI" href="http://en.wikipedia.org/wiki/Received_signal_strength_indication" target="_blank">Received Signal Strength Indication</a> (RSSI) for each client from the  Engenius equipment. I collect this information, as well as information from a Javascript based speedtest widget I wrote to get an idea as to what kind of online experience each user is having.</p>
<p>I represent this information to myself on the following menu, with signal bars that I created using <a title="Blender" href="http://www.blender.org/" target="_blank">Blender</a>:</p>
<div id="attachment_1661" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiLogins.png"><img class="size-medium wp-image-1661" title="MidtownWifiLogins" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiLogins-300x240.png" alt="MidtownWifiLogins" width="300" height="240" /></a><p class="wp-caption-text">Signal Strengths, Login times, MAC addresses and more.</p></div>
<p>I can further delve into information on a per-user basis by simply clicking on a name. I can also pull a full neighborhood report, graphing each clients RSSI values as well as their recent speedtest results.</p>
<div id="attachment_1680" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiSpeedTest.png"><img class="size-medium wp-image-1680" title="MidtownWifiSpeedTest" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiSpeedTest-300x225.png" alt="MidtownWifiSpeedTest" width="300" height="225" /></a><p class="wp-caption-text">The Javascript Speedtest Widget</p></div>
<p>Being implemented in Javascript, the speedtest results aren&#8217;t the same as you&#8217;d see when visiting a Flash based speedtest. The standard web method of performing such a test is to have the end-user download an image file or two (oftentimes two images simultaneously)- and at random intervals determine how much of the image has been downloaded by that timeframe.  With a single image download, it can perform multiple measurements at various intervals and determine available bandwidth much more accurately. Since there&#8217;s additional overhead in the underlying TCP/IP layers, it appears most tests also add padding to their calculation to make things more accurate.</p>
<div id="attachment_1700" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/Speakeasy.png"><img class="size-medium wp-image-1700" title="Speakeasy" src="http://www.braindeadprojects.com/blog/wp-content/Speakeasy-300x265.png" alt="Speakeasy" width="300" height="265" /></a><p class="wp-caption-text">Speakeasy Flash based speedtest</p></div>
<p>Flash has methods that will allow for such periodic sampling, Javascript however does not. This makes my Javascript implementation an overall average &#8211; so a report of 900Kbit/sec can easily represent 1.5Mbit/sec. (My results are much more akin to what <a title="Wireshark" href="http://www.wireshark.org/" target="_blank">Wireshark</a> will report as throughput). I do plan to write a Flash based speedtest in the near future.</p>
<div id="attachment_1701" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/WiresharkThroughput.png"><img class="size-medium wp-image-1701" title="WiresharkThroughput" src="http://www.braindeadprojects.com/blog/wp-content/WiresharkThroughput-300x218.png" alt="WiresharkThroughput" width="300" height="218" /></a><p class="wp-caption-text">Wireshark measures throughput how I do: Bandwidth / (endtime - starttime)</p></div>
<p>In this example, the capture in Wireshark measures the throughput as 21.22Mbit/sec, nowhere near the 52.37Mbit/sec rating given by Speakeasy. The recent throughput information is all displayed in the signal screen:</p>
<div id="attachment_1663" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiSignals.png"><img class="size-medium wp-image-1663" title="MidtownWifiSignals" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiSignals-300x240.png" alt="MidtownWifiSignals" width="300" height="240" /></a><p class="wp-caption-text">Can you hear me now? How fast can I talk?</p></div>
<p>The Netflow section of my TSA Patdown plugin details the current traffic flow on the network. This screen updates dynamically as users surf the internet. (I&#8217;ll reiterate my past posts here: The netflow data is only packet endpoints&#8230; basically &#8220;this person called this person at this time&#8221;, but not the actual content of those conversations). I&#8217;ve also added a small port-based protocol disector that colorizes the flows and provides protocol information depending upon the packet you select. If you choose a <a title="NetBIOS" href="http://en.wikipedia.org/wiki/NetBIOS" target="_blank">NetBIOS</a> packet, you&#8217;ll get something similar to this:</p>
<div id="attachment_1666" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiNetFlow.png"><img class="size-medium wp-image-1666" title="MidtownWifiNetFlow" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiNetFlow-300x240.png" alt="MidtownWifiNetFlow" width="300" height="240" /></a><p class="wp-caption-text">Flying by at the speed of light: PACKETS</p></div>
<p>The system monitors for NetBIOS names as well as DHCP hostnames that appear on Midtown Wifi. All of this information comes together to paint an accurate view of the network.</p>
<p>Clicking a Protocol Name (in this instance NetBIOS) will direct you to a <a title="This link will implode upon itself." href="http://en.wikipedia.org/wiki/Wikipedia" target="_blank">Wikipedia</a> article on the protocol and how it works. Unclassified protocols can be classified and colorized with a simple click. You can also specify the URL to load when the protocol name is clicked.</p>
<div id="attachment_1727" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiProtocolAssignment1.png"><img class="size-medium wp-image-1727" title="MidtownWifiProtocolAssignment" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiProtocolAssignment1-300x225.png" alt="MidtownWifiProtocolAssignment" width="300" height="225" /></a><p class="wp-caption-text">Pick a transport, a color, a name, a URL - and you&#39;ve defined a protocol</p></div>
<p>The pie charts, RSSI graphs, and throughput graphs are all handled using the PHP <a title="JP Graph" href="http://jpgraph.net/" target="_blank">JPGraph libraries</a>. In the future, I intend to improve the graphs (there are tendencies for my labels to bleed off-screen or over each other).</p>
<p>The access points share their own ADSL line for bandwidth but maintain individual PPPoE sessions. The wiring in my home needs improvement (the house was built in the 1800&#8242;s, the Cat5 running through the house is obviously not that old but does have some serious issues) . Most of the exterior walls appear to be metal, which does hinder re-running the DSL line a bit.</p>
<p>I recently migrated my home network graphing from <a title="NetMRG" href="http://www.netmrg.net/" target="_blank">NetMRG</a> to Cacti, and I&#8217;m using <a title="The Cacti graphing solution" href="http://www.cacti.net/" target="_blank">Cacti</a>&#8216;s (albeit poor) FTP export function to offload graphs pertaining to MidTown Wifi to the captive portal.</p>
<div id="attachment_1693" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiGraphs.png"><img class="size-medium wp-image-1693" title="MidtownWifiGraphs" src="http://www.braindeadprojects.com/blog/wp-content/MidtownWifiGraphs-300x225.png" alt="MidtownWifiGraphs" width="300" height="225" /></a><p class="wp-caption-text">Graphs that have been imported from Cacti.</p></div>
<p>As you can see in the graphs, the system currently has 175 subscribers. I have deleted the bogus accounts that weren&#8217;t created through the APs. The high number of subscribers is largely the result of transient users (my home is on a major bus line, rental homes in the area turn over somewhat frequently, the local college is blocks away,  etc). A couple of users have duplicate accounts having apparently lost their credentials (as is evidenced by a few repeat MAC addresses).</p>
<p>To put the large number into proper perspective:  in the last 7 days there were 157 logins by 18 unique users. Unlike myself, most of the users don&#8217;t spend every waking moment on the Internet.</p>
<p>I&#8217;ve covered the access points and the firmware images in a number of previous posts, so I&#8217;ll let them speak for themselves. In the next few days (hopefully not weeks), I&#8217;ll be introducing my first Ubiquiti access point to the system with full details posted then. If you have any thoughts or input, by all means reach me in the comments section.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/midtown-wifi-the-internals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenWRT on the MikroTik RouterBoard 493AH</title>
		<link>http://www.braindeadprojects.com/blog/what/openwrt-on-the-mikrotik-routerboard-493ah/</link>
		<comments>http://www.braindeadprojects.com/blog/what/openwrt-on-the-mikrotik-routerboard-493ah/#comments</comments>
		<pubDate>Thu, 24 Nov 2011 02:28:59 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[MikroTik]]></category>
		<category><![CDATA[OpenWRT]]></category>
		<category><![CDATA[What?!]]></category>
		<category><![CDATA[Wireless]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1536</guid>
		<description><![CDATA[I recently came across a MikroTik RouterBoard 493AH at work. We&#8217;d acquired the device among numerous other pieces of equipment from a now defunct wireless ISP. The 493AH features 9 ethernet ports, can accept POE on its WAN interface, has 64M NAND,  128M RAM, and can support 3 mini-PCI cards. Configuration can be performed via [...]]]></description>
			<content:encoded><![CDATA[<p>I recently came across a <a title="RouterBoard 493AH" href="http://routerboard.com/RB493AH" target="_blank">MikroTik RouterBoard 493AH</a> at work. We&#8217;d acquired the device among numerous other pieces of equipment from a now defunct wireless ISP.</p>
<div id="attachment_1545" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/IMAG0694.jpg"><img class="size-medium wp-image-1545" title="RouterBoard 493AH" src="http://www.braindeadprojects.com/blog/wp-content/IMAG0694-300x225.jpg" alt="" width="300" height="225" /></a><p class="wp-caption-text">It smells of Goo-Gone and looks to have dandruff.</p></div>
<p>The 493AH features 9 ethernet ports, can accept POE on its WAN interface, has 64M NAND,  128M RAM, and can support 3 mini-PCI cards. Configuration can be performed via a serial interface and there is an external power connector available if POE isn&#8217;t used.</p>
<p>The device itself wouldn&#8217;t boot, only hang at the RouterBoot bootloader. Attempts to boot the NAND image failed, but the bootloader gives an easy option for downloading an image to it via <a title="TFTP" href="http://en.wikipedia.org/wiki/Trivial_File_Transfer_Protocol" target="_blank">TFTP</a>.</p>
<div id="attachment_1571" class="wp-caption aligncenter" style="width: 226px"><a href="http://www.braindeadprojects.com/blog/wp-content/logo_mikrotik.jpg"><img class="size-full wp-image-1571  " title="MikroTik Logo" src="http://www.braindeadprojects.com/blog/wp-content/logo_mikrotik.jpg" alt="MikroTik Logo" width="216" height="216" /></a><p class="wp-caption-text">A brand that&#39;s loved by WISPs</p></div>
<p>Looking around, it appears the 493AH is an <a title="Atheros7161" href="http://www.qca.qualcomm.com/networking/brand.php?brand=4&amp;product=68" target="_blank">Atheros AR7161</a> .. an architecture readily supported under <a title="OpenWRT" href="https://openwrt.org/" target="_blank">OpenWRT</a>. Sure, I could just re-install <a title="RouterOS" href="http://www.qca.qualcomm.com/networking/brand.php?brand=4&amp;product=68" target="_blank">RouterOS</a>&#8230; but let&#8217;s do that later.</p>
<p>To install OpenWRT to the 493AH, first format the NAND. This can easily be done via the bootloader (option e):</p>
<div id="attachment_1580" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/formatNAND.png"><img class="size-medium wp-image-1580" title="FormatNAND" src="http://www.braindeadprojects.com/blog/wp-content/formatNAND-300x189.png" alt="FormatNAND" width="300" height="189" /></a><p class="wp-caption-text">Waxing the memory</p></div>
<p>Next, use subversion to check out the Backfire version of OpenWRT:</p>
<blockquote><p>mkdir ~/svn/</p>
<p>cd ~/svn/</p>
<p>svn co svn://svn.openwrt.org/openwrt/branches/backfire backfire</p></blockquote>
<p>Building the image is fairly easy, all configuration is done via a &#8220;<em>make menuconfig</em>&#8220;. First, we&#8217;ll build a small <a title="InitRAMFS" href="http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Introducing-initramfs-a-new-model-for-initial-RAM-disks/" target="_blank">initramfs</a>. This will give us a tiny environment to boot into the device and later install our kernel with.</p>
<p>Ensure that you&#8217;ve selected the AR71xx target architecture&#8230;</p>
<div id="attachment_1548" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/platformtarget.png"><img class="size-medium wp-image-1548" title="PlatformTarget" src="http://www.braindeadprojects.com/blog/wp-content/platformtarget-300x189.png" alt="" width="300" height="189" /></a><p class="wp-caption-text">Building an AR71XX System</p></div>
<p>Next, I opt for the default profile (to give me all the modules I should need)</p>
<div id="attachment_1549" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/targetprofile.png"><img class="size-medium wp-image-1549" title="TargetProfileSelection" src="http://www.braindeadprojects.com/blog/wp-content/targetprofile-300x189.png" alt="TargetProfileSelection" width="300" height="189" /></a><p class="wp-caption-text">I demand everything!</p></div>
<p>And finally, select the build of a ramdisk image:</p>
<div id="attachment_1550" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/ramdiskbuild.png"><img class="size-medium wp-image-1550" title="BuildRamDisk" src="http://www.braindeadprojects.com/blog/wp-content/ramdiskbuild-300x189.png" alt="BuildRamDisk" width="300" height="189" /></a><p class="wp-caption-text">Fun with arrow keys and a spacebar.</p></div>
<p>After you&#8217;ve made your selections, exit saving your changes, and run <em>make</em>. The build itself will take some time, but when you&#8217;re finished you&#8217;ll have the first key ingredient &#8211; a basic root filesystem embedded into the kernel. This image is essentially a &#8220;Live CD&#8221; that we&#8217;ll use to install our real kernel.</p>
<p>As with all of the images you create, you&#8217;ll find them under ~/svn/backfire/bin/ar71xx/ Our newly created image is <strong>openwrt-ar71xx-vmlinux-initramfs.elf</strong></p>
<p>Next, we&#8217;ll want to build our actual system. To do this, re-run <em>make menuconfig</em> and select the packages that you wish to compile and include in your firmware image. After you&#8217;ve made all of your selections, change your Target Image to squashfs and exit saving your changes.</p>
<div id="attachment_1552" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/squashfsbuild.png"><img class="size-medium wp-image-1552" title="SquashFSBuild" src="http://www.braindeadprojects.com/blog/wp-content/squashfsbuild-300x189.png" alt="SquashFSBuild" width="300" height="189" /></a><p class="wp-caption-text">Planting a SquashFS Garden</p></div>
<p>A quick <em>make</em> later, and we now have a working rootfs and kernel &#8211; in addition to our initramfs to install the system with:</p>
<p><strong><strong>openwrt-ar71xx-vmlinux-initramfs.elf </strong></strong>(Our temporary kernel)<br />
<strong>openwrt-ar71xx-vmlinux.elf</strong> (The kernel)<br />
<strong></strong><strong>openwrt-ar71xx-root.squashfs</strong> (Our Root Filesystem)</p>
<p>We now have <em>almost</em> everything we need.</p>
<div id="attachment_1543" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/IMAG0702.jpg"><img class="size-medium wp-image-1543" title="InsideTheRouterBoard" src="http://www.braindeadprojects.com/blog/wp-content/IMAG0702-300x225.jpg" alt="" width="300" height="225" /></a><p class="wp-caption-text">Oh, the sticker says &quot;Warranty Void if Removed&quot;...</p></div>
<p>To install our kernel, we need a few additional tools. First off, we need to configure a <a title="ISC DHCP" href="http://www.isc.org/software/dhcp" target="_blank">DHCP</a> server (I&#8217;m using ISC&#8217;s). Here&#8217;s an example from my dhcpd.conf file:</p>
<blockquote><p>authoritative;<br />
ddns-update-style interim;<br />
subnet 192.168.1.0 netmask 255.255.255.0 {<br />
range 192.168.1.20 192.168.1.40;<br />
option subnet-mask 255.255.255.0;<br />
option routers 192.168.1.1;<br />
}</p>
<p>host routerboard<br />
{<br />
hardware ethernet 00:0c:xx:xx:xx:xx;<br />
fixed-address 192.168.1.17;<br />
}</p>
<p>&nbsp;</p></blockquote>
<p>Next, we&#8217;ll need a TFTP server. I prefer <a title="ATFTPD" href="http://freecode.com/projects/atftp" target="_blank">atftpd</a>. No configuration is necessary, simply create a directory to serve files from and start the server:</p>
<blockquote><p>mkdir /tftpboot/</p>
<p>chmod 777 /tftpboot/</p>
<p>atftpd ––daemon /tftpboot/</p></blockquote>
<p>The only file that has to be loaded via TFTP is the initramfs kernel. Copy it to /tftpboot with the filename vmlinux and we&#8217;re ready to start.</p>
<blockquote><p>cp ~/svn/backfire/bin/ar71xx/openwrt-ar71xx-vmlinux-initramfs.elf  /tftpboot/vmlinux</p></blockquote>
<p>Power up the RouterBoard and quickly press the space bar. Select &#8220;<em>boot over Ethernet</em>&#8221; and it will download and boot the linux kernel.</p>
<div id="attachment_1582" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/BootEthernet.png"><img class="size-medium wp-image-1582" title="BootEthernet" src="http://www.braindeadprojects.com/blog/wp-content/BootEthernet-300x189.png" alt="BootEthernet" width="300" height="189" /></a><p class="wp-caption-text">Opting to boot via TFTP</p></div>
<p>Next ,we need to install the kernel and root filesystem. Here&#8217;s where I ran into my first problem &#8211; the kernel has no init variable specified so it panics. Thankfully it clearly states this: &#8220;<strong>Kernel panic &#8211; not syncing: No init found.  Try passing init= option to kernel.</strong>&#8221;</p>
<div id="attachment_1606" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/KernelPanic.png"><img class="size-medium wp-image-1606" title="KernelPanic" src="http://www.braindeadprojects.com/blog/wp-content/KernelPanic-300x189.png" alt="KernelPanic" width="300" height="189" /></a><p class="wp-caption-text">Gratitous Image of a Kernel Panic</p></div>
<p>Unfortunately the boot loader doesn&#8217;t appear to allow one to specify command line options for the kernel and I was unable to find a way to set this when configuring the kernel. (I vaguely recall seeing it when compiling for x86, but may be mistaken). Either way, the solution is simple:</p>
<p>Add your kernel parameters to a file (kernel-params in my instance) and use objcopy to insert it into the ELF file:</p>
<p>The options I used are:</p>
<blockquote><p>root=/dev/mtdblock2 rootfstype=squashfs,yaffs,jffs2 noinitrd console=ttyS0,115200 init=/etc/preinit</p></blockquote>
<p>The toolchain supplied with OpenWRT contains a MIPs compatible version of objcopy that will allow you to add a kernel parameters section to the ELF file:</p>
<blockquote><p>cd ~/svn/bin/ar71xx/</p>
<p>~/svn/backfire/build_dir/toolchain-mips_r2_gcc-4.3.3+cs_uClibc-0.9.30.1/binutils-2.19.1/binutils/objcopy ––add-section kernparm=kernel-params openwrt-ar71xx-vmlinux.elf</p></blockquote>
<p>To install the kernel, configure an IP on your ethernet  (or bridge) interface, mount /dev/mtdblock1 and use scp to copy your kernel to the device (as &#8220;kernel&#8221;).</p>
<blockquote><p>ifconfig br-lan 192.168.1.10</p>
<p>mkdir /mnt/boot</p>
<p>mount /dev/mtdblock1 /mnt/boot</p>
<p>cd /mnt/boot/</p>
<p>scp 192.168.1.1:~/svn/backfire/bin/ar71xx/openwrt-ar71xx-vmlinux.elf kernel</p></blockquote>
<p>&nbsp;</p>
<p>Next, install your squashfs root filesystem to /dev/mtdblock2. Unlike the kernel, This shouldn&#8217;t be mounted when installed.</p>
<blockquote><p>cd /tmp/</p>
<p>scp 192.168.1.1:~/svn/backfire/bin/ar71xx/openwrt-ar71xx-root.squashfs .</p>
<p>cat openwrt-ar71xx-root.squashfs &gt; /dev/mtdblock2</p></blockquote>
<p>After the root filesystem is installed, reboot the device and welcome to OpenWRT on the RouterBoard 493AH</p>
<div id="attachment_1616" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/ItBoots.png"><img class="size-medium wp-image-1616" title="ItBoots" src="http://www.braindeadprojects.com/blog/wp-content/ItBoots-300x189.png" alt="ItBoots" width="300" height="189" /></a><p class="wp-caption-text">It&#39;s Alive!</p></div>
<p>I&#8217;m not quite sure what I&#8217;ll end up doing with the 493AH just yet. The neighborhood wireless system now consists of 2 Engenius EOC2610 units running firmware images based off OpenWRT&#8230; so there may be the potential to add it to the fray.  The 9 ethernet ports would make it ideal for a Quagga router (although I already have one). Installing the MikroTik RouterOS and working with MPLS is another options. Right now it sits on my desk at work as a &#8220;pretty cool paperweight with a lot of potential&#8221;.</p>
<p>If you have any suggestions &#8211; please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/openwrt-on-the-mikrotik-routerboard-493ah/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building a VM cluster with your bare hands.</title>
		<link>http://www.braindeadprojects.com/blog/what/building-a-vm-cluster-with-your-bare-hands/</link>
		<comments>http://www.braindeadprojects.com/blog/what/building-a-vm-cluster-with-your-bare-hands/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 21:31:49 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[KVM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1372</guid>
		<description><![CDATA[I&#8217;ve been using KVM more and more frequently in the past year (with nearly 25 virtual guests in production). While there are graphical user interfaces for KVM out there, I&#8217;ve yet to see one that supports DRBD replication (although one may exist). For that reason, I&#8217;ve basically built my Virtualization cluster using a handful of [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a title="KVM" href="http://www.linux-kvm.org/page/Main_Page" target="_blank">KVM</a> more and more frequently in the past year (with nearly 25 virtual guests in production). While there are graphical user interfaces for KVM out there, I&#8217;ve yet to see one that supports <a title="DRBD" href="http://www.drbd.org/" target="_blank">DRBD replication</a> (although one may exist). For that reason, I&#8217;ve basically built my Virtualization cluster using a handful of open-source tools &#8220;by hand&#8221;.</p>
<div id="attachment_1401" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/kvmbanner-logo2.png"><img class="size-full wp-image-1401" title="KVM" src="http://www.braindeadprojects.com/blog/wp-content/kvmbanner-logo2.png" alt="Kernel-Based Virtualization Machine" width="300" height="93" /></a><p class="wp-caption-text">A penguin juggling multiple tasks and OSes</p></div>
<p>KVM has the capability to run both Windows and Linux operating systems (as well as numerous others), supports both CPU based virtualization and <a title="ParaVirtualization" href="http://en.wikipedia.org/wiki/Paravirtualization" target="_blank">para-virtualization</a>, and has virtual drivers that can run in the guest instance speeding up disk and network IO as well as <a title="Balloon Memory Drivers" href="http://www.linux-kvm.org/page/FAQ#Is_dynamic_memory_management_for_guests_supported.3F" target="_blank">balloon memory drivers</a> to reduce the actual utilization of memory on the host machine.</p>
<p>I&#8217;ll stop here and say this &#8211; For home use, I&#8217;d probably suggest avoiding anything laid out in this article and simply use <a title="VirtualBox" href="http://www.virtualbox.org/" target="_blank">Virtualbox</a>. I use it on my desktop extensively and have for many years, but for this article I&#8217;m focusing on building a cluster with KVM.</p>
<div id="attachment_1420" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/VirtualBox-Meego.png"><img class="size-medium wp-image-1420" title="VirtualBox-Meego" src="http://www.braindeadprojects.com/blog/wp-content/VirtualBox-Meego-300x223.png" alt="VirtualBox" width="300" height="223" /></a><p class="wp-caption-text">VirtualBox running Meego (another project of mine)</p></div>
<p>With the absence of a proper <a title="Storage Area Network" href="http://en.wikipedia.org/wiki/Storage_area_network" target="_blank">Storage Area Network</a> (SAN), I&#8217;m utilizing DRBD (Distributed Replicated Block Device) to provide VM disk replication across both virtual nodes. This allows for live migration of a guest from front-end node to front-end node. Additionally, this architecture will still allow for replacement of storage OR supplementing of storage with a SAN in the future.</p>
<div id="attachment_1373" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/VMLayout.png"><img class="size-medium wp-image-1373" title="The VM Cluster Layout" src="http://www.braindeadprojects.com/blog/wp-content/VMLayout-300x227.png" alt="VM Cluster" width="300" height="227" /></a><p class="wp-caption-text">The VM Cluster Layout.</p></div>
<p>DRBD replicates individual <a title="LVM" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29" target="_blank">LVM volumes</a> (and not the raid array as a whole) across my 2 host nodes. Each virtual guest has it&#8217;s own logical volume assigned to it, which is accessed via DRBD block device interfaces  (/dev/drbd&lt;number&gt;).</p>
<p>In the example image above, jabber0 and web0 (virtual &#8220;<em><strong>guests</strong></em>&#8220;) are running on virtual0 (a virtual &#8220;<em><strong>host</strong></em>&#8221; or &#8220;<em><strong>node</strong></em>&#8220;), with web1 (another &#8220;<em><strong>guest</strong></em>&#8220;) running on virtual1 (a virtual &#8220;<em><strong>host</strong></em>&#8221; or &#8220;<em><strong>node</strong></em>&#8220;). The DRBD resource is set to <em>Primary</em> mode on the virtual <strong><em>host</em></strong> connected to a <strong>running</strong> guest, with the disk being copied to the <em>Secondary</em> (the non-running virtual host) Primary mode allows the virtual host (and it&#8217;s guests) to access the DRBD resource (and read/write from the connected logical volume).</p>
<p>As far as a virtual guest is concerned, there is no DRBD, only a /dev/vda or /dev/sda device.</p>
<p>Only during live-migration should the DRBD resources on <strong>both</strong> virtual hosts be placed into <em>Primary</em> (a situation called <em>Dual Primary</em>). As one virtual guest is paused prior to the other going active, data corruption will not occur.</p>
<div id="attachment_1375" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/2950.jpg"><img class="size-medium wp-image-1375" title="A Dell PowerEdge 2950" src="http://www.braindeadprojects.com/blog/wp-content/2950-300x135.jpg" alt="" width="300" height="135" /></a><p class="wp-caption-text">The Virtual Server itself (Well, it looks like this)</p></div>
<p>Each node is presently a <a title="Dell PowerEdge 2950" href="http://www.dell.com/us/dfb/p/poweredge-2950/pd" target="_blank">Dell PowerEdge 2950</a> with 32G of memory and over 1 Terrabyte of storage. With the DRBD replication this gives approximately 1 Terrabyte of storage (and not a combined 2 Terrabytes).</p>
<p>Each node has 4 gigabit ethernet interfaces.</p>
<table style="text-align: center;" border="1">
<tbody>
<tr>
<td><strong>Interface</strong></td>
<td><strong>Purpose</strong></td>
</tr>
<tr>
<td>eth0</td>
<td>Administrative Access</td>
</tr>
<tr>
<td>eth1</td>
<td>DRBD Replication</td>
</tr>
<tr>
<td>eth2</td>
<td>Connected to the world_br0 bridge for guest host routing</td>
</tr>
<tr>
<td>eth3</td>
<td>Connected to the world_br1 bridge for guest host routing</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>There are presently three ethernet bridges on each node:</p>
<p>&nbsp;</p>
<table style="text-align: center;" border="1">
<tbody>
<tr>
<td><strong>Bridge Interface</strong></td>
<td><strong>Purpose</strong></td>
</tr>
<tr>
<td>kickstart_br0</td>
<td>Used to kickstart guest machines</td>
</tr>
<tr>
<td>world_br0</td>
<td>Used to connect guest machines to the public network</td>
</tr>
<tr>
<td>world_br1</td>
<td>Used to connect guest machines to the public network</td>
</tr>
</tbody>
</table>
<h4></h4>
<p>&nbsp;</p>
<h3>Connecting to a Guest:</h3>
<p>Each guest is accessible via standard means (ssh) when configured correctly. Additionally, one can connect to each guest by <a title="VNC" href="http://en.wikipedia.org/wiki/Virtual_Network_Computing" target="_blank">VNC</a>ing to a unique port on the virtual host. (I do maintain a list of which DRBD ports and VNC ports are used for each of my virtual guests)</p>
<h3>Configuring an LVM volume:</h3>
<p>The &#8220;vmdisks&#8221; <a title="LVM" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29" target="_blank">LVM</a> volume group is approximately 1.3TB of disk storage, used to provide individual volumes to the guest instances. I use a logical volume of 30G for most guests.</p>
<p>To add a logical disk for guest usage is simple &#8211; and <strong>Must be done uniformly across all nodes</strong>:</p>
<blockquote><p><em>lvcreate -L &lt;size&gt;M -n &lt;name&gt; vmdisks</em></p></blockquote>
<h3></h3>
<h3></h3>
<p>&nbsp;</p>
<h3>Initial Configuration of the DRBD MD device:</h3>
<p>The DRBD MD device is the actual block device that the Guest machine will interface with.</p>
<p>The following <strong>MUST BE DONE ACROSS ALL NODES</strong>, however only upon initial creation:</p>
<p>Update the /etc/drbd.conf file to add your new node (here&#8217;s an example):</p>
<blockquote><p>resource &lt;resource name&gt;<br />
{<br />
net<br />
{<br />
allow-two-primaries;<br />
}</p>
<p>syncer<br />
{<br />
rate 33M;<br />
}</p>
<p>startup<br />
{<br />
become-primary-on virtual0.braindeadprojects.com;<br />
}</p>
<p>on virtual0.braindeadprojects.com<br />
{<br />
device /dev/drbd&lt;Next Available block&gt;;<br />
disk /dev/vmdisks/&lt;LVM Volume Group&gt;;<br />
address 10.255.255.1:&lt;Next available port&gt;;<br />
meta-disk internal;<br />
}</p>
<p>on virtual1.braindeadprojects.com<br />
{<br />
device /dev/drbd&lt;Next available block&gt;;<br />
disk /dev/vmdisks/&lt;LVM Volume Group&gt;;<br />
address 10.255.255.2:&lt;next available port&gt;;<br />
meta-disk internal;<br />
}</p>
<p>}</p></blockquote>
<p>&nbsp;</p>
<p>After updating the config, create the block device and enable it:</p>
<blockquote><p>#drbdadm create-md &lt;resource name&gt;<br />
#drbdadm up &lt;resource name&gt;</p></blockquote>
<p>&nbsp;</p>
<p>At this point, all nodes have a record of this DRBD resource. /proc/drbd will have additional information.</p>
<p><strong>The following must be done ONLY ON THE PRIMARY (MASTER) NODE</strong>:</p>
<blockquote><p><em>#drbdadm &#8212; &#8211;overwrite-data-of-peer primary &lt;resource name&gt;<br />
</em></p></blockquote>
<p>&nbsp;</p>
<p>This will begin an initial synchronization across the nodes. Again, this is only run on the &#8220;Master node&#8221; (the virtual host node that is initially running the VM guest).  At this time, the DRBD resource is available on ALL nodes, however until the synchronization is finished, reads/writes will take slightly longer.</p>
<p><strong>An important note on synchronization:</strong></p>
<p>The <a title="DRBD Syncer stanza" href="http://www.drbd.org/users-guide/s-resync.html" target="_blank">syncer{} stanza</a> in the resource config plays an important role in how fast a drive is synchronized. Default sync speed is roughly 340K/sec, which in turn causes a drive synchronization of a 30G drive to take appx 28 hours.</p>
<p>This can safely be set to 33M/sec in my environment, reducing sync-time to roughly 20 minutes, depending upon load.</p>
<p>Sync rate will play an important factor in instances where an entire node fails, and the resources of the failover node cannot keep up. In such an event, a 3rd node should be added to the system, with drives synced to it.</p>
<h3>Creating the VM Guest:</h3>
<p>I&#8217;m utilizing <a title="libVirt" href="http://libvirt.org/" target="_blank">libvirt</a> as a convenient way to provision and manage virtual machines.</p>
<div id="attachment_1422" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.braindeadprojects.com/blog/wp-content/libvirt-header-logo.png"><img class="size-full wp-image-1422" title="libVirt" src="http://www.braindeadprojects.com/blog/wp-content/libvirt-header-logo.png" alt="libVirt" width="400" height="104" /></a><p class="wp-caption-text">libVirt, handling all your hypervisor and sardine needs since 2009</p></div>
<p>Creation of a guest is fairly easy, and can be done interactively or via a one-liner:</p>
<blockquote><p>#virt-install &#8211;connect qemu:///system -n &lt;Guest Name&gt; -r &lt;RAM in MB&gt; &#8211;vcpus=1 \<br />
&#8211;arch=&lt;i686|x86_64|&#8230;&gt; &#8211;vnc &#8211;vncport=&lt;unused VNC port number&gt; &#8211;noautoconsole &#8211;os-type linux &#8211;accelerate \<br />
&#8211;network=bridge:&lt;kickstart_br0|world_br0|world_br1&gt; &#8211;hvm &#8211;disk path=/dev/drbd&lt;resource number&gt;,bus=virtio \<br />
&#8211;&lt;pxe|import|cdrom&gt;</p></blockquote>
<p>&nbsp;</p>
<p>After which time the guest will automatically start, with it&#8217;s vnetX interface bridging with kickstart_br0.</p>
<p>I&#8217;ve installed <a title="DNSMasq" href="http://thekelleys.org.uk/dnsmasq/doc.html" target="_blank">DNSMasq</a> on each host machine. It sits atop the kickstart_br0 interface, and assigns the VM an IP in the 192.168.6.0/24 network (via DHCP), and PXE boots/kickstarts it off a mirroring server. (The 192.168.6.0/24 network is MASQUERADEd in iptables so requests appear to come from virtual[01])</p>
<p>After kickstarting the guest, the reboot process tends to shut down the virtual guest so it may need to be restarted (Normal reboots are not prone to this shutdown). Once restarted, server configuration can be done via ssh from the host node, or VNC.</p>
<div class="wp-caption alignnone" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/trixbox-kvm.png"><img title="trixbox-kvm" src="http://www.braindeadprojects.com/blog/wp-content/trixbox-kvm-300x177.png" alt="Trixbox-KVM" width="300" height="177" /></a><p class="wp-caption-text">A KVM Trixbox guest: It&#39;s ALIVE!!!</p></div>
<p>Once the machine is built, customized and ready to be placed on the Internet, power down the VM guest and edit the XML config file (replacing <strong>kickstart_br0</strong> with <strong>world_br0</strong> or <strong>world_br1</strong>). If you find that the VM guest attempts to PXE boot once again, you may need to also change the boot device order (specifying <strong>hd</strong> instead of <strong>network</strong>)</p>
<p>You will also want to adjust the clock to source itself from the host machine.</p>
<blockquote><p># virsh<br />
Welcome to virsh, the virtualization interactive terminal.<br />
Type:  &#8216;help&#8217; for help with commands<br />
&#8216;quit&#8217; to quit<br />
virsh # edit &lt;guestname&gt;<br />
&#8230;<br />
&#8230;<br />
&lt;os&gt;<br />
&lt;type arch=&#8217;x86_64&#8242; machine=&#8217;rhel5.4.0&#8242;&gt;hvm&lt;/type&gt;<br />
&lt;boot dev=&#8217;network&#8217;/&gt;<br />
&lt;boot dev=&#8217;hd&#8217;/&gt;<br />
&lt;/os&gt;<br />
&#8230;<br />
&#8230;<br />
&lt;interface type=&#8217;bridge&#8217;&gt;<br />
&lt;mac address=&#8217;54:52:00:2d:21:10&#8242;/&gt;<br />
&lt;source bridge=&#8217;kickstart_br0&#8242;/&gt;<br />
&lt;target dev=&#8217;vnet1&#8242;/&gt;<br />
&lt;/interface&gt;<br />
&#8230;<br />
&#8230;<br />
&lt;clock offset=&#8217;localtime&#8217;/&gt;<br />
&#8230;<br />
&#8230;</p></blockquote>
<p>&nbsp;</p>
<h4>To boot from CD:</h4>
<p>&nbsp;</p>
<blockquote><p>&lt;disk type=&#8217;file&#8217; device=&#8217;cdrom&#8217;&gt;<br />
&lt;driver name=&#8217;qemu&#8217; type=&#8217;raw&#8217;/&gt;<br />
&lt;source file=&#8217;/usr/src/systemrescuecd-x86-1.6.2.iso&#8217;/&gt;<br />
&lt;target dev=&#8217;hdc&#8217; bus=&#8217;ide&#8217;/&gt;<br />
&lt;readonly/&gt;<br />
&lt;address type=&#8217;drive&#8217; controller=&#8217;0&#8242; bus=&#8217;1&#8242; unit=&#8217;0&#8242;/&gt;<br />
&lt;/disk&gt;</p></blockquote>
<p>&nbsp;</p>
<p>After editing the XML, you can restart the VM.</p>
<p>&nbsp;</p>
<blockquote><p>virsh # start &lt;guestname&gt;</p></blockquote>
<p>&nbsp;</p>
<h3>General usage:</h3>
<p>&nbsp;</p>
<p>I&#8217;ve made sure to install <a title="virt-top" href="http://people.redhat.com/~rjones/virt-top/" target="_blank">virt-top</a>, an interface to the hypervisor similar to the &#8220;top&#8221; command. This gives a nice overview of the system:</p>
<blockquote><p>#virt-top</p></blockquote>
<p>&nbsp;</p>
<div id="attachment_1474" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/virt-top.png"><img class="size-medium wp-image-1474" title="virt-top" src="http://www.braindeadprojects.com/blog/wp-content/virt-top-300x187.png" alt="virt-top" width="300" height="187" /></a><p class="wp-caption-text">virt-top: An overview of CPU and memory</p></div>
<p>The shell API for libvirt makes manipulating guest instances easy<em></em>. Here are a few of the more frequently used virsh commands:</p>
<blockquote><p>#list &lt;&#8211;all&gt; (Lists running and non-running guests)<br />
#start &lt;guestname&gt; (Starts guest instance)<br />
#autostart &lt;guestname&gt; (Marks guest to be autostarted at node boot)<br />
#destroy &lt;guestname&gt; (Immediately powers off guest)<br />
#suspend &lt;guestname&gt; (Powers down guest gracefully)<br />
#reboot &lt;guestname&gt; (Reboots guest)<br />
#edit &lt;guestname&gt; (Edits the guest XML config)<br />
#migrate (See the migration section for more info)</p></blockquote>
<p>&nbsp;</p>
<h3>Live migration:</h3>
<p>Live migration between nodes can be done via ssh (with shared keys) or TLS. I&#8217;m currently utilizing the ssh method:</p>
<p>Prior to migration, the DRBD resource needs to be place in Primary on <strong>both nodes</strong>:</p>
<blockquote><p>#drbdadm primary &lt;resource name&gt;</p></blockquote>
<p>&nbsp;</p>
<p>After doing so, the following is run on the <strong>SENDING</strong> node only:</p>
<blockquote><p>#virsh migrate &#8211;live &lt;GUEST&gt; qemu+ssh://&lt;RECEIVING NODE&gt;/system</p></blockquote>
<p>&nbsp;</p>
<p>As part of the migration process, the sending node copies memory and kernel state via ssh to the receiving node. During the migration process, the guest instance on the sending node is active, with the guest node being marked as paused.</p>
<p>&nbsp;</p>
<p>Once information is migrated, the sending node pauses it&#8217;s guest instance, with the receiving node un-pausing. Actual migration depends upon a number of factors, although is generally accomplished in under 35 seconds.</p>
<p>Following the migration, it&#8217;s essential to place the <strong>losing node</strong> into DRBD secondary mode. Should I accidentally try to start the guest on the losing node, this will prevent it from obtaining access to the disk (and corrupting data):</p>
<blockquote><p>#drbdadm secondary &lt;resource name&gt;</p></blockquote>
<p>&nbsp;</p>
<h3>Virtualizing Physical Machines:</h3>
<p>&nbsp;</p>
<p>Virtualizing a physical machine is extremely easy. Instead of PXE booting and kickstarting an install (<em><strong>&#8211;pxe</strong></em>),  I use the <em><strong>&#8211;cdrom /usr/src/systemrescuecd-x86-1.6.2.iso</strong></em> flag when creating the virtual guest. On each virtual host, I have a copy of the excellent Gentoo based <a title="SystemRescueCd" href="http://www.sysresccd.org/Main_Page" target="_blank">SystemRescueCd</a>.</p>
<p>When the system boots into the live CD, partition the drive (usually /dev/vda or /dev/sda) as you wish (taking advantage of LVM for non-boot partitions if possible).</p>
<p>Create a /mnt/migrate directory from the live cd, and mount your newly created partitions there.</p>
<blockquote><p>mount /dev/sda2 /mnt/migrate<br />
for dir in {boot,proc,dev}; do mkdir /mnt/migrate/$dir; done<br />
mount /dev/sda1 /mnt/migrate/boot</p>
<p>(Do the same for /var and any other directories you have partitioned separately)</p></blockquote>
<p>Utilizing rsync over ssh, synchronize all files from the physical host to the virtual one (taking care that you perform the action correctly, so as not to overwrite the original server). A handful of files and directories <strong>NEED TO BE OMITTED</strong>, namely:</p>
<blockquote><p>/proc<br />
/dev<br />
/sys<br />
/lost+found<br />
(possibly others)</p></blockquote>
<p>I generally use an rsync command similar to this one:</p>
<blockquote><p>#time rsync &#8211;exclude &#8216;/dev/&#8217; &#8211;exclude &#8216;/proc/&#8217; &#8211;exclude &#8216;/sys/&#8217; &#8211;exclude &#8216;/lost+found/&#8217;  -ave ssh &lt;originalserverip&gt;:/ /mnt/migrate/</p></blockquote>
<p>The following devices need to be present in order to boot into the OS.  <em>Either rsync them or manually make them with mknod.</em></p>
<blockquote><p>/dev/console<br />
/dev/initctl<br />
/dev/null<br />
/dev/zero</p></blockquote>
<p><em>Another easy way to accomplish this is:</em></p>
<blockquote><p><em></em>for file in {console,initctl,null,zero}; do cp -a /dev/$file /mnt/migrate/dev/$file ; done</p></blockquote>
<p>&nbsp;</p>
<p>Following the rsync, the virtual guest will need a bootloader and an updated initial ramdisk. Both of these are best done in a chroot environment:</p>
<blockquote><p>mount -o bind /dev/ /mnt/migrate/dev/<br />
mount -t proc none /mnt/migrate/proc/<br />
mount -o bind /sys/ /mnt/migrate/sys/<br />
chroot /mnt/migrate/ /bin/bash</p></blockquote>
<p>&nbsp;</p>
<p>Inside the chroot environment, you will need to update /etc/mtab and /etc/fstab to reflect your new partitioning (at the very least drives will likely change to /dev/vda). You will also need to update /boot/grub/device.map to reflect hd0 as a valid drive.</p>
<p>Once these changes have been made, grub installation should be as simple as:</p>
<blockquote><p>grub-install &#8211;no-floppy /dev/vda</p></blockquote>
<p>&nbsp;</p>
<p>(Although sometimes grub needs to be further caressed. See the <a title="Gentoo Handbook" href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=10" target="_blank">Gentoo Handbook section on installing the grub bootloader</a> for good documentation)</p>
<p><em><strong>If a simple grub-install does not work:</strong></em></p>
<blockquote><p># grub<br />
grub&gt; root (hd0,0)           &lt;&#8211; where hd0,0 is the first partition on the first drive<br />
grub&gt; setup (hd0)            &lt;&#8211; install grub on the mbr of the first drive<br />
grub&gt; quit</p></blockquote>
<p>&nbsp;</p>
<p>With the Bootloader installed, we need to create a working initial ramdisk with necessary drivers. Look for the most recent installed kernel in grub.conf and create the ramdisk (replace the version numbers with yours):</p>
<blockquote><p>mkinitrd -f /boot/initrd-2.6.18-194.32.1.el5.img 2.6.18-194.32.1.el5</p></blockquote>
<p>To take advantage of virtio (network and disk) modules on newer kernels, you may opt to include them in the initrd:</p>
<blockquote><p>mkinitrd -f &#8211;with virtio_pci &#8211;with virtio_blk \ &#8211;with virtio_net /boot/initrd-2.6.18-194.32.1.el5.img 2.6.18-194.32.1.el5</p></blockquote>
<p>&nbsp;</p>
<p><em><strong>Please be aware</strong></em> that many files (IE: databases) should only be rsynced when shutdown. For this reason, it&#8217;s often best to shutdown MySQL, PostgreSQL, and various other services PRIOR TO RSYNCing to prevent database corruption.</p>
<p><a name="How_to_physicalize_a_virtual_machine"></a></p>
<h3>How to physicalize a virtual machine:</h3>
<p>In the event of a major issue, converting a virtual machine back to a physical machine has the same process as physical to virtual, but reversed.</p>
<h3>Of Note:</h3>
<p>While Fedora currently supports (automatically, out of the box) SELinux profiles/labels for KVM guest instances, Centos 5.6 does not. It will be incorporated in Centos 6, however&#8230; and I plan on migrating to that OS eventually.</p>
<h3>Final Thoughts:</h3>
<p>As with everything, there&#8217;s pros and cons to this methodology.</p>
<ul>
<li>While I&#8217;ve always preferred avoiding GUIs, the fact is they standardize on what steps happen in which order (limiting the potential for user-induced errors.)</li>
</ul>
<ul>
<li>A high performance SAN (or perhaps an <a title="OpenFiler" href="http://www.openfiler.com/" target="_blank">OpenFiler</a> box) would make things much easier to configure and migrate, but at the same time introduce a possible single point of failure.</li>
</ul>
<ul>
<li>Utilizing an automation engine (like <a title="Puppet Automation Engine" href="http://www.puppetlabs.com/" target="_blank">puppet</a>) could limit the number of steps needed to provision a virtual guest across all nodes.</li>
</ul>
<ul>
<li>Outside of some possible restrictions (virtio drivers being specific to KVM, LVM2 support for Windows), migrating from the present day system to vmware, virtualbox, or &lt;insert your favorite hypervisor here&gt; &#8212; should be fairly easy, requiring simply creating a guest and pointing it at an LVM share.</li>
</ul>
<p>All in all, the system has been in production for nearly a year now and is performing beautifully. And best of all, I&#8217;m saving on power and generating less heat.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/building-a-vm-cluster-with-your-bare-hands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stop the bleeding!</title>
		<link>http://www.braindeadprojects.com/blog/what/stop-the-bleeding/</link>
		<comments>http://www.braindeadprojects.com/blog/what/stop-the-bleeding/#comments</comments>
		<pubDate>Sat, 30 Jul 2011 23:05:16 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[BrainDeadTip]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1350</guid>
		<description><![CDATA[I&#8217;ve been quite annoyed recently with my video card, the &#8220;nVidia Corporation GeForce 8400 GS (rev a1)&#8220;. A number of sites using Flash tend to bleed through Firefox or Chrome and into other tabs or even other workspaces. I&#8217;ve upgraded the nvidia-drivers a number of times, never actually fixing the problem. Other Gentoo users on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been quite annoyed recently with my video card, the &#8220;<a title="The GeForce 8400 GS" href="http://www.nvidia.com/object/geforce_8400.html" target="_blank">nVidia Corporation GeForce 8400 GS (rev a1)</a>&#8220;. A number of sites using Flash tend to bleed through Firefox or Chrome and into other tabs or even other workspaces.</p>
<div id="attachment_1351" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/this-is-annoying.jpg"><img class="size-medium wp-image-1351" title="This is annoying." src="http://www.braindeadprojects.com/blog/wp-content/this-is-annoying-300x229.jpg" alt="questo è fastidioso" width="300" height="229" /></a><p class="wp-caption-text">I can still SEE YOU!</p></div>
<p>I&#8217;ve upgraded the nvidia-drivers a number of times, never actually fixing the problem. Other Gentoo users on the #gentoo channel of <a title="Freenode" href="http://freenode.net/" target="_blank">freenode</a> have suggested migrating to <a title="Gnash" href="http://www.gnu.org/s/gnash/" target="_blank">gnash</a> instead&#8230; and while I have contemplated this, I&#8217;ve noticed a number of things that don&#8217;t work well under gnash on my netbook.</p>
<p>Thankfully I&#8217;m not the only person to be experiencing this. Earlier today I came across a solution (that while not optimal) definitely fixes the problem:</p>
<p>&nbsp;</p>
<div id="attachment_1353" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/disable-this-in-flash.png"><img class="size-medium wp-image-1353" title="disable-this-in-flash" src="http://www.braindeadprojects.com/blog/wp-content/disable-this-in-flash-300x226.png" alt="Untick this box" width="300" height="226" /></a><p class="wp-caption-text">No acceleration, but no bleeding either.</p></div>
<p>Disabling hardware acceleration thankfully stops the bleedthrough. (Just right click on a flash movie, select &#8220;Settings&#8221; and disable acceleration under &#8220;display&#8221;) You will need to restart your browsers for it to fully take effect.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/stop-the-bleeding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GNS3 and Gentoo &#8211; fixing QEMU networking</title>
		<link>http://www.braindeadprojects.com/blog/what/gns3-and-gentoo-fixing-qemu-networking/</link>
		<comments>http://www.braindeadprojects.com/blog/what/gns3-and-gentoo-fixing-qemu-networking/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 02:54:22 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[BrainDeadTip]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[GNS3]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[KVM]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1289</guid>
		<description><![CDATA[I was hoping to have time to further familiarize myself with IPv6 this weekend -  but workplace emergencies, sleep, and a technical glitch slowed me down. Here&#8217;s the story of the technical glitch. GNS3/dynamips can handle emulation of a number of routers, and I was happy to see that it can emulate host PCs as [...]]]></description>
			<content:encoded><![CDATA[<p>I was hoping to have time to further familiarize myself with <a title="IPv6" href="http://en.wikipedia.org/wiki/IPv6" target="_blank">IPv6</a> this weekend -  but workplace emergencies, sleep, and a technical glitch slowed me down. Here&#8217;s the story of the technical glitch.</p>
<div id="attachment_1320" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/GNS3.png"><img class="size-medium wp-image-1320" title="GNS3" src="http://www.braindeadprojects.com/blog/wp-content/GNS3-300x88.png" alt="" width="300" height="88" /></a><p class="wp-caption-text">GNS3 - this thing rocks.</p></div>
<p><a title="GNS3" href="http://www.gns3.net/" target="_blank">GNS3</a>/<a title="Dynamips" href="http://www.ipflow.utc.fr/index.php/Cisco_7200_Simulator" target="_blank">dynamips</a> can handle emulation of a number of routers, and I was happy to see that it can emulate host PCs as well. Unfortunately networking in GNS3  is done via <em>UDP tunnels</em> &#8211; something that requires a <a title="Qemu" href="http://wiki.qemu.org/Main_Page" target="_blank">Qemu</a> patch to implement.</p>
<div id="attachment_1306" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/GNS3-IPv6-test.png"><img class="size-medium wp-image-1306" title="GNS3-IPv6-test" src="http://www.braindeadprojects.com/blog/wp-content/GNS3-IPv6-test-300x209.png" alt="" width="300" height="209" /></a><p class="wp-caption-text">For some reason QEMU won&#39;t really start if it&#39;s networked.</p></div>
<p>In <a title="Gentoo" href="http://www.gentoo.org/">Gentoo</a>, simply building GNS3 from the <a title="Sunrise Overlay" href="http://overlays.gentoo.org/proj/sunrise" target="_blank">Sunrise Overlay</a> doesn&#8217;t provide sufficient support for this requirement. Emulated routers (and I&#8217;m assuming switches) work fine when networked together. Emulated host machines work fine when NOT connected to anything. But once you network things together you&#8217;ll discover that your Qemu host won&#8217;t start.</p>
<p>Here&#8217;s why &#8211; when you start a Qemu host, this is essentially what GNS3 runs:</p>
<blockquote><p>/usr/bin/qemu -name QEMU1 -m 256  /mnt/virtualmachines/dynips/IPv6-tc/working/QEMU1/FLASH -hdb  /mnt/virtualmachines/dynamips/IPv6-tc/working/QEMU1/SWAP -enable-kvm  -net nic,vlan=0,macaddr=00:aa:00:8f:e4:00,model=rtl8139 <strong>-net  udp,vlan=0,sport=20000,dport=10006,daddr=127.0.0.1 </strong>-net  nic,vlan=1,macaddr=00:00:ab:fa:72:01,model=rtl8139 -serial  telnet:127.0.0.1:3000,server,nowait -no-acpi -vnc :0</p></blockquote>
<p>GNS3 attempts to use the <strong>-net udp</strong> option, something not offered in the default QEMU-KVM distribution. With no Gentoo <a title="USE flags" href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&amp;chap=2#doc_chap1" target="_blank">USE flags</a> to add the patch in either 0.13.0 or 0.14.50, I decided to simply upgrade to 0.14.50 and see if it was part of the default build:</p>
<blockquote><p># kvm &#8211;version<br />
QEMU emulator version 0.14.50 (qemu-kvm-devel), Copyright (c) 2003-2008 Fabrice Bellard<br />
# kvm &#8211;help | grep &#8220;net udp&#8221;<br />
#</p></blockquote>
<p>Nope, it&#8217;s not. So the next step is to remove app-emulation/qemu-kvm from your system and build it by hand.</p>
<p>First, remove kvm and download the source from kernel.org:</p>
<blockquote><p># emerge -C app-emulation/qemu-kvm</p>
<p># cd /usr/src/</p>
<p># wget http://mirrors.kernel.org/gentoo/distfiles/qemu-kvm-0.13.0.tar.gz</p></blockquote>
<p>Unpack and patch it, using the <a title="Patch" href="http://sourceforge.net/projects/gns-3/files/Qemu/qemu-0.13.0.patched.win32.zip/download" target="_blank">patch provided by the gns-3 team </a>.</p>
<blockquote><p># tar zxvpf qemu-kvm-0.13.0.tar.gz</p>
<p># cd qemu-kvm-0.13.0/</p></blockquote>
<p>Testing the patch, I ran into a handful of issues:</p>
<blockquote><p># patch &#8211;dry-run -p1 &lt; /mnt/nas/downloads/qemu-0.13.0-<br />
mcast-udp.patch<br />
patching file Makefile.objs<br />
Hunk #1 FAILED at 25.<br />
1 out of 1 hunk FAILED &#8212; saving rejects to file Makefile.objs.rej<br />
patching file block/raw-win32.c<br />
Hunk #1 FAILED at 93.<br />
Hunk #2 FAILED at 347.<br />
2 out of 2 hunks FAILED &#8212; saving rejects to file block/raw-win32.c.rej<br />
patching file hw/e1000.c<br />
Hunk #1 FAILED at 567.<br />
1 out of 1 hunk FAILED &#8212; saving rejects to file hw/e1000.c.rej<br />
patching file net/udp.c<br />
patching file net/udp.h<br />
patching file net.c<br />
Hunk #1 FAILED at 30.<br />
Hunk #2 FAILED at 1075.<br />
2 out of 2 hunks FAILED &#8212; saving rejects to file net.c.rej<br />
patching file net.h<br />
Hunk #1 FAILED at 33.<br />
1 out of 1 hunk FAILED &#8212; saving rejects to file net.h.rej<br />
patching file qemu-options.hx<br />
Hunk #1 FAILED at 996.<br />
1 out of 1 hunk FAILED &#8212; saving rejects to file qemu-options.hx.rej</p></blockquote>
<p>A quick modification and we&#8217;ve got <a title="Update Patch File" href="http://www.braindeadprojects.com/src/gentoo-qemu-0.13.0.gns3.patch" target="_blank">a new patch file</a>. This one applies nicely:</p>
<blockquote><p># patch &#8211;dry-run -p1 &lt; /mnt/nas/downloads/gentoo-qemu-0.13.0.gns3.patch<br />
patching file Makefile.objs<br />
patching file QMP/qmp-commands.txt<br />
patching file block/raw-win32.c<br />
patching file config-all-devices.mak<br />
patching file config-host.h<br />
patching file config-host.h-timestamp<br />
patching file config-host.ld<br />
patching file config-host.mak<br />
patching file hw/e1000.c<br />
patching file libdis/config.mak<br />
patching file libdis-user/config.mak<br />
patching file libhw32/config.mak<br />
patching file libhw64/config.mak<br />
patching file net/udp.c<br />
patching file net/udp.h<br />
patching file net.c<br />
patching file net.h<br />
patching file qemu-doc.html<br />
patching file qemu-img-cmds.texi<br />
patching file qemu-img.1<br />
patching file qemu-monitor.texi<br />
patching file qemu-nbd.8<br />
patching file qemu-options.hx<br />
patching file qemu-options.texi<br />
patching file qemu-tech.html<br />
patching file qemu.1<br />
patching file roms/seabios/config.mak<br />
patching file roms/vgabios/config.mak<br />
patching file x86_64-softmmu/config-devices.mak<br />
patching file x86_64-softmmu/config-devices.mak.old<br />
patching file x86_64-softmmu/config-target.mak<br />
vonnegut qemu-kvm-0.13.0 #</p></blockquote>
<p>So let&#8217;s apply it for real and then configure, build, and install our new Qemu:</p>
<blockquote><p># patch -p1 &lt; /mnt/nas/downloads/gentoo-qemu-0.13.0.gns3.patch</p>
<p>&#8230;</p>
<p># ./configure &#8211;prefix=/usr &#8211;target-list=i386-softmmu &#8211;enable-sdl</p>
<p># make &amp;&amp; make install</p></blockquote>
<p>A quick check to ensure UDP tunneling is compiled in:</p>
<blockquote><p># /usr/bin/qemu &#8211;version<br />
QEMU emulator version 0.13.0 (qemu-kvm-0.13.0), Copyright (c) 2003-2008 Fabrice Bellard<br />
# /usr/bin/qemu &#8211;help | grep &#8220;net udp&#8221;<br />
-net udp[,vlan=n]sport=sport,dport=dport,daddr=host<br />
#</p></blockquote>
<p>And voila &#8211; now not only does my host machine start when networked into my layout, it also has connectivity:</p>
<div id="attachment_1308" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/QEMU-working-host.png"><img class="size-medium wp-image-1308" title="QEMU-working-host" src="http://www.braindeadprojects.com/blog/wp-content/QEMU-working-host-300x177.png" alt="" width="300" height="177" /></a><p class="wp-caption-text">Yes, it finally works.</p></div>
<p>Next up &#8211; continue lab work with IPv6, and begin studying for my <a title="CCNP" href="http://www.cisco.com/web/learning/le3/le2/le37/le10/learning_certification_type_home.html" target="_blank">CCNP</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/gns3-and-gentoo-fixing-qemu-networking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Packet Creation for IPv6</title>
		<link>http://www.braindeadprojects.com/blog/what/packet-creation-for-ipv6/</link>
		<comments>http://www.braindeadprojects.com/blog/what/packet-creation-for-ipv6/#comments</comments>
		<pubDate>Sun, 22 May 2011 17:35:06 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=27</guid>
		<description><![CDATA[With most of my projects, I&#8217;ve noticed that before I can really begin to delve into them, I first have to learn something completely new. I don&#8217;t do most of my work in Perl, but I can definitely make ends meet. My more recent work in Perl has dealt w/ RIP scanning and route-updating (a [...]]]></description>
			<content:encoded><![CDATA[<p>With most of my projects, I&#8217;ve noticed that before I can <em>really</em> begin to delve into them, I first have to learn something completely new.</p>
<p>I don&#8217;t do most of my work in <a title="Perl " href="http://www.perl.org/" target="_blank">Perl</a>, but I can definitely make ends meet. My more recent work in Perl has dealt w/ <a title="RIP" href="http://en.wikipedia.org/wiki/Routing_Information_Protocol" target="_blank">RIP</a> scanning and route-updating (a lot of DSL CPE tends to have RIP enabled). Packet creation isn&#8217;t that difficult, and using Perl I could bang out a script in a short period of time.</p>
<p>Usually for packet manipulation, I stay away from Perl &#8211; instead I&#8217;m a huge fan of <a href="http://www.hping.org/" target="_blank">Hping[23]</a>. If you&#8217;re wanting to watch and play w/ the transport layer &#8211; an old laptop with hping and wireshark running is definitely the way to go. If you want to test MTU problems, or ACLs  -  Hping is fast and easy.</p>
<p>Hping is an amazing tool &#8211; one of my favorites. Hand crafted TCP and UDP traceroutes are easy as hell, and hand crafting TCP timestamp requests is easy too. Just read the manpages and you&#8217;ll find all sorts of interesting features of TCP/IP.</p>
<div id="attachment_964" class="wp-caption aligncenter" style="width: 160px"><a href="http://www.braindeadprojects.com/blog/wp-content/hping.jpg"><img class="size-full wp-image-964" title="HPing" src="http://www.braindeadprojects.com/blog/wp-content/hping.jpg" alt="hping: A Great Tool" width="150" height="59" /></a><p class="wp-caption-text">hping: Like a screwdriver set with most of the bits.</p></div>
<p>The downside to Hping is that it doesn&#8217;t seem to be under regular development (last release 2005?), and IPv6 isn&#8217;t supported yet (Aside from some basic <a href="http://www.sfc.wide.ad.jp/~watari/Download/sendit.html" target="_blank">third-party patches</a>). Application layer creation is also left for other utilities to handle (But in all fairness &#8211; that&#8217;s not it&#8217;s job)</p>
<p>I was a late adopter, but about a year ago I made a new friend (and picked up some <a title="Python" href="http://www.python.org/" target="_blank">python</a> along the way). My new best friend is <a href="http://www.secdev.org/projects/scapy/doc/" target="_blank">Scapy</a>. &#8220;Scapy is a powerful interactive packet manipulation program. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, match requests and replies, and much more.&#8221; It runs in interactive and script-able mode, and thus far it&#8217;s proven to be quite powerful. It also supports IPv6.</p>
<p>Scapy understands a large number of Application level protocols (SNMP, TFTP, SMB, etc, etc), and makes it easy for one to craft such packets.  When I recently realized early versions of Cisco IP Router Export have corrupt headers &#8211; Scapy came to the rescue (albeit, only to rip the headers off, as fixing them wasn&#8217;t possible).  When I wanted to craft a quick and easy <a href="http://www.braindeadprojects.com/blog/what/freeradius-packet-of-death/" target="_blank">FreeRadius Packet of Death</a> &#8211; Scapy came to the rescue.</p>
<div id="attachment_1241" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/Exploits-Database-by-Offensive-Security_1306085049070.png"><img class="size-medium wp-image-1241" title="Exploits Database by Offensive Security_1306085049070" src="http://www.braindeadprojects.com/blog/wp-content/Exploits-Database-by-Offensive-Security_1306085049070-300x177.png" alt="Exploits Database" width="300" height="177" /></a><p class="wp-caption-text">FreeRadius PoD on www.exploit-db.com</p></div>
<p>Another great thing about Scapy is that it&#8217;s easy to add &#8220;layers&#8221; (protocols). Recently I sat down with the RFC&#8217;s for <a title="OSPF" href="http://en.wikipedia.org/wiki/Open_Shortest_Path_First" target="_blank">OSPF</a> and in about 2 days time had fully implemented OSPF in Scapy &#8211; learning a <strong>lot</strong> about the protocol along the way. (Dirk Loss had beat me and <a href="http://trac.secdev.org/scapy/attachment/wiki/OSPF/scapy_ospf.py" target="_blank">submitted</a> it first, but that was besides the point).</p>
<p>Looking for a fun new world to poke, and tired of IPv4? Sign up for a <a title="Sixxs.net" href="http://www.sixxs.net/" target="_blank">6-in-4 tunnel</a> and go exploring. Just make sure you pack Scapy and a <a href="http://www.packetlevel.ch/html/scapy/scapyipv6.html" target="_blank">handy guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/packet-creation-for-ipv6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customizing the WebConverger Kiosk &#8211; The fast way</title>
		<link>http://www.braindeadprojects.com/blog/what/customizing-the-webconverger-kiosk-the-fast-way/</link>
		<comments>http://www.braindeadprojects.com/blog/what/customizing-the-webconverger-kiosk-the-fast-way/#comments</comments>
		<pubDate>Sat, 07 May 2011 22:14:35 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[GIMP]]></category>
		<category><![CDATA[Kiosk]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1056</guid>
		<description><![CDATA[Recently I was asked to assist a co-worker find a good locked down Kiosk solution for a local coffee shop. The project requirement was small &#8211; mostly just a simple browser. There seems to have been a LOT of Linux based Kiosk projects out there, most of them now deprecated. After a bit of searching, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was asked to assist a co-worker find a good locked down Kiosk solution for a local coffee shop. The project requirement was small &#8211; mostly just a simple browser.</p>
<p>There seems to have been a LOT of Linux based Kiosk projects out there, most of them now deprecated. After a bit of searching, I came across a good one &#8211; <a title="WebConverger" href="http://webconverger.org/kiosk/">WebConverger</a>.</p>
<div id="attachment_1057" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.braindeadprojects.com/blog/wp-content/webconverger.png"><img class="size-medium wp-image-1057" title="webconverger" src="http://www.braindeadprojects.com/blog/wp-content/webconverger-300x225.png" alt="" width="300" height="225" /></a><p class="wp-caption-text">Webconverger</p></div>
<p>Webconverger is a Live Debian build, created and maintained by Kai Hendry using the <a title="Debian Live" href="http://live.debian.net/" target="_blank">Debian Live-builder packages</a>. The LiveCD includes the lightweight  <a title="Dynamic Window Manager" href="http://dwm.suckless.org/" target="_blank">Dynamic Window Manager (DWM) </a> , the <a title="IceWeasel" href="http://wiki.debian.org/Iceweasel" target="_blank">IceWeasel browser</a> with Webconverger kiosk extension (to lock things down), and&#8230; well that&#8217;s about it.</p>
<p>Kai has <a title="WebConverger for Developers" href="http://webconverger.org/develop/" target="_blank">excellent documentation</a> on rolling your own Webconverger LiveCD using his GIT repository, although being pressed for time I opted to go the <a title="BrainDeadProjects" href="http://www.braindeadprojects.com" target="_blank">BraindeadProjects</a> route: Just modify <a title="Webconverger ISO" href="http://download.webconverger.com/" target="_blank">his already released ISO</a>.</p>
<p>To begin modifying it in this manner, first mount the iso using a loopback device:</p>
<blockquote><p>#mkdir /mnt/webconverger<br />
#mount -o loop webc-7.2.iso /mnt/webconverger</p></blockquote>
<p>Next mount the <a title="Squash FS" href="http://squashfs.sourceforge.net/" target="_blank">SquashFS</a> image, also using a loopback device:</p>
<blockquote><p>#mkdir /mnt/webconverger-filesystem<br />
#mount -o loop -t squashfs /mnt/webconverger/live/filesystem.squashfs \<br />
/mnt/webconverger-filesystem</p></blockquote>
<p>As these two mounts are readonly, we need to create editable copies of each.</p>
<blockquote><p>#mkdir /devel/isolinux<br />
#rsync -av /mnt/webconverger/ /devel/isolinux/</p>
<p>#mkdir /devel/squashfs<br />
#rsync -av /mnt/webconverger-filesystem/ /devel/squashfs/</p></blockquote>
<p>Now we can go about modifying these two directories. Changing out the <a title="ISOLINUX" href="http://syslinux.zytor.com/wiki/index.php/ISOLINUX" target="_blank">ISOLINUX</a> boot splash image is an easy start. The image found under /devel/isolinux/isolinux/splash.png is actually an LSS16 image. To replace it, take or create an image 640&#215;480 in size, and convert it to 14 indexed colors. (In GIMP, these options are under Image/Index)</p>
<div id="attachment_1115" class="wp-caption aligncenter" style="width: 270px"><a href="http://www.braindeadprojects.com/blog/wp-content/indexed-gimp-splash.png"><img class="size-medium wp-image-1115" title="Indexing Colors in Gimp" src="http://www.braindeadprojects.com/blog/wp-content/indexed-gimp-splash-260x300.png" alt="" width="260" height="300" /></a><p class="wp-caption-text">Indexing Colors in Gimp</p></div>
<p>Once complete, save your image in <a title="PPM" href="http://netpbm.sourceforge.net/doc/ppm.html" target="_blank">PPM format</a>.</p>
<p>Next, you&#8217;ll need the syslinux package installed on your machine. The syslinux package includes a handy utility to convert PPM to LSS16 (for use as a bootsplash image)</p>
<blockquote><p>#ppmtolss16 &lt; /tmp/myimage-boot.ppm &gt; splash.png</p></blockquote>
<p>Since you&#8217;re already working on the ISOLINUX side of things, I recommend looking at and revising your boot menu. Once I have an image that I&#8217;m happy with, I set the following options to prevent someone from rebooting the Kiosk and tampering with boot parameters:</p>
<blockquote><p>menu background /isolinux/splash.png<br />
default /isolinux/vesamenu.c32<br />
noescape 1<br />
nocomplete 1<br />
prompt 0<br />
timeout 15<br />
allowoptions 0</p></blockquote>
<p>While you can nest a number of ISOLINUX boot configs together, I generally keep it to one file that includes the above directives. Dont&#8217; forget to include at least one label for a kernel to boot.</p>
<p>After updating the Boot Splash screen, have a look at /devel/squashfs/home/webc/pb.sh. This script is what causes IceWeasel to start, restart if closed, and sets the desktop background image (amongst other things). This script also downloads a background image from your homepage at boot &#8211; which can come in handy if you want to rotate daily ads.  I&#8217;ve personally modified my installation to always load the same background image, and fullscreen that image.</p>
<p>The webpage that appears each time IceWeasel starts is passed as kernel boot parameter (homepage). To update the homepage, simply edit the labels in the ISOLINUX  directory.</p>
<p>You will notice that when pressing the home button in the browser however, that you&#8217;re actually taken to an about: page that gives details about the current IceWeasel build. To configure this homepage, look at /usr/lib/iceweasel/browserconfig.properties</p>
<blockquote><p>browser.startup.homepage=www.braindeadprojects.com</p></blockquote>
<p>I personally like to lock things down a bit more than the standard release. For that reason I also add the following to /etc/iceweasel/pref/local.js</p>
<blockquote><p>pref(&#8220;network.protocol-handler.external.snews&#8221;, false);<br />
pref(&#8220;network.protocol-handler.external.news&#8221;, false);<br />
pref(&#8220;network.protocol-handler.external.irc&#8221;, false);<br />
pref(&#8220;network.protocol-handler.external.mail&#8221;, false);<br />
pref(&#8220;network.protocol-handler.external.mailto&#8221;, false);</p></blockquote>
<p>Another thing that may prove beneficial is to remove any and all remnants of xterm. As xorg does depend upon xterm, it will have to be forceably removed. This is best done in a chroot environment</p>
<blockquote><p>#chroot /devel/squashfs/ /bin/bash<br />
#dpkg &#8211;force-all -p xterm<br />
#exit</p></blockquote>
<p>Once you have your modifications complete, you will want to re-squash the squash filesystem. To do this, you&#8217;ll need squashfs-tools version 4 (Centos is currently distributing version 3, so do keep that in mind). Squashing using version 3 of the tools will result in a non-bootable kiosk.</p>
<blockquote><p>#mksquashfs /devel/squashfs/ /tmp/webc.squashfs<br />
#mv /tmp/webc.squashfs /devel/isolinux/live/filesystem.squashfs<br />
#cd /devel/isolinux/<br />
#mkisofs -o /tmp/my-webc.iso -b -r -J -l -cache-inodes -allow-multidot -no-emul-boot \<br />
-boot-load-size 4 -boot-info-table -b  isolinux/isolinux.bin -c isolinux/boot.cat \<br />
/devel/isolinux</p></blockquote>
<p>Finally, isohybrid your ISO:</p>
<blockquote><p>isohybrid /tmp/my-webc.iso</p></blockquote>
<p>I highly recommend testing your ISO image in <a title="VirtualBox" href="www.virtualbox.org/ " target="_blank">VirtualBox</a>. Using VirtualBox (or any other virtualization option), saves you from constantly burning an image to  a CD or USB drive. Be mindful that you can skip the isohybrid step and test with VirtualBox, although you won&#8217;t be able to install it later using dd.</p>
<p>Once you have an image that you&#8217;re happy with, use dd to copy the ISO onto the hard drive of your Kiosk machine. Personally, I copy my ISO to a USB thumbdrive running the Gentoo Based  <a title="System Rescue CD" href="http://www.sysresccd.org/Main_Page" target="_blank">System Rescue CD</a>, boot into it and then install onto the harddrive:</p>
<blockquote><p>dd if =/livemnt/boot/kiosk/my-kiosk.iso of=/dev/sda</p></blockquote>
<p>&nbsp;</p>
<p>Of course, one could save time and simply use the <a title="WebConvergers Customization Service" href="http://webconverger.com/buy/" target="_blank">WebConverger Customization Service</a>&#8230; but why not use this as an opportunity to sharpen one&#8217;s skills.</p>
<p>Coming soon to &#8211; a walkthrough on how to build and customize a WebConverger ISO from Kai&#8217;s GIT repository (as opposed to re-rolling his ISO).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/customizing-the-webconverger-kiosk-the-fast-way/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Back in the dark ages</title>
		<link>http://www.braindeadprojects.com/blog/what/back-in-the-dark-ages/</link>
		<comments>http://www.braindeadprojects.com/blog/what/back-in-the-dark-ages/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 18:26:52 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[BrainDeadTip]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=830</guid>
		<description><![CDATA[Recently (don&#8217;t ask me why, seriously) I had to migrate a physical Redhat 9 server to a virtualized platform (KVM). Yes, ideally one rebuilds the deprecated server anew, but due to time-constraints and a number of other issues that wasn&#8217;t a possibility. Unfortunately, sometimes you just have no choice but to kick the can down [...]]]></description>
			<content:encoded><![CDATA[<p>Recently (don&#8217;t ask me why, seriously) I had to migrate a physical <a title="Redhat 9" href="http://www.redhat.com/about/presscenter/2003/press_rhl9.html">Redhat 9 </a>server to a virtualized platform (<a title="KVM" href="http://www.linux-kvm.org/page/Main_Page">KVM</a>).</p>
<p>Yes, ideally one rebuilds the deprecated server anew, but due to time-constraints and a number of other issues that wasn&#8217;t a possibility. Unfortunately, sometimes you just have no choice but to kick the can down the street.</p>
<p>The migration from physical to virtual is simple &#8211; create the virtual guest, create an <a title="LVM" href="http://en.wikipedia.org/wiki/Logical_Volume_Manager_%28Linux%29">LVM</a> logical volume for the disk,  format it and rsync the contents from the physical to the virtual drive. After that, install grub on the guest and voila &#8211; you&#8217;re done.</p>
<p>Keeping some consistency (although unnecessary), I went with an <a title="The EXT3 filesystem" href="http://en.wikipedia.org/wiki/Ext3" target="_blank">EXT3 filesystem</a> on the &#8220;new&#8221; guest. Unfortunately, I came across the following snags:</p>
<ul>
<li>The inode size used in Redhat 9 is 128 bytes, but modern systems (ie: the host I formatted the partitions from ) use 256 bytes.</li>
<li>There&#8217;s a number of attributes that weren&#8217;t present in Redhat 9.</li>
</ul>
<p>Here&#8217;s the output of tune2fs on a Redhat 9 EXT3 partition:</p>
<blockquote><p># tune2fs -l /dev/hda1<br />
tune2fs 1.32 (09-Nov-2002)<br />
Filesystem volume name:   /boot<br />
Last mounted on:          &lt;not available&gt;<br />
Filesystem UUID:          9e6fa853-18bc-4c08-bb7c-51c74e0c11ae<br />
Filesystem magic number:  0xEF53<br />
Filesystem revision #:    1 (dynamic)<br />
Filesystem features:      <strong>has_journal filetype ﻿needs_recovery ﻿ sparse_super</strong><br />
Default mount options:    (none)<br />
Filesystem state:         clean<br />
Errors behavior:          Continue<br />
Filesystem OS type:       Linux<br />
Inode count:              8032<br />
Block count:              32096<br />
Reserved block count:     1604<br />
Free blocks:              17451<br />
Free inodes:              7982<br />
First block:              1<br />
Block size:               1024<br />
Fragment size:            1024<br />
Blocks per group:         8192<br />
Fragments per group:      8192<br />
Inodes per group:         2008<br />
Inode blocks per group:   251<br />
Filesystem created:       Tue Oct 26 12:48:49 2010<br />
Last mount time:          Thu Oct 28 15:58:10 2010<br />
Last write time:          Thu Oct 28 15:58:10 2010<br />
Mount count:              11<br />
Maximum mount count:      28<br />
Last checked:             Tue Oct 26 12:48:49 2010<br />
Check interval:           15552000 (6 months)<br />
Next check after:         Sun Apr 24 12:48:49 2011<br />
Reserved blocks uid:      0 (user root)<br />
Reserved blocks gid:      0 (group root)<br />
First inode:              11<br />
Inode size:               <strong>128</strong><br />
Journal UUID:             &lt;none&gt;<br />
Journal inode:            8<br />
Journal device:           0&#215;0000<br />
First orphan inode:       0</p></blockquote>
<p>The following is output from a Centos 5.5 formatted EXT3 filesystem:</p>
<blockquote><p># tune2fs -l /dev/mapper/VolGroup00-LogVol00<br />
tune2fs 1.39 (29-May-2006)<br />
Filesystem volume name:   &lt;none&gt;<br />
Last mounted on:          &lt;not available&gt;<br />
Filesystem UUID:          7384cac8-b098-4c85-be6d-643443ae3d3d<br />
Filesystem magic number:  0xEF53<br />
Filesystem revision #:    1 (dynamic)<br />
Filesystem features:     <strong> has_journal ext_attr resize_inode dir_index filetype needs_recovery sparse_super large_file</strong><br />
Default mount options:    user_xattr acl<br />
Filesystem state:         clean<br />
Errors behavior:          Continue<br />
Filesystem OS type:       Linux<br />
Inode count:              6809088<br />
Block count:              6807552<br />
Reserved block count:     340377<br />
Free blocks:              6204875<br />
Free inodes:              6752521<br />
First block:              0<br />
Block size:               4096<br />
Fragment size:            4096<br />
Reserved GDT blocks:      1022<br />
Blocks per group:         32768<br />
Fragments per group:      32768<br />
Inodes per group:         32736<br />
Inode blocks per group:   1023<br />
Filesystem created:       Thu Oct 28 13:31:34 2010<br />
Last mount time:          Thu Oct 28 17:43:57 2010<br />
Last write time:          Thu Oct 28 17:43:57 2010<br />
Mount count:              2<br />
Maximum mount count:      -1<br />
Last checked:             Thu Oct 28 13:31:34 2010<br />
Check interval:           0 (&lt;none&gt;)<br />
Reserved blocks uid:      0 (user root)<br />
Reserved blocks gid:      0 (group root)<br />
First inode:              11<br />
Inode size:              <strong> 128</strong><br />
Journal inode:            8<br />
Default directory hash:   tea<br />
Directory Hash Seed:      42eb54b3-8f66-4aef-8578-388c9863423c<br />
Journal backup:           inode blocks</p></blockquote>
<p>As you can see, some basic features and the inode size has changed in 10+ years. The solution:  format the &#8220;new&#8221; guest  to match the specs of the old:</p>
<blockquote><p>#mke2fs -O has_journal,filetype,sparse_super,^ext_attr,^resize_inode,^dir_index \<br />
-I 128 -j /dev/sda$disk</p></blockquote>
<p>And that&#8217;s it- rysnc the files over to the guest VM, install grub, verify your fstab is good, and voila &#8211; you&#8217;ve transferred a physical server to a virtual one.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/back-in-the-dark-ages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quit Googling your Passwords</title>
		<link>http://www.braindeadprojects.com/blog/what/quit-googling-your-passwords/</link>
		<comments>http://www.braindeadprojects.com/blog/what/quit-googling-your-passwords/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 22:09:14 +0000</pubDate>
		<dc:creator>Matthew Gillespie (admin)</dc:creator>
				<category><![CDATA[BrainDeadTip]]></category>
		<category><![CDATA[What?!]]></category>

		<guid isPermaLink="false">http://www.braindeadprojects.com/blog/?p=1034</guid>
		<description><![CDATA[Recently, I noticed someone using one of the QuickSearch toolbars included in Firefox as a place to temporarily paste something while working on their desktop. It makes sense, you need to place to hold something for a moment &#8211; it&#8217;s right there and readily available. And since you&#8217;re not pressing the Enter key, it&#8217;s not [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I noticed someone using one of the QuickSearch toolbars included in <a title="FireFox" href="http://www.mozilla.com/" target="_blank">Firefox</a> as a place to temporarily paste something while working on their desktop.</p>
<div id="attachment_1041" class="wp-caption aligncenter" style="width: 273px"><a href="http://www.braindeadprojects.com/blog/wp-content/putithere.png"><img class="size-full wp-image-1041" title="I'll put it here" src="http://www.braindeadprojects.com/blog/wp-content/putithere.png" alt="" width="263" height="227" /></a><p class="wp-caption-text">Put it here temporarily?</p></div>
<p>It makes sense, you need to place to hold something for a moment &#8211; it&#8217;s right there and readily available. And since you&#8217;re not pressing the Enter key, it&#8217;s not going to be sent anywhere right?</p>
<p>Well, actually it is. After you stop typing, it immediately sends an <a title="HTTP POST" href="http://en.wikipedia.org/wiki/POST_%28HTTP%29" target="_blank">HTTP POST </a>request to it&#8217;s target (<a title="Google" href="http://www.google.com" target="_blank">Google</a> in this case). And while the search does takes place, it doesn&#8217;t update your browser (so you might not realize it even happens). Here&#8217;s a copy of the content in the packet:</p>
<p>&nbsp;</p>
<blockquote><p>GET /complete/search?output=firefox&amp;client=firefox&amp;hl=en-US&amp;q=<strong>mysuperleetpassword </strong>HTTP/1.1<br />
Host: suggestqueries.google.com<br />
User-Agent: &lt;omitted&gt;<br />
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8</p></blockquote>
<p>&nbsp;</p>
<p>Does this matter? That depends on what you put there. You probably wouldn&#8217;t pick up the phone and call Google (or <a title="Yahoo!" href="http://yahoo.com" target="_blank">Yahoo!</a>, or <a title="Bing" href="http://bing.com" target="_blank">BING</a>, etc) and tell the receptionist &#8220;Hey, my <a title="FaceBook" href="http://facebook.com" target="_blank">Facebook</a> username is &#8230; and my password is &#8230;&#8221;, but you can very easily do this by simply pasting ANYTHING in that handy little search bar.</p>
<p>Here&#8217;s a quick video of me running a packet capture and typing something into the search area. Again, I only moved my cursor &#8211; never did I press Enter (View it fullscreen for better detail).</p>
<p>&nbsp;</p>
<p><object width="480" height="390"><param name="movie" value="http://www.youtube.com/v/O7Bv4-aCRBM?fs=1&amp;hl=en_US" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed type="application/x-shockwave-flash" width="480" height="390" src="http://www.youtube.com/v/O7Bv4-aCRBM?fs=1&amp;hl=en_US" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>I wonder how much garbage accidentally falls into search engine pits like this. I&#8217;m also curious as to how many sites log mistyped passwords (think of it this way &#8211; you accidentally type your webmail password into Facebook or vice versa).</p>
<p>All the misguided traffic reminds me of  the <a title="IPv4 pollution" href="http://labs.ripe.net/Members/franz/content-pollution-18" target="_blank">pollution problem of 1.0.0.0/8</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.braindeadprojects.com/blog/what/quit-googling-your-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced

Served from: www.braindeadprojects.com @ 2012-05-20 05:32:46 -->
