<?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/"
	>

<channel>
	<title>tolaris.com</title>
	<atom:link href="http://www.tolaris.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tolaris.com</link>
	<description>Back off, man. I'm a scientist.</description>
	<pubDate>Wed, 12 Nov 2008 14:36:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Frequency math, or don&#8217;t touch my local oscillator</title>
		<link>http://www.tolaris.com/2008/10/23/frequency-math-or-dont-touch-my-local-oscillator/</link>
		<comments>http://www.tolaris.com/2008/10/23/frequency-math-or-dont-touch-my-local-oscillator/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 16:04:03 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[satellite]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=163</guid>
		<description><![CDATA[Satellite engineers have a very poor showing on the Internet.  I started writing about satellite stuff because of how difficult it has been for me to find reliable information.  I&#8217;ve had to do a lot of learning by doing.  Perhaps other satellite engineers enjoy their business being a black art, but like [...]]]></description>
			<content:encoded><![CDATA[<p>Satellite engineers have a very poor showing on the Internet.  I started writing about satellite stuff because of how difficult it has been for me to find reliable information.  I&#8217;ve had to do a lot of learning by doing.  Perhaps other satellite engineers enjoy their business being a black art, but like locksmiths and security alarm salesmen, they&#8217;re just waiting for the light of responsible disclosure to toss their world upside down.</p>
<p>And that brings me to a trend I have noticed in the satellite Internet business.  There are two camps: radio guys who somehow configure a router, and IP guys who somehow align an antenna.  Usually the IP guys do better in business than the radio guys.  Perhaps this is because radio guys tend to be former military and unused to competition.  Perhaps this is because they think all you have to do is deliver a carrier and everyone is happy.  But the customer doesn&#8217;t care about <em>Hertz</em>, he cares about <em>bits</em>.  And really, the space link is still a <a href="http://en.wikipedia.org/wiki/Osi_model">Layer 1 problem</a>, and the harder work is above that.</p>
<p>On with revealing a little black magic.</p>
<p><span id="more-163"></span>Satellite systems communicate over a variety of frequencies.  Modems and other terrestrial equipment commonly communicate between each other in one frequency range, yet the actual spacelink communication happens in another frequency range entirely.</p>
<p>The <a href="http://en.wikipedia.org/wiki/Radio_waves#IEEE_US">frequency bands</a> I most commonly deal in my job managing satellite Internet services are (band, receive range, transmit range):</p>
<ul>
<li>L-band, Rx 950-1450 MHz, Tx 1250-1750 MHz</li>
<li>C-band, Rx 3625-4200 MHz, Tx 5850-6425 MHz</li>
<li>Ku-band, Rx 10.95-12.75 GHz, Tx 13.75-14.5 GHz</li>
</ul>
<p>There are a lot of ways to get confused here.  The definitions of these bands varies from region to region.  There are a lot of confusing terms like &#8220;standard Ku&#8221; and &#8220;extended Ku&#8221; despite there being overlap between the two ranges they define.  The C-band I define above is actually called &#8220;extended C-band&#8221;, yet there is no &#8220;standard C band&#8221; as far as I can tell.  And the Wikipedia articles on these things are a mess.</p>
<p>Satellite communication is normally a one-way process.  Internet communication is by nature two-way, but from a satellite perspective we can regard it as two one-way processes. <a name="note1_back" href="#note1">*</a> So we&#8217;ll analyse it from that perspective.</p>
<p>During the entire one-way process, the physical communication signal changes frequencies four times.  This is done to avoid radio interference at the satellite and ground antennas, and to avoid electrical resistance when communicating over copper.</p>
<p>Assuming Ku-band communication with the satellite, the devices that do the translating are:</p>
<ol>
<li>BUC, or Block Up-Converter, which steps a carrier up from Tx L-band to Tx Ku-band</li>
<li>The frequency translator at the transponder on board the satellite, which steps a carrier down from the Tx Ku-band to the Rx Ku-band for retransmission to Earth</li>
<li>LNB, or Low-Noise Block down-converter, which steps a carrier down from Rx Ku-band to Rx L-band</li>
</ol>
<p>These devices work by using a fixed translation amount, called the LO, for Local Oscillator.  If you&#8217;ve guessed this is because an actual fixed oscillating clock is used, you are correct!  It is very important to know what the LO value is, or you don&#8217;t know what frequency your transmission will become.</p>
<p>Let&#8217;s say a modem starts transmitting at 1131 MHz over a copper wire.  This signal reaches a BUC with an LO of 12800 MHz.  1131 + 12800 = 13931 MHz, which is then transmitted into space as radio.  The satellite receives 13931 MHz, where the transponder&#8217;s translator has an LO too.  Here, it is 1260 MHz, and 13931 - 1260 = 12671 MHz, so 12671 MHz is then transmitted back to Earth as radio. <a name="note2_back" href="#note2">**</a> Finally this 12671 MHz reaches the customer&#8217;s LNB with an LO of 11300 MHz.  12671 - 11300 = 1371 MHz, which is what reaches the customer&#8217;s modem.</p>
<p>In summary:</p>
<ol>
<li>1131 MHz (modem)</li>
<li>1131 + 12800 = 13931 MHz (BUC)</li>
<li>13931 - 1260 = 12671 MHz (transponder translation)</li>
<li>12671 - 11300 = 1371 MHz (LNB)</li>
</ol>
<p>The process repeats itself when the customer transmits in return, using whatever BUC and LNB are installed in the opposite direction.  It&#8217;s common for both BUCs to have the same LO, and both LNBs, which makes the math easy for me.  Each group of transponders on a satellite has its own transponder translation frequency, and these are different between C-band, Ku-band, K-band, and so on.  The average technical user guide for the satellites Talia operates on is 35 pages.  Read carefully.</p>
<p>I have a large spreadsheet tracking frequency translations like this.  When you call a satellite operator to complain about a problem, they want the downlink frequency (12671 MHz in the example above).  They certainly don&#8217;t know or care what your L-band frequencies are, because they can be different depending on the LO of your equipment!</p>
<p>A spectrum analyser is a common tool for observing satellite carriers, checking for interference, and measuring transmission power.  Spectrum analysers commonly operate in L-band.  This means that you must spot a problem in L-band and then do the math to find the downlink frequency before reporting a problem to the satellite operator.  It seems to me that internally calculating the translation values would be a simple feature of a spectrum analyser, but most cheap ones (under $10,000 USD) don&#8217;t offer this.  You&#8217;d need to define profiles for your different hardware/satellite configurations, but anyway it&#8217;s something that an IP engineer would think to add and a radio engineer just expects they&#8217;ll have to do manually.</p>
<p>I have yet to find even a single open source package to manage frequency plans or carrier assignments, by even the simplest methods.  My spreadsheet is the most advanced free tool I have for this.</p>
<hr />
<p><a name="note1" href="#note1_back">*</a> Sometimes satellite Internet services are one-way.  The download link is via satellite, and the upload link via terrestrial modem.  But that method is unpopular today.</p>
<p><a name="note2" href="#note2_back">**</a> I find it interesting that satellites themselves receive in the Tx range and transmit in the Rx range.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/10/23/frequency-math-or-dont-touch-my-local-oscillator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Disabling Wordpress character replacements inside code tags</title>
		<link>http://www.tolaris.com/2008/10/13/disabling-wordpress-character-replacements-inside-code-tags/</link>
		<comments>http://www.tolaris.com/2008/10/13/disabling-wordpress-character-replacements-inside-code-tags/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 20:34:04 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=154</guid>
		<description><![CDATA[I noticed when reviewing a recent post that Wordpress was &#8220;helpfully&#8221; replacing two hyphens with emdash, three dots with ellipsis, apostrophe with curly apostrophe, etc.  It does this even between &#60;code&#62; tags - on the second line and beyond.  I appreciate that Wordpress does this when I&#8217;m writing in a journalistic style, but [...]]]></description>
			<content:encoded><![CDATA[<p>I noticed when reviewing a recent post that Wordpress was &#8220;helpfully&#8221; replacing two hyphens with emdash, three dots with ellipsis, apostrophe with curly apostrophe, etc.  It does this even between &lt;code&gt; tags - on the second line and beyond.  I appreciate that Wordpress does this when I&#8217;m writing in a journalistic style, but I&#8217;m also a programmer and engineer, which means it hinders as often as it helps.</p>
<p><span id="more-154"></span>In Wordpress 2.6.2, the problem comes from a bug in ./wp-includes/formatting.php.  The auto-formatter tries not to do these replacements between code tags, but incorrectly identifies the start of any following tag as the end of the code section.  That means a multi-line code section (which has &lt;br&gt; tags breaking each line) will have replacements run on it on all lines after the first.</p>
<p>This bug is found between lines 30 and 43:</p>
<pre>if (isset($curl{0}) &amp;&amp; '&lt;' != $curl{0} &amp;&amp; '[' != $curl{0} &amp;&amp; $next &amp;&amp; !$has_pre_parent) { // If it's not a tag
   // static strings
   $curl = str_replace($static_characters, $static_replacements, $curl);
   // regular expressions
   $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
} elseif (strpos($curl, '&lt;code') !== false || strpos($curl, '&lt;kbd') !== false || strpos($curl, '&lt;style') !== false || strpos($curl, '&lt;script') !== false) {
   $next = false;
} elseif (strpos($curl, '&lt;pre') !== false) {
   $has_pre_parent = true;
} elseif (strpos($curl, '&lt;/pre&gt;') !== false) {
   $has_pre_parent = false;
} else {
   $next = true;
}</pre>
<p>The solution is to make code tags behave like pre tags.  Change lines 35-39 to the following:</p>
<pre>} elseif (strpos($curl, '&lt;kbd') !== false || strpos($curl, '&lt;style') !== false || strpos($curl, '&lt;script') !== false) {
   $next = false;
} elseif (strpos($curl, '&lt;pre') !== false || strpos($curl, '&lt;code') !== false) {
   $has_pre_parent = true;
} elseif (strpos($curl, '&lt;/pre&gt;') !== false || strpos($curl, '&lt;/code&gt;') !== false) {
   $has_pre_parent = false;</pre>
<p>Now code tags will be treated as pre tags - absolutely no replacements except for those necessary for HTML encoding.  This does introduce bugs in the case of nested code and pre tags, so don&#8217;t put them inside each other.</p>
<p>If you want to disable replacements altogether, just comment out lines 32 and 34 (the str_replace and preg_replace calls).</p>
<p>Aside: writing this article so all the tags would display correctly was an incredible pain.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/10/13/disabling-wordpress-character-replacements-inside-code-tags/feed/</wfw:commentRss>
		</item>
		<item>
		<title>kgtk packaged for Ubuntu Hardy</title>
		<link>http://www.tolaris.com/2008/10/12/kgtk-packaged-for-ubuntu-hardy/</link>
		<comments>http://www.tolaris.com/2008/10/12/kgtk-packaged-for-ubuntu-hardy/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 20:04:07 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[repo]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=143</guid>
		<description><![CDATA[KGTK is a wrapper utility that allows GTK applications to use the native KDE file open/save dialogs.  I cannot stand the GTK/Gnome dialogs, and I this helps apps like Firefox maintain a consistent appearance with KDE.
I&#8217;ve packaged the latest release, 0.10.0, for Ubuntu Hardy amd64 and i386.  It is available in my repository [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.kde-apps.org/content/show.php?content=36077">KGTK</a> is a wrapper utility that allows GTK applications to use the native KDE file open/save dialogs.  I cannot stand the GTK/Gnome dialogs, and I this helps apps like Firefox maintain a consistent appearance with KDE.</p>
<p>I&#8217;ve packaged the latest release, 0.10.0, for Ubuntu Hardy amd64 and i386.  It is available in my <a href="http://www.tolaris.com/apt-repository/">repository</a> now.  Source packages are provided, so any other Debian-based distro or architecture should be able to build it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/10/12/kgtk-packaged-for-ubuntu-hardy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Identifying undersea fibre and satellite links with traceroute</title>
		<link>http://www.tolaris.com/2008/10/09/identifying-undersea-fibre-and-satellite-links-with-traceroute/</link>
		<comments>http://www.tolaris.com/2008/10/09/identifying-undersea-fibre-and-satellite-links-with-traceroute/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 20:07:40 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[fibre]]></category>

		<category><![CDATA[network]]></category>

		<category><![CDATA[routing]]></category>

		<category><![CDATA[satellite]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=113</guid>
		<description><![CDATA[I frequently travel to the Middle East, which means I often find myself on the wrong end of a slow Internet link.  Sometimes that is oversold undersea fibre, such as in Dubai.  More often - because of my work - it is VSAT.  I&#8217;m an engineer, which means I&#8217;m a curious monkey [...]]]></description>
			<content:encoded><![CDATA[<p>I frequently travel to the Middle East, which means I often find myself on the wrong end of a slow Internet link.  Sometimes that is oversold undersea fibre, such as in Dubai.  More often - because of my work - it is VSAT.  I&#8217;m an engineer, which means I&#8217;m a curious monkey that takes everything apart just to understand how it works.  Network topology is one of those things.</p>
<p><span id="more-113"></span></p>
<p>I wrote about something similar on my <a href="http://giantlaser.livejournal.com/133191.html">other blog</a> last year.</p>
<p>First, some background information on VSAT.  The single biggest limitation of satellite Internet service is latency.  In network terms, latency is the total round trip time for your packet to reach its destination and for the reply to return.  When we speak of &#8220;ping time&#8221;, what we mean is latency.</p>
<p>Here are some common latency measurements in milliseconds (ms):</p>
<p>1 ms - within your LAN<br />
25 ms - my home cable service in London to servers located in mainland UK<br />
90 ms - typical home DSL in the US to google.com<br />
100-150 ms - the transatlantic cable between the UK and New York state<br />
600-2000 ms - typical VSAT remote to hub link</p>
<p>Why is VSAT latency so high?  Geosynchronous satellites orbit at an altitude of 35,000 km.  VSAT remotes connect to the Internet via a star-shaped network with a hub at the centre.  When a remote modem pings google.com, its traffic must travel up to the satellite, then back down to our teleport, and then over the terrestrial Internet to google.com.  The reply does the opposite, returning back over the terrestrial Internet, back up to the satellite and down again to the remote.  That means every single ping you send is travelling 35,000 x 4 = 120,000 km.  Divide by <a href="http://en.wikipedia.org/wiki/Speed_of_light">c</a>, and you find the minimum latency for any VSAT is 480 ms.  Further time is added due to radio modulation, error correction, router delay, and various technical issues with shared bandwidth satellite networks.  All that adds up to a minimum effective latency for all VSAT communications of about 600 ms.  If that network is busy, it goes up.</p>
<p>So when one of our customers makes a VoIP phone call, there is an audible (600 ms) delay between when he speaks and when he can expect a reply.  We constantly work to keep that number as low as possible.  People seem to tolerate up to 250 ms without noticing, but when you start edging up to one second, it quickly becomes intolerable - less like a phone, more like a radio.</p>
<p>This latency is immediately noticeable on ping and traceroute.  I prefer <a href="http://www.bitwizard.nl/mtr/">mtr</a>, a tool that combines the two.  Plain old tracert / traceroute will show you the same results, just a lot slower. Here is an example run from a VSAT link:</p>
<p><code>mtr yahoo.com</code></p>
<pre> Host                                       Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 192.168.5.1                              0.0%    10    1.3   3.3   1.2   7.2   2.4
 2. 172.16.4.97                              0.0%     9  605.8 672.2 605.8 764.5  54.4
 3. 172.16.4.1                               0.0%     9  699.6 690.7 611.9 761.6  50.7
 4. 172.16.3.1                               0.0%     9  637.1 666.6 578.1 763.7  58.6
 5. kln-145-253-9-73.arcor-ip.net            0.0%     9  671.4 638.1 592.0 699.7  38.2
 6. kln-145-254-9-153.arcor-ip.net           0.0%     9  640.2 638.9 578.5 736.1  46.8
 7. dus-145-254-18-194.arcor-ip.net          0.0%     9  655.3 650.9 609.2 684.5  24.2
 8. amd-145-254-16-130.arcor-ip.net          0.0%     9  702.0 667.6 604.8 778.2  60.2
 9. ge-1-3-0.pat1.ams.yahoo.com              0.0%     9  740.9 665.1 595.4 740.9  47.3
10. ge-1-2-0.pat2.ams.yahoo.com              0.0%     8  677.7 673.2 621.4 739.4  37.2
11. so-3-1-0-pat1.the.yahoo.com              0.0%     8  711.9 680.5 616.7 773.4  56.4
12. so-2-1-0-pat1.nyc.yahoo.com              0.0%     8  706.9 706.0 682.0 732.4  17.1
13. so-3-0-0.pat1.dcp.yahoo.com              0.0%     8  685.3 726.9 685.3 755.4  29.3
14. ae2-p170.msr2.re1.yahoo.com              0.0%     8  731.8 747.0 731.3 779.9  18.3
    ae2-p160.msr1.re1.yahoo.com
15. ge-9-3.bas-a1.re4.yahoo.com              0.0%     8  677.9 757.3 677.9 819.1  45.2
    te-8-3.bas-a2.re4.yahoo.com
16. w2.rc.vip.re4.yahoo.com                  0.0%     8  789.1 785.1 708.1 853.4  48.6</pre>
<p>Note the huge jump in latency between hops 1 and 2.  This must be the space link - hop 1 is the remote modem and hop 2 is the hub modem (the one in the teleport).</p>
<p>The jump in latency is obvious in both directions.  From a terrestrial link to a VSAT IP:</p>
<pre> Host                                       Loss%   Snt   Last   Avg  Best  Wrst StDev
 1. 192.168.1.1                              0.0%    25    0.9   1.1   0.6   6.2   1.1
 2. 192.168.55.34                            0.0%    25    1.1   0.7   0.4   1.1   0.2
 3. 172.16.21.71                             0.0%    25    4.5   4.0   3.6   4.9   0.3
 4. 217.239.41.18                            0.0%    25   39.5  41.5  39.1  67.7   6.9
 5. 193.159.224.254                          0.0%    25   44.6  88.3  44.1 596.8 136.2
 6. 83.137.59.9                              0.0%    24   41.7  42.3  41.4  49.5   1.6
 7. 192.168.140.4                            0.0%    24   42.5  42.7  41.6  44.6   0.6
 8. 192.168.100.50                           0.0%    24   48.1  47.4  46.2  50.3   0.9
 9. 192.168.103.149                          0.0%    24  613.7 719.6 592.2 1128. 127.2
10. 80.86.24.6                               0.0%    24  620.9 787.1 582.9 1678. 272.7</pre>
<p>Here the space link is between hops 8 and 9.</p>
<p>Similar increases in latency are detectable along undersea fibre.  From my home in London to my alma mater Cal Poly:</p>
<pre> 1. gw-belafonte                             0.0%     5    1.0   1.1   1.0   1.2   0.1
 2. 10.181.120.1                             0.0%     5   56.3  41.1  23.5  56.3  14.6
 3. osr01camd-v15.network.virginmedia.net    0.0%     5   32.1  39.9  19.0  89.7  28.8
 4. osr02hari-tenge71.network.virginmedia.n  0.0%     5   40.6  34.6  15.3  54.2  15.0
 5. pop-bb-b-ge-200-0.network.virginmedia.n 20.0%     5   46.1  34.6  18.6  46.1  13.2
 6. gfd-bb-a-so-010-0.network.virginmedia.n 20.0%     5   42.5  47.7  41.7  54.1   6.5
 7. 213.152.245.49                           0.0%     5   23.8  45.8  23.8  65.3  19.1
 8. so-0-0-0.mpr2.ams5.nl.above.net          0.0%     5   46.0  58.0  35.2  83.0  18.3
 9. so-2-0-0.mpr1.lhr2.uk.above.net          0.0%     5   65.2  74.8  47.3 100.2  19.8
10. so-1-1-0.mpr1.dca2.us.above.net          0.0%     5  124.5 120.6 105.2 135.4  10.9
11. so-1-2-0.mpr1.lga5.us.above.net          0.0%     5  132.6 152.9 121.6 216.0  39.1
12. so-2-1-0.mpr1.sjc2.above.net             0.0%     5  187.3 205.8 183.9 251.1  27.0
13. so-4-0-0.mpr3.pao1.us.above.net          0.0%     5  280.9 227.7 200.4 280.9  33.3
14. paix-px1--abovenet.cenic.net            20.0%     5  267.4 232.9 189.2 279.1  46.9
15. dc-svl-core1--svl-dc1-ge.cenic.net       0.0%     5  255.3 240.6 206.3 274.7  26.5
16. dc-sol-agg1--svl-core1-ge.cenic.net      0.0%     5  218.7 216.9 196.6 249.3  19.8
17. dc-sol-agg2--sol-agg1-ge-2.cenic.net    25.0%     5  209.8 209.3 199.1 218.9   9.9
18. dc-slo-dc1--sol-dc2-pos.cenic.net        0.0%     5  240.6 221.6 203.3 240.6  19.9
19. primary-pix-outside.netadm.calpoly.edu  25.0%     5  271.3 247.0 200.7 271.3  40.1
20. 129.65.1.41                              0.0%     5  245.9 213.7 190.7 245.9  23.3
21. ???</pre>
<p>Now we can see that my home is named &#8220;Belafonte&#8221; (hop 1), that I have a network connection via Virgin Media (hops 3-6), that Virgin Media finds it cheaper to route via Above.net through Amsterdam and back to the UK rather than direct within the UK (hops 8 and 9), and that we cross the Atlantic between hops 9 and 10.  Also, Cal Poly should know better than to use DNS names that state both function and operating system to anyone looking (hop 19, a Cisco PIX firewall at their network&#8217;s border).</p>
<p>Note the 60 ms increase in crossing the Atlantic, which is actually quite good for such a long fibre run.  Compare a route from Dubai to the UK:</p>
<pre> 1. 192.168.1.1                              0.0%     7    0.5   0.8   0.5   2.4   0.7
 2. 195.229.244.26                           0.0%     7   10.9  18.4   8.0  48.8  14.9
 3. 195.229.245.98                           0.0%     7   15.3  17.0   7.5  28.3   9.4
 4. 194.170.0.234                            0.0%     7    7.5   8.3   7.5   8.8   0.5
 5. 195.229.1.181                            0.0%     7   10.8  14.4  10.8  28.7   6.6
 6. 195.229.1.166                            0.0%     7   14.4  14.8  14.1  15.4   0.5
 7. pos10-0.cr02.hkg05.pccwbtn.net           0.0%     7  292.6 293.7 292.3 298.9   2.6
 8. uunet.pos1-2.cr02.frf02.pccwbtn.net      0.0%     7  258.8 259.1 258.8 259.5   0.3
 9. ge-1-2-0.TL2.FFT1.ALTER.NET              0.0%     6  259.1 259.1 258.6 259.6   0.3
10. so-0-0-0.XR2.LND9.ALTER.NET              0.0%     6  247.2 250.8 246.7 266.3   7.8
11. POS2-0.GW9.LND10.ALTER.NET               0.0%     6  258.3 259.7 258.3 262.4   1.9</pre>
<p>Care to spot the fibre there?  Here&#8217;s the kicker - it looks like it&#8217;s routing direct from the UAE to the US, then on to the UK!  If memory serves, that&#8217;s probably the FLAG cable that runs from the Persian Gulf to the West Coast of the US.  Yes, they make runs that long!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/10/09/identifying-undersea-fibre-and-satellite-links-with-traceroute/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Running root apps seamlessly on a normal user&#8217;s desktop</title>
		<link>http://www.tolaris.com/2008/10/02/running-root-apps-with-user-gui-preferences/</link>
		<comments>http://www.tolaris.com/2008/10/02/running-root-apps-with-user-gui-preferences/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 18:21:57 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/?p=75</guid>
		<description><![CDATA[I&#8217;m a network engineer, and I run Kubuntu on the desktop.  Which means I often run applications as root: Wireshark, Ettercap, Zenmap, etc.  I prefer a seamless desktop experience, meaning I like my GUI customisations to apply to root applications, not just those running as my own user. Secondly, I like to directly [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a network engineer, and I run Kubuntu on the desktop.  Which means I often run applications as root: Wireshark, Ettercap, Zenmap, etc.  I prefer a seamless desktop experience, meaning I like my GUI customisations to apply to root applications, not just those running as my own user. Secondly, I like to directly launch GUI apps from a root terminal.</p>
<p><span id="more-75"></span></p>
<ol>
<li>Allow root to display applications on the user&#8217;s desktop</li>
<p>Normally only the logged-in user has the authority to run X applications.  This is a good thing, and a useful security feature.  Running commands as your user with sudo allows that application to use your X session, like so:</p>
<p><code>sudo wireshark</code></p>
<p>However, this doesn&#8217;t work:</p>
<p><code>sudo -i<br />
(now as root) wireshark</code></p>
<p>We can work around this by modifying root&#8217;s ~/.Xauthority file.  Either copy yours or link it into /root/, and you&#8217;re done:</p>
<p><code>cd /root/<br />
ln -f -s /home/username/.Xauthority</code></p>
<p>If you have multiple users on the same machine, you can achieve the same goal by merging several files using the <code>xauth</code> command.</p>
<li>Retain environment variables when you execute sudo</li>
<p>OK, now root can make X apps display on tyler&#8217;s display, but he still has to set the DISPLAY variable or pass a -display argument.  So let&#8217;s keep this variable when we login as root with &#8220;<code>sudo -i</code>&#8220;.</p>
<p>Add the following somewhere in /etc/sudoers:</p>
<pre>Defaults                 env_keep+="DISPLAY XAUTHORITY"</pre>
<p>Or just for one user:</p>
<pre>Defaults:username        env_keep+="DISPLAY XAUTHORITY"</pre>
<p>Now DISPLAY, and if you use it, XAUTHORITY, follow you if you use sudo.  You can add any others to this list if you like.</p>
<li>Keep the same GTK preferences as root</li>
<p>Now, your root GTK apps run and display, but they look like something from Windows 95.  This is because GTK has absolutely horrific default settings which are nearly always overridden by your window manager&#8217;s theme, and root doesn&#8217;t have your GTK preferences.  That&#8217;s easy to fix:</p>
<p><code>cd /root/<br />
ln -f -s /home/username/.gtkrc-2.0</code></p>
<p>And if you use KDE with the &#8220;Use my KDE style in GTK applications&#8221; (gtk-qt-engine) setting, you might also want:</p>
<p><code>cd /root/<br />
ln -f -s /home/username/.gtk_qt_engine_rc</code></ol>
<p>Finally, I just like a better sudo prompt.  So I set this at the botton of /etc/bash.bashrc on every machine I manage:</p>
<pre>export SUDO_PROMPT="[sudo] password for %u@%h: "</pre>
<p>This is better than the sudo default (the totally ambiguous &#8220;Password: &#8220;) or the Ubuntu default (&#8221;[sudo] password for username: &#8220;) because it also lists the host you are currently on.  If you login to as many machines as I do, confusing one sudo prompt for another is an easy way to ruin your day.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/10/02/running-root-apps-with-user-gui-preferences/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Moving your Linux root partition to software RAID</title>
		<link>http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/</link>
		<comments>http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/#comments</comments>
		<pubDate>Wed, 01 Oct 2008 19:32:24 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[raid]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/blog/?p=13</guid>
		<description><![CDATA[One of the reasons I started this blog is to write about problems I&#8217;ve solved that I can&#8217;t find answers to already on the web.  Today, let&#8217;s talk about moving your linux install to linux software raid (md raid / mdadm).  This post assumes you are running Ubuntu Linux 8.04, but any Debian-based [...]]]></description>
			<content:encoded><![CDATA[<p>One of the reasons I started this blog is to write about problems I&#8217;ve solved that I can&#8217;t find answers to already on the web.  Today, let&#8217;s talk about moving your linux install to linux software raid (md raid / mdadm).  This post assumes you are running Ubuntu Linux 8.04, but any Debian-based distro from the past two years, or most other distros, will have similar commands.</p>
<p>We start with an  install on a single 80 GB SATA drive, partitioned as follows:</p>
<p><code>/dev/sda1 as /, 10GB, ext3, bootable<br />
/dev/sda2 as swap, 1GB<br />
/dev/sda3 as /home, 69GB, ext3</code></p>
<p>We want to add a second 80GB SATA drive and move the entire install to use RAID1 between the two drives.  So the final configuration will appear:</p>
<p><code>/dev/md0 as /, 10GB, ext3<br />
/dev/md1 as swap, 1GB<br />
/dev/md2 as /home, 69GB, ext3</code></p>
<p>Where the raid arrays are:</p>
<p><code>md0 : active raid1 sda1[0] sdb1[1]<br />
md1 : active raid1 sda2[0] sdb2[1]<br />
md2 : active raid1 sda3[0] sdb3[1]</code></p>
<p>Here there be dragons.  As always, back up your data first.  If you don&#8217;t know how to use rsync, now is an excellent time to learn.</p>
<p><span id="more-13"></span></p>
<p>The general plan is:</p>
<ol>
<li>Partition the new drive</li>
<li>Create RAID arrays on the new drive</li>
<li>Copy the data from drive 1 to the new RAID arrays on drive 2</li>
<li>Install grub on drive 2</li>
<li>Configure fstab and mdadm.conf, and rebuild initramfs images</li>
<li>Reboot on the RAID arrays on drive 2</li>
<li>Repartition drive 1 and add it to RAID</li>
</ol>
<p>All commands are run as root.  Use sudo if you prefer.</p>
<p><strong>Step 1: Partition the new drive</strong></p>
<p>Assuming you want to partition the second drive the same way as the first, this is easy.  Just clone the partitions from /dev/sda to /dev/sdb:</p>
<p><code>sfdisk -d /dev/sda | sfdisk /dev/sdb</code></p>
<p>Then use parted to mark them for software RAID, and the first partition to boot:</p>
<p><code>parted /dev/sdb<br />
(parted) toggle 1 raid<br />
(parted) toggle 2 raid<br />
(parted) toggle 3 raid<br />
(parted) toggle 1 boot<br />
(parted) print</code></p>
<pre>Disk /dev/sdb: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system  Flags
 1      0.51kB  10.0GB  10.0GB  primary  ext3         boot, raid
 2      10.0GB  11.0GB  2000MB  primary  linux-swap   raid
 3      11.0GB  80.0GB  69.0GB  primary  ext3         raid
(parted) quit</pre>
<p>Parted will show you a file system in each partition, but the reality is that they will be plain linux software raid partitions (type 0xfd):</p>
<p><code>fdisk -l /dev/sdb</code></p>
<pre>Disk /dev/sdb: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xa3181e57

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        1216     9765625   fd  Linux RAID autodetect
/dev/sdb2            1216        1338      976562+  fd  Linux RAID autodetect
/dev/sdb3            1338        9730    67408556   fd  Linux RAID autodetect</pre>
<p><strong>Step 2: Create RAID arrays on the new drive</strong></p>
<p>Now we create RAID 1 arrays on each partition.  These arrays will have just one member each when we create them, which isn&#8217;t normal for RAID 1.  So we&#8217;ll have to force mdadm to let us:</p>
<p><code>apt-get install mdadm<br />
mdadm --create /dev/md0 --level=1 --force --raid-devices=1 /dev/sdb1<br />
mdadm --create /dev/md1 --level=1 --force --raid-devices=1 /dev/sdb2<br />
mdadm --create /dev/md2 --level=1 --force --raid-devices=1 /dev/sdb3</code></p>
<p><strong>Step 3: Copy the data from drive 1 to the new raid arrays on drive 2</strong></p>
<p>This is a job for rsync.  First, there are some directories on a running Linux system that we do not want to copy, like /dev and /proc.  We also want to ignore tempfs directories, like /var/run.  The best way to avoid these is to make an excludes file.  Create a file, /root/rsync-filter, with the following content:</p>
<p><code>- /dev/<br />
- /lib/modules/*/volatile/<br />
- /mnt/<br />
- /proc/<br />
- /sys/<br />
- /var/lock/<br />
- /var/run/</code></p>
<p>These lines define directories we will not copy over.  You may wish to add /tmp, apt&#8217;s cache, etc, but if you do you must manually create the directories themselves on the new filesystem.</p>
<p>Mount the new RAID array:</p>
<p><code>mount /dev/md0 /mnt<br />
mkdir /mnt/home<br />
mount /dev/md2 /mnt/home</code></p>
<p>If you are using a different mount structure, just be sure to recreate it and mount it in the right places in the new filesystem under /mnt/.</p>
<p>And start the rsync copy:</p>
<p><code>rsync -avx --delete -n --exclude-from /root/rsync-filter / /mnt/<br />
rsync -avx --delete -n /home/ /mnt/home/</code></p>
<p>You will see a list of files that will be changed, but nothing actually happens.  This is the job of the -n argument, which performs a dry-run.  Always do this before actually starting a copy.  You WILL make a painful mistake with rsync some day, so learn to be cautious.  Repeat the above commands without the -n when you are sure all is well.</p>
<p>The -x argument ensures that you will not cross filesystem boundaries, which is why you must copy /home separately, and any other mounted filesystems.  If you omit this you only need one command.  But make sure you have a good rsync filter file, and that you have nothing mounted like /media/cdrom that you don&#8217;t want an archive of.</p>
<p>Finally, create the directories that you skipped with your filter:</p>
<p><code>cd /mnt/<br />
mkdir -p dev/ mnt/ proc/ sys/ var/lock/ var/run/<br />
for i in /lib/modules/*/volatile ; do mkdir -p /mnt/$i ; done</code></p>
<p><strong>Step 4: Install grub on drive 2</strong></p>
<p>OK, we almost have a working RAID install on the second drive.  But it won&#8217;t boot yet.  Let&#8217;s use chroot to switch into it.</p>
<p><code>mount --rbind /dev /mnt/dev<br />
mount --rbind /proc /mnt/proc<br />
chroot /mnt</code></p>
<p>Now we have a working /dev and /proc inside the new RAID array, and by using chroot we are effectively in the root of the new array.  Be absolutely sure you are in the chroot, and not the real root of drive 1.  Here&#8217;s an easy trick: make sure nothing is in /sys:</p>
<p>ls /sys</p>
<p>If not, you&#8217;re in the new chroot.</p>
<p>Now we just need to edit grub&#8217;s device.map and menu.list files.  Edit /boot/grub/device.map and make sure both drives are listed:</p>
<pre>(hd0)   /dev/sda
(hd1)   /dev/sdb</pre>
<p>Now get the UUID of /dev/md0&#8217;s filesystem:</p>
<p><code>tune2fs -l /dev/md0 | grep UUID</code></p>
<pre>Filesystem UUID:          8f4fe480-c7ab-404e-ade8-2012333855a6</pre>
<p>Edit /boot/grub/menu.list and find the line like this:</p>
<pre># kopt=root=UUID=9e299378-de65-459e-b8b5-036637b7ba93 ro</pre>
<p>Replace the UUID with the one you just found.  Leave the line commented, and save the file.  Now rebuild menu.lst to use the new UUID:</p>
<p><code>update-grub</code></p>
<p>Double-check that each boot option at the bottom of menu.lst is using the right UUID.  If not, edit them too. Finally, install grub on the second drive.</p>
<p><code>grub-install /dev/sdb</code></p>
<p><strong>Step 5: Configure fstab and mdadm.conf, and rebuild initramfs images</strong></p>
<p>We&#8217;re almost ready to reboot.  But first, we need to build an initramfs that is capable of booting from a RAID array.  Otherwise your boot process will hang at mounting the root partition.  Still in the chroot, edit /etc/fstab and change the partition entries to the new filesystems or devices.</p>
<p>If your /etc/fstab has &#8220;UUID=&#8221; entries like the following, change them to the new entries:</p>
<pre>proc            /proc           proc    defaults        0       0
UUID=8f4fe480-c7ab-404e-ade8-2012333855a6 /               ext3    relatime,errors=remount-ro 0       1
UUID=c1255394-4c42-430a-b9cc-aaddfb024445 none            swap    sw              0       0
UUID=94f0d5db-c525-4f52-bdce-1f93652bc0b1 /var/           ext3    relatime 0       1
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0</pre>
<p>In the above example, the first UUID cooresponds to /dev/md0, the second to /dev/md1, and so on.  Find the UUIDs with:</p>
<p><code>/lib/udev/vol_id /dev/md0</code></p>
<p>If your /etc/fstab has &#8220;/dev/sda1&#8243; entries like it&#8217;s a bit easier.  Just change them to /dev/md0 and so on:</p>
<pre>proc            /proc           proc    defaults        0       0
/dev/md0        /               ext3    relatime,errors=remount-ro 0     1
/dev/md1        none            swap    sw              0       0
/dev/md2        /var/           ext3    relatime        0       1
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0</pre>
<p>Now, while still in the chroot, edit /etc/mdadm/mdadm.conf to list each RAID array:</p>
<pre>DEVICE partitions
ARRAY /dev/md0 UUID=126a552f:57b18c5b:65241b86:4f9faf62
ARRAY /dev/md1 UUID=ca493308:7b075f97:08347266:5b696c99
ARRAY /dev/md2 UUID=a983a59d:181b32c1:bcbb2b25:39e64cfd
MAILADDR root</pre>
<p>Find the UUID of each RAID array, which is not the same as the UUID of the filesystem on it (!), using mdadm:</p>
<p><code>mdadm --detail /dev/md0 | grep UUID</code></p>
<p>Now, rebuild your current kernel&#8217;s initramfs image:</p>
<p><code>update-initramfs -u</code></p>
<p>Or all of them:</p>
<p><code>update-initramfs -u -k all</code></p>
<p><strong>Step 6: Reboot on the RAID arrays on drive 2</strong></p>
<p>Now we&#8217;re ready to reboot.  First, exit the chroot and power off the machine cleanly.  You have three options:</p>
<ol>
<li>If your BIOS allows you to select which drive to boot from, elect to boot from drive 2.</li>
<li>Swap drives 1 and 2 so drive 2 becomes /dev/sda, and restart</li>
<li>Use a USB recovery stick to boot from drive 2</li>
</ol>
<p>When the system restarts, you should reboot on the new RAID drive.  Make sure:</p>
<p><code>df -h</code></p>
<pre>Filesystem            Size  Used Avail Use% Mounted on
/dev/md0              9.2G  1.9G  6.9G  21% /
varrun                498M   56K  498M   1% /var/run
varlock               498M     0  498M   0% /var/lock
udev                  498M   68K  498M   1% /dev
devshm                498M     0  498M   0% /dev/shm
lrm                   498M   39M  459M   8% /lib/modules/2.6.24-19-generic/volatile
/dev/md2               63G  130M   60G   1% /home</pre>
<p><strong>Step 7: Repartition drive 1 and add it to RAID</strong></p>
<p>Finally, we add the old drive into the array.  Assuming you chose option 2 and didn&#8217;t swap the drive&#8217;s cables:</p>
<p><code>sfdisk -d /dev/sdb | sfdisk --force /dev/sda</code></p>
<p>If you receive a warning message here, reboot now.</p>
<pre>Re-reading the partition table ...
BLKRRPART: Device or resource busy
The command to re-read the partition table failed
Reboot your system now, before using mkfs</pre>
<p>If not, continue on:</p>
<p><code>mdadm /dev/md0 --grow -n 2<br />
mdadm /dev/md1 --grow -n 2<br />
mdadm /dev/md0 --add /dev/sdb1<br />
mdadm /dev/md1 --add /dev/sdb2</code></p>
<p>If you chose option 1, just swap &#8220;/dev/sda&#8221; and &#8220;/dev/sdb&#8221; everywhere above.</p>
<p>The RAID array will now rebuild.  To check its progress:</p>
<p><code>cat /proc/mdstat</code></p>
<pre>Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdb1[1] sda1[0]
      497856 blocks [2/2] [UU]

md1 : active raid1 sdb2[2] sda2[0]
      3696192 blocks [2/1] [U_]
      [&gt;....................]  recovery =  0.4% (16320/3696192) finish=7.4min speed=8160K/sec

unused devices:</pre>
<p>Once the array is finished rebuilding, reinstall grub on the new drive.  We&#8217;ll do both, for good measure.</p>
<p><code>grub-install /dev/sda<br />
grub-install /dev/sdb</code></p>
<p>You should now be able to reboot without either drive, and your system will come up cleanly.  If you ever need to replace a failed drive, remove it, use step 7 above to clone the partition scheme to the new drive and add it to the array.</p>
<p><strong>Gotchas:</strong></p>
<p>If you are having issues with your RAID setup, especially if you have an older RAID setup or older release already, you might need these packages:</p>
<p><code>apt-get install lvm2 evms dmsetup</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/10/01/moving-your-linux-root-partition-to-raid/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Making the GUI faster in Ubuntu Linux</title>
		<link>http://www.tolaris.com/2008/09/28/making-the-gui-faster-in-ubuntu-linux/</link>
		<comments>http://www.tolaris.com/2008/09/28/making-the-gui-faster-in-ubuntu-linux/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 19:58:50 +0000</pubDate>
		<dc:creator>tyler</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.tolaris.com/blog/?p=8</guid>
		<description><![CDATA[I&#8217;ve been using some form of Unix since I was introduced to the Internet my first year at University in 1995.  I switched to Linux on the desktop full time in April 2005, and I&#8217;ve been managing my company&#8217;s mid-size network of servers and desktops for the past two years.
One thing I&#8217;ve noticed about [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using some form of Unix since I was introduced to the Internet my first year at University in 1995.  I switched to Linux on the desktop full time in April 2005, and I&#8217;ve been managing my company&#8217;s mid-size network of servers and desktops for the past two years.</p>
<p>One thing I&#8217;ve noticed about Linux, even desktop-focused distributions, is that it&#8217;s largely tuned to the most desirable behaviour for a server.  But what is desirable on a server isn&#8217;t necessarily desirable on a desktop.  On Ubuntu Linux (or any Debian-based distro), add the following two lines to /etc/sysctl.conf:</p>
<p><code>vm.swappiness=1<br />
vm.vfs_cache_pressure=50</code></p>
<p>These changes will be done automatically on reboot, but let&#8217;s load them now with:</p>
<p><code>sysctl -p</code></p>
<p>Now you&#8217;ll notice GUI applications feel more responsive and filesystem browsing will be faster when the disk is busy.  What we have done is instruct the kernel to prefer to keep applications in RAM (swappiness) instead of disk cache, and to prefer to keep filesystem inodes and directory entries cached at the cost of files themselves.  This means reading files from disk is slightly slower (IE, copying, moving, loading big files), but browsing the filesystem will be much faster.</p>
<p>Rudd-o.com <a href="http://rudd-o.com/archives/2007/10/02/tales-from-responsivenessland-why-linux-feels-slow-and-how-to-fix-that/">wrote extensively on this</a> last year.  I recommend his write-up for anyone who wants to understand the issues in more depth.</p>
<p>For the record, I ran the tests in Rudd-o&#8217;s article.  He advised creating a big file, then displaying the entire filesystem hierachy with find, and then copying that file.  In my case, I went from 2 minutes, 6 seconds for the &#8220;<code>find / > /dev/null</code>&#8221; to just 17 seconds.  That has made browsing in Konqueror a great deal faster.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tolaris.com/2008/09/28/making-the-gui-faster-in-ubuntu-linux/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
