<?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>MaddHat.comLinux | MaddHat.com</title>
	<atom:link href="http://maddhat.com/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://maddhat.com</link>
	<description></description>
	<lastBuildDate>Fri, 30 Sep 2011 17:39:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
<image>
  <link>http://maddhat.com</link>
  <url>http://maddhat.com/favicon.ico</url>
  <title>MaddHat.com</title>
</image>
		<item>
		<title>Remove X Cursor in XBMC</title>
		<link>http://maddhat.com/remove-x-cursor-in-xbmc</link>
		<comments>http://maddhat.com/remove-x-cursor-in-xbmc#comments</comments>
		<pubDate>Fri, 30 Sep 2011 17:39:00 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[AV]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[cursor]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[x11]]></category>
		<category><![CDATA[xbmc]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=363</guid>
		<description><![CDATA[I&#8217;ve found a few annoying issues while configuring my HTPC with XBMC &#8211; one being the X cursor re-appearing after long idle states.  The cursor will go away after restarting XBMC, but this is annoying to do several times a day.  The fix is quite simple &#8211; the steps are listed below. sudo nano /etc/X11/xorg.conf In the text editor &#8211; find the section of the file labeled Section &#8220;Device&#8221;.  The ending of this section is simply EndSection.  Add the following line before the EndSection statement: Option    "HWCursor" "false" Simply restart X either by restarting XBMC or the machine completely.  The cursor should now stay gone for good!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found a few annoying issues while configuring my HTPC with XBMC &#8211; one being the X cursor re-appearing after long idle states.  The cursor will go away after restarting XBMC, but this is annoying to do several times a day.  The fix is quite simple &#8211; the steps are listed below.</p>
<p><code>sudo nano /etc/X11/xorg.conf</code></p>
<p>In the text editor &#8211; find the section of the file labeled Section &#8220;Device&#8221;.  The ending of this section is simply EndSection.  Add the following line before the EndSection statement:</p>
<p><code>Option    "HWCursor" "false"</code></p>
<p>Simply restart X either by restarting XBMC or the machine completely.  The cursor should now stay gone for good!</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/remove-x-cursor-in-xbmc/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Squid3 Transparent Proxy Setup</title>
		<link>http://maddhat.com/squid3-transparent-proxy-setup</link>
		<comments>http://maddhat.com/squid3-transparent-proxy-setup#comments</comments>
		<pubDate>Fri, 15 Oct 2010 15:00:17 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Education]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[bridge-utils]]></category>
		<category><![CDATA[ebtables]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[squid3]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[web-cache]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=259</guid>
		<description><![CDATA[Introduction Being a networking geek, I often try to figure out every aspect I can about different network technologies being used, how to configure them, and what benefits they have to provide when implemented. My home network/lab is a great place to test these technologies in a non-crucial environment. One such networking aspect I haven’t researched much is proxies. Sure, I’ve run into it with application installation that needs a connection configured, and had setup a CGI proxy in the past on a windows machine after my frustrations with my high school’s network blocking my once favorite social new site digg.com, but overall I hadn’t had much knowledge about why else proxies were implemented on a network, so I decided to play with Squid3 to educate myself. Squid3 Squid3 works as a web-cache proxy which means that while you browse, the content you are retrieving can also be cached for faster retrieval on the machine running the proxy – based on a set of rules in the proxy’s configuration files. This is not to say that ALL content gets cached, due to the fact that most content you are retrieving is dynamic, and it wouldn’t make sense to cache it [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction</strong><br />
Being a networking geek, I often try to figure out every aspect I can about different network technologies being used, how to configure them, and what benefits they have to provide when implemented.  My home network/lab is a great place to test these technologies in a non-crucial environment.  One such networking aspect I haven’t researched much is proxies.  Sure, I’ve run into it with application installation that needs a connection configured, and had setup a CGI proxy in the past on a windows machine after my frustrations with my high school’s network blocking my once favorite social new site digg.com, but overall I hadn’t had much knowledge about why else proxies were implemented on a network, so I decided to play with Squid3 to educate myself.</p>
<p><strong>Squid3</strong><br />
Squid3 works as a web-cache proxy which means that while you browse, the content you are retrieving can also be cached for faster retrieval on the machine running the proxy – based on a set of rules in the proxy’s configuration files.  This is not to say that ALL content gets cached, due to the fact that most content you are retrieving is dynamic, and it wouldn’t make sense to cache it due to the fact that you would quickly be viewing outdated material.  In fact, in most environments only a small amount of content gets cached – which is why a web-cache proxy becomes more effective with more users working behind it.  With a one-user environment the speed increase given by the cached content may not even offset the costs of running the proxy.  With a multiple user environment there is most likely a significant amount of overlap in the viewed content and leads to the web-cache loading more of the local cached content versus retrieving new material each time.  Although the amount of users on such proxies are not limitless as, due to the nature of a web-cache proxy, it will have to perform many reads/writes to its drives to receive and deliver cached content – and without adequate hardware to handle these read/writes, the network will actually suffer in performance as it will be bottlenecked by the proxy’s speed.  If you have more questions about what exactly squid is and how it works checkout <a href="http://www.squid-cache.org/" target="_blank">Squid’s site</a>.</p>
<p>With all of this being said, the decision to implement a proxy on your network will need to be carefully examined by the needs and amount of throughput of the network.  Keep in mind that Squid can be majorly tweaked to fit the needs of the network – so looking at the configuration options available is not something to be ignored.<br />
Okay, enough with the explanations, on to the fun part – installation and configuration!</p>
<p><strong>Target Setup:</strong><br />
There are many ways to setup Squid.  The most simple is re-directing all traffic to a Squid box on the local network through your software.  This requires simply adding the Squid box to the network and directing the web applications on the clients as needed.  But those of us administering larger networks know that redirecting client browsers is a pain, and look toward a more automated solution.  This was the reason I chose to setup this Squid box as transparent.  It is transparent in the sense that no changes will be needed on the client-side for any network settings or re-direction in order for the proxy to be implemented.  The diagram below illustrates this setup:</p>
<p style="text-align: center;"><a href="http://maddhat.com/wp-content/uploads/2010/07/proxy-diagram.png"><img class="aligncenter size-full wp-image-260" title="proxy-diagram" src="http://maddhat.com/wp-content/uploads/2010/07/proxy-diagram.png" alt="" width="625" height="189" /></a><span style="font-size: xx-small;">Diagram created using <a href="Gliffy.com" target="_blank">Gliffy</a></span></p>
<p>For clients, they have the following settings:</p>
<p>IP Address: DHCP (in the 192.168.2.0 subnet)<br />
Gateway: 192.168.2.1<br />
DNS: whatever you want, doesn’t affect this setup as long as they are working DNS servers.</p>
<p>The running Squid3 box will simply pass all traffic on eth0 to eth1 and vis versa, but will intercept all traffic on port 80 and re-direct it to the port that Squid is running on.  From here, Squid will work its magic in either delivering the cached content to the client or retrieving it and then caching as needed.  The client will have no idea where the content is being delivered from, and should ideally only notice it is being received quickly.</p>
<p><strong>Installation:</strong><br />
I completed the following steps on a machine running Ubuntu 10.04 with 2 NICs installed (eth0, eth1).  We will assume eth0 will be the incoming line from the gateway, and eth1 is the outgoing line to switch which the clients access (demonstrated in diagram).</p>
<pre>sudo apt-get install squid3</pre>
<p>That was simple enough&#8230;  Most of the work is completed in the configuration.</p>
<p><strong>Configuration:</strong><br />
We need to first add a few lines to the squid configuration file to make the proxy transparent.</p>
<pre>sudo nano /etc/squid3/squid.conf</pre>
<p>Add the lines below to the configuration:</p>
<pre>http_port 3128 transparent
acl localnet src 192.168.2.0/24
acl localhost src 127.0.0.1/255.255.255.255
http_access allow localnet
http_access allow localhost</pre>
<p>This next line is optional – it changes the default size for Squid’s cache to 5000MB to be stored in /var/spool/squid3.</p>
<pre>cache_dir ufs /var/spool/squid3 5000 16 256</pre>
<p>After making the changes above, save the configuration file and restart squid3.  If there are errors Squid should fail to start.</p>
<pre>sudo /etc/init.d/squid3 restart</pre>
<p>I found ebtables easier to configure the bridge to pass traffic accordingly than iptables.  You can use whichever you’d like.<br />
Install ebtables and enter the lines below to pass traffic through accordingly.  The port at which Squid is set to run by default is 3128, but if you have changed this in the squid configuration make sure and make the change in the rule accordingly.</p>
<pre>sudo apt-get install ebtables
sudo ebtables -t broute -A BROUTING -p IPv4 --ip-protocol 6 --ip-destination-port 80 -j redirect --redirect-target ACCEPT
sudo iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j REDIRECT --to-port 3128</pre>
<p>Also, enable traffic to be passed through both IPv4 and IPv6 on the local machine by uncommenting the following lines in /etc/sysctl.conf</p>
<pre>sudo nano /etc/sysctl.conf
(uncomment the following)
net.ipv4.ip_forward=1
net.ipv6.conf.all.forwarding=1</pre>
<p>You will need to install the bridge-utils to configure the bridge within your /etc/network/interfaces file.</p>
<pre>sudo apt-get install bridge-utils</pre>
<p>After configured my /etc/network/interfaces filled looked like this:</p>
<pre>auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
address 192.168.2.199
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1

auto br0
iface br0 inet static
address 192.168.2.200
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
bridge-ports eth0 eth1</pre>
<p>Save this file and either reboot the system or restart networking and squid3.</p>
<pre>sudo /etc/init.d/networking restart
sudo /etc/init.d/squid3 restart</pre>
<p>After this go to one of your client machines and browse the web for a few seconds.  You can then tell if squid3 is working correctly by checking the logs:</p>
<pre>tail /var/log/squid3/access.log</pre>
<p>This should show you the requests as they are received by squid3.  Make sure and check traffic on other ports as well to ensure that it is being passed through correctly.<br />
If traffic is not being passed correctly or squid is not logging any requests a good step to take would be to set the client machine’s browser proxy settings to direct right to the proxy.  See if browsing is now working correctly.  If so, squid3 is working correctly but there is most likely an issue with the traffic passing rules on the machine the proxy is running on.</p>
<p><strong>Conclusion:</strong></p>
<p>These were all the steps I completed to get my transparent proxy running successfully.  Obviously you can tweak to fit your needs.  The other added benefit of running the proxy in the “transparent” mode is that if the box fails you can simply disconnect the cable from the gateway to the proxy and plug directly into the client switch and the network will continue to function (obviously without local caching enabled).</p>
<p>Hopefully this helps others out there attempting to complete a similar setup.  If you notice any errors with this tutorial please let me know.  Thanks for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/squid3-transparent-proxy-setup/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Login Without Password:</title>
		<link>http://maddhat.com/ssh-login-without-password</link>
		<comments>http://maddhat.com/ssh-login-without-password#comments</comments>
		<pubDate>Wed, 15 Sep 2010 15:00:55 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[rsa]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=208</guid>
		<description><![CDATA[I’m working on an automated rsync script that requires remote access to another machine on the local network.  The easy and secure way to accomplish this is to connect using SSH.  The problem I found while testing the script is that it will not run because it’s prompted by the remote machine for a password each time.  Okay I’ll just use key-only login which doesn’t require passwords, easy enough, right?  Well.. though the commands were simple enough to configure SSH login this way I couldn’t ever get it working properly.  I gave it one last try using ssh-keygen and actually got it working!  I thought I’d share the process I followed for success in case anyone else is experiencing the same headache: I’m using 2 machines.  “localpc” is the machine which will run the script so I want passwordless login to the other host.  “remotepc” is the machine I wish to login to. Clear your .ssh/ directory on both localpc and remotepc for the user you wish to login as.  This helps to start from scratch with no possible issues in the key files. sudo rm –R /home/user/.ssh/* Login to localpc from remotepc through SSH normally: ssh user@localpc and do [...]]]></description>
			<content:encoded><![CDATA[<p>I’m working on an automated rsync script that requires remote access to another machine on the local network.  The easy and secure way to accomplish this is to connect using SSH.  The problem I found while testing the script is that it will not run because it’s prompted by the remote machine for a password each time.  Okay I’ll just use key-only login which doesn’t require passwords, easy enough, right?  Well.. though the commands were simple enough to configure SSH login this way I couldn’t ever get it working properly.  I gave it one last try using ssh-keygen and actually got it working!  I thought I’d share the process I followed for success in case anyone else is experiencing the same headache:<br />
<P><br />
I’m using 2 machines.  “localpc” is the machine which will run the script so I want passwordless login to the other host.  “remotepc” is the machine I wish to login to.<br />
<P><br />
Clear      your .ssh/ directory on both localpc and remotepc for the user you wish to      login as.  This helps to start from      scratch with no possible issues in the key files.</p>
<pre>sudo rm –R /home/user/.ssh/*</pre>
<p>Login to localpc from remotepc through SSH normally:</p>
<pre>ssh user@localpc</pre>
<p>and do the same from the other machine:</p>
<pre>ssh user@remotepc</pre>
<p>I’m not completely sure why but this helps alleviate a “no identities error” that can happen later on.<br />
<P><br />
<strong>On localpc:</strong></p>
<p>Create an RSA key:</p>
<pre>ssh-keygen –t rsa</pre>
<p>Chose the default Save location (Just press Enter)</p>
<p>Chose no passphrase (Press Enter again)<br />
<P><br />
<strong>On      localpc:</strong></p>
<pre>ssh-copy-id -i /home/user/.ssh/id_rsa.pub user@remotepc</pre>
<p>Make sure and change the user and remotepc to the names that represent your setup.<br />
<P><br />
You’re      Done!  Test it out.  <strong> </strong></p>
<p><strong>On localpc:</strong></p>
<pre>ssh user@remotepc</pre>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/ssh-login-without-password/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>apt-get upgrade Confusion</title>
		<link>http://maddhat.com/apt-get-upgrade-confusion</link>
		<comments>http://maddhat.com/apt-get-upgrade-confusion#comments</comments>
		<pubDate>Wed, 01 Sep 2010 15:00:26 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[apt-get]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=197</guid>
		<description><![CDATA[While performing some regular maintenance on one of my Ubuntu machines I was getting a bit confused between all of the upgrade commands, so I investigated further.  I&#8217;ve listed below the basic differences between each: sudo apt-get upgrade install newest versions of packages on machine sudo apt-get dist-upgrade upgrades all packages on system, handle dependency changes (remove obsolete packages).  This command prepares the system for upgrade but since /etc/sources.list is not changed to the sources for the newer distribution it will not actually upgrade to the newest version. To actually perform a distribution upgrade the following command should be used (ensure you have a backup before issuing this command.  The upgrade could make your system unstable): First, check which version you are currently running using the following: lsb_release -a Next, you can download the newest update manager and issue the upgrade command: sudo apt-get install update-manager-core sudo do-release-upgrade All of these commands should be used with caution as you are directly affecting your software packages installed on the system. This site was very helpful in my initial investigation of the differences of this command.]]></description>
			<content:encoded><![CDATA[<p>While performing some regular maintenance on one of my Ubuntu machines I was getting a bit confused between all of the upgrade commands, so I investigated further.  I&#8217;ve listed below the basic differences between each:</p>
<pre>sudo apt-get upgrade</pre>
<p>install newest versions of packages on machine</p>
<pre>sudo apt-get dist-upgrade</pre>
<p>upgrades all packages on system, handle dependency changes (remove obsolete packages).  This command prepares the system for upgrade but since /etc/sources.list is not changed to the sources for the newer distribution it will not actually upgrade to the newest version.</p>
<p>To actually perform a distribution upgrade the following command should be used (ensure you have a backup before issuing this command.  The upgrade could make your system unstable):</p>
<p>First, check which version you are currently running using the following:</p>
<pre>lsb_release -a</pre>
<p>Next, you can download the newest update manager and issue the upgrade command:</p>
<pre>sudo apt-get install update-manager-core
sudo do-release-upgrade</pre>
<p>All of these commands should be used with caution as you are directly affecting your software packages installed on the system.</p>
<p><a href="http://www.ghacks.net/2010/03/11/what-is-it-with-the-dist-upgrade-option-of-apt-get/" target="_blank">This site</a> was very helpful in my initial investigation of the differences of this command.</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/apt-get-upgrade-confusion/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BIND Tip &#8211; Dumping The Cache</title>
		<link>http://maddhat.com/bind-tip-dumping-the-cache</link>
		<comments>http://maddhat.com/bind-tip-dumping-the-cache#comments</comments>
		<pubDate>Sun, 01 Aug 2010 15:00:40 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[bind9]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[rndc]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=110</guid>
		<description><![CDATA[Thought it would be useful to document a useful command while learning how to operate BIND.  I set BIND9 up on my print server and was trying to examine how much resources it was consuming.  I found the following command helpful – it dumps the current BIND9 database from memory to /var/cache/bind (by default): sudo rndc dumpdb –all After that I simply navigated to /var/cache/bind and issued the command ls –lah and was shown that it consumes 649K in memory from the output of the command above: -rw-r--r--  1 bind bind 649K 2010-05-02 08:15 named_dump.db I’m not a BIND expert and am actually stumbling around with some custom zone settings but I thought this was worth mentioning.  I&#8217;m also assuming this is quite small for a db size since this was only setup for testing for a 1 user network.  Nevertheless, it would be useful to check that you have adequate memory to handle the database size if you are deploying a DNS server for your network. I believe you can also limit the cache size if needed, but I don&#8217;t think I&#8217;ll be needing that option added to my config anytime soon. If you haven’t already, read up on [...]]]></description>
			<content:encoded><![CDATA[<p>Thought it would be useful to document a useful command while learning how to operate BIND.  I set BIND9 up on my print server and was trying to examine how much resources it was consuming.  I found the following command helpful – it dumps the current BIND9 database from memory to /var/cache/bind (by default):</p>
<pre>sudo rndc dumpdb –all</pre>
<p>After that I simply navigated to /var/cache/bind and issued the command</p>
<pre>ls –lah</pre>
<p>and was shown that it consumes 649K in memory from the output of the command above:</p>
<pre>-rw-r--r--  1 bind bind 649K 2010-05-02 08:15 named_dump.db</pre>
<p>I’m not a BIND expert and am actually stumbling around with some custom zone settings but I thought this was worth mentioning.  I&#8217;m also assuming this is quite small for a db size since this was only setup for testing for a 1 user network.  Nevertheless, it would be useful to check that you have adequate memory to handle the database size if you are deploying a DNS server for your network. I believe you can also limit the cache size if needed, but I don&#8217;t think I&#8217;ll be needing that option added to my config anytime soon.</p>
<p>If you haven’t already, read up on the rndc command – because it’s quite powerful.  In addition, make sure you are using the latest stable version of BIND to (as well as other benefits) protect against <a href="http://www.howtoforge.com/how-to-patch-bind-to-avoid-cache-poisoning-debian-etch" target="_blank">cache poisoning</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/bind-tip-dumping-the-cache/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boot To USB Without BIOS USB Boot Support</title>
		<link>http://maddhat.com/boot-to-usb-without-bios-usb-boot-support</link>
		<comments>http://maddhat.com/boot-to-usb-without-bios-usb-boot-support#comments</comments>
		<pubDate>Thu, 01 Jul 2010 15:00:22 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[boot]]></category>
		<category><![CDATA[plop]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unzip]]></category>
		<category><![CDATA[usb]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=169</guid>
		<description><![CDATA[On any new machine I purchase I ensure to thoroughly run all hardware with the various diagnostic applications available on the Ultimate Boot CD.  I have the UBCD setup on a USB drive which allows me to ditch the CD wallet.  Problem is, even in this day and age, there are still machines I encounter that are not compatible with USB boot.  Most of the time I’ll burn an ISO to CD and hook up a spare CD-ROM drive, but recently I was determined to get the computer to boot to USB.  No BIOS update was available and I searched every inch of the BIOS menus looking for a USB boot option with no success.  So, after some browsing around I found PLoP.  PLoP is a Boot Manager that will (among other things) allow a machine to boot to USB even without BIOS support.  It’s actually quite an easy solution but does require you to make either a floppy or CD.  Since the machines I was working with were previously used in a cluster they had no CD-ROM drives but they did contain a floppy drive.  To create a PLoP boot disk using another Ubuntu machine I completed the following: [...]]]></description>
			<content:encoded><![CDATA[<p>On any new machine I purchase I ensure to thoroughly run all hardware with the various diagnostic applications available on the Ultimate Boot CD.  I have the UBCD setup on a USB drive which allows me to ditch the CD wallet.  Problem is, even in this day and age, there are still machines I encounter that are not compatible with USB boot.  Most of the time I’ll burn an ISO to CD and hook up a spare CD-ROM drive, but recently I was determined to get the computer to boot to USB.  No BIOS update was available and I searched every inch of the BIOS menus looking for a USB boot option with no success.  So, after some browsing around I found PLoP.  PLoP is a Boot Manager that will (among other things) allow a machine to boot to USB even without BIOS support.  It’s actually quite an easy solution but does require you to make either a floppy or CD.  Since the machines I was working with were previously used in a cluster they had no CD-ROM drives but they did contain a floppy drive.  To create a PLoP boot disk using another Ubuntu machine I completed the following:</p>
<pre>wget <a href="http://download.plop.at/files/bootmngr/plpbt-5.0.10.zip">http://download.plop.at/files/bootmngr/plpbt-5.0.10.zip</a>

sudo apt-get install unzip

unzip plpbt-5.0.1.0.zip

cd phpbt-5.0.10/</pre>
<p>Insert the floppy to write to into the drive.  I’m assuming it’s located at /dev/fd0.</p>
<pre>fdformat /dev/fd0

dd if=plpbt.img of=/dev/fd0 bs=1440k</pre>
<p>Once you complete this you have created the bootable floppy and can now boot the machine to the floppy which contains the boot manager.  You will need to ensure that the installed floppy drive is listed on the boot list.  Note that the ISO is also included in the downloaded package if you would rather create a CD.</p>
<p>After you boot into PLoP there is a list of available boot options.  USB should be an option in the list and you simply select that as the boot option, press Enter, and your USB bootable drive can now be accessed!  Note:  Once booted to USB I could *only* use PS/2 keyboard and mouse with the machine.</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/boot-to-usb-without-bios-usb-boot-support/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Differential Backup Using Rsync</title>
		<link>http://maddhat.com/differential-backup-using-rsync</link>
		<comments>http://maddhat.com/differential-backup-using-rsync#comments</comments>
		<pubDate>Tue, 01 Jun 2010 15:00:13 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=116</guid>
		<description><![CDATA[Rsync is a well known tool for many who work in Linux regularly.  Quite some time ago I put together a short script that uses Rsync and logs the result nicely. The first task Rsync performs is to send an incremental file list which contains any differences between the source and destination drive, then makes changes to the destination drive accordingly.    Because of that last part extreme caution should be used when executing such a script because you run the risk of overwriting information on the destination drive you may not want removed.  I have a dedicated drive for DV backups mounted in /media/dv-backup.  To use this script just change the variables accordingly: #!/bin/bash #dv backup script src=/media/dv dest=/media/dv-backup log=/var/log/backup/dv-backup.log echo "---" $date "-------------------" &#62;&#62; $log rsync -t -r -v --delete $src $dest &#62;&#62; $log echo "--------------- END ---------------" &#62;&#62; $log I have my backups log in /var/log/backup/ and they merely append the file each time Rsync runs.  I’m aware this is quite a simple script and could even be consolidated to one line.  However, I found that breaking this up makes it easy to read and change.  Also, who wants to remember every Rsync switch they want each time [...]]]></description>
			<content:encoded><![CDATA[<p>Rsync is a well known tool for many who work in Linux regularly.  Quite some time ago I put together a short script that uses Rsync and logs the result nicely. The first task Rsync performs is to send an incremental file list which contains any differences between the source and destination drive, then makes changes to the destination drive accordingly.    Because of that last part extreme caution should be used when executing such a script because you run the risk of overwriting information on the destination drive you may not want removed.  I have a dedicated drive for DV backups mounted in /media/dv-backup.  To use this script just change the variables accordingly:</p>
<pre>#!/bin/bash

#dv backup script

src=/media/dv 

dest=/media/dv-backup

log=/var/log/backup/dv-backup.log

echo "---" $date "-------------------" &gt;&gt; $log

rsync -t -r -v --delete $src $dest &gt;&gt; $log

echo "--------------- END ---------------" &gt;&gt; $log</pre>
<p>I have my backups log in /var/log/backup/ and they merely append the file each time Rsync runs.  I’m aware this is quite a simple script and could even be consolidated to one line.  However, I found that breaking this up makes it easy to read and change.  Also, who wants to remember every Rsync switch they want each time they want to perform a differential backup?</p>
<p>One quick change you could make to make it require less manually editing is replace the variables to take the terminal arguments.  Such a revision is listed below:</p>
<pre>src=$1

dest=$2

log=$3

echo "---" $date "-------------------" &gt;&gt; $log

rsync -t -r -v --delete $src $dest &gt;&gt; $log

echo "--------------- END ---------------" &gt;&gt; $log</pre>
<p>Usage to achieve same result as original:</p>
<pre>./backup.sh /media/dv /media/dv-backup /var/log/backup/dv-backup.log</pre>
<p>Both script revisions are attached:  <a href="http://maddhat.com/wp-content/uploads/2010/05/backup.sh" target="_blank">backup.sh</a> <a href="http://maddhat.com/wp-content/uploads/2010/05/backup2.sh" target="_blank">backup2.sh</a> Use at your own risk.. don&#8217;t blame me if you incorrectly wipe a drive!</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/differential-backup-using-rsync/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup Link Aggregation in Ubuntu</title>
		<link>http://maddhat.com/setup-link-aggregation-in-ubuntu</link>
		<comments>http://maddhat.com/setup-link-aggregation-in-ubuntu#comments</comments>
		<pubDate>Sat, 15 May 2010 15:00:57 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[802.3ad]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[bond]]></category>
		<category><![CDATA[ifenslave]]></category>
		<category><![CDATA[iperf]]></category>
		<category><![CDATA[link aggregation]]></category>
		<category><![CDATA[nic]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=182</guid>
		<description><![CDATA[Link aggregation is something that has greatly interested me the last few months and I&#8217;ve been anxious to play with it on my own network setup.  For those not familiar with link aggregation there is a lot of good documentation on Wikipedia to get caught up to speed.  In my lab I wanted to setup link aggregation on a box with a NC3134 which is a dual NIC (2x 10/100 full duplex ports).  I couldn’t do proper 802.3ad because I don’t have a switch which supports it…yet.  However, since I am running Ubuntu server I found I could still set it up using a different mode.  The mode I decided to configure the bond as is mode 0 otherwise known as the round-robin bond mode.  This type is described as &#8220;Round-robin policy: Transmit packets in sequential order from the first available slave through the last.  This mode provides load balancing and fault tolerance.&#8221; (Linux Horizon) The setup for bonding the NICs is actually quite simple. sudo apt-get install ifenslave sudo nano /etc/network/interfaces Comment out your current configuration lines using the “#” before all lines.  The following was my setup for the bond address configuration: auto bond0 iface bond0 inet static [...]]]></description>
			<content:encoded><![CDATA[<p>Link aggregation is something that has greatly interested me the last few months and I&#8217;ve been anxious to play with it on my own network setup.  For those not familiar with link aggregation there is a lot of good documentation on <a href="http://en.wikipedia.org/wiki/Link_aggregation" target="_blank">Wikipedia</a> to get caught up to speed.  In my lab I wanted to setup link aggregation on a box with a NC3134 which is a dual NIC (2x 10/100 full duplex ports).  I couldn’t do proper 802.3ad because I don’t have a switch which supports it…yet.  However, since I am running Ubuntu server I found I could still set it up using a different mode.  The mode I decided to configure the bond as is mode 0 otherwise known as the round-robin bond mode.  This type is described as &#8220;Round-robin policy:  Transmit packets in sequential order from the first available  slave through the last.  This mode provides load balancing and  fault tolerance.&#8221; (<a href="http://www.linuxhorizon.ro/bonding.html" target="_blank">Linux Horizon</a>)</p>
<p>The setup for bonding the NICs is actually quite simple.</p>
<pre>sudo apt-get install ifenslave
sudo nano /etc/network/interfaces</pre>
<p>Comment out your current configuration lines using the “#” before all lines.  The following was my setup for the bond address configuration:</p>
<pre>auto bond0
iface bond0 inet static
     address 192.168.2.200
     netmask 255.255.255.0
     broadcast 192.168.2.255
     gateway 192.168.2.1
slaves all
bond-mode 0
bond-miimon 100</pre>
<p>This configuration will use all of my network devices in the bond (which in this case is just 2) and give the IP address 192.168.2.200.  Note that I specified bond-mode 0.  There are several other bond types (some of which require a 802.3ad capable switch) and it would be worth your while to read up on them to find which would be best for you.</p>
<p>Another thing to note in this configuration is that I used bond-miimon 100.  This means that the links will be checked for failures every 100 milliseconds.  Setting this value to 0 disables checking for link failure.</p>
<p>Save and exit the configuration file.  From here you can take the interfaces down by issuing:</p>
<pre>sudo ifdown eth0
sudo ifdown eth1</pre>
<p>At this point I connected the 2<sup>nd</sup> Ethernet cable and restarted the networking services</p>
<pre>/etc/init.d/networking restart</pre>
<p>Simply type ifconfig and you should see bond0 in the list and listed as UP BROADCAST RUNNING MASTER MULTICAST and all others as UP BROADCAST RUNNING SLAVE MULTICAST.  Next we will test performance of the connection to ensure that the bond is functioning as it should.</p>
<p>Using iperf I can test the bandwidth utilized between the server and client in memory (which takes the drive write bottleneck out of the equation).  To setup iperf see my previous article on <a href="http://maddhat.com/testing-network-performance-using-iperf-3" target="_blank">using iperf</a>.</p>
<p>I have 192.168.2.101 setup as the server and 192.168.2.200 (the bonded NICs) as the client.  I issue the following command to test my connection:</p>
<pre>Iperf –c 192.168.2.101 –i 2</pre>
<p>The output was as follows:</p>
<pre>------------------------------------------------------------
Client connecting to 192.168.2.101, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.200 port 33878 connected with 192.168.2.101 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 2.0 sec  44.8 MBytes    188 Mbits/sec
[  3]  2.0- 4.0 sec  44.9 MBytes    188 Mbits/sec
[  3]  4.0- 6.0 sec  44.9 MBytes    188 Mbits/sec
[  3]  6.0- 8.0 sec  43.9 MBytes    184 Mbits/sec
[  3]  8.0-10.0 sec  44.8 MBytes    188 Mbits/sec
[  3]  0.0-10.0 sec    223 MBytes    187 Mbits/sec</pre>
<p>You can see that now the connection is reaching ~188Mbits out of the theoretical 200Mbits that the bond provides (remember we are using 2x 100mbit lines).  This is exactly the result we want.</p>
<p>Next, I wanted to test the fault of one line.  I disconnected one one of the cables from the dual NIC and ran the iperf connection test again.</p>
<pre>------------------------------------------------------------
Client connecting to 192.168.2.101, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[  3] local 192.168.2.200 port 33879 connected with 192.168.2.101 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0- 2.0 sec  22.5 MBytes  94.4 Mbits/sec
[  3]  2.0- 4.0 sec  22.4 MBytes  94.1 Mbits/sec
[  3]  4.0- 6.0 sec  22.4 MBytes  94.0 Mbits/sec
[  3]  6.0- 8.0 sec  22.5 MBytes  94.2 Mbits/sec
[  3]  8.0-10.0 sec  22.4 MBytes  94.0 Mbits/sec
[  3]  0.0-10.0 sec    112 MBytes  94.2 Mbits/sec</pre>
<p>You can see that the bandwidth has fallen back down to 94Mbits but the line still worked correctly without any traffic loss.</p>
<p>That’s it!  Pretty simple to setup and test the bond.   If you are creating a bond purely for the bandwidth increase keep in mind that system bottlenecks can still hinder performance &#8211; your hard drive write speed being the most likely.</p>
<p>With such a simple setup for this networking task it shows another benefit Linux servers can provide in comparison to Windows servers which (to my knowledge) do not natively support link aggregation.</p>
<p>The question I asked myself after this setup was: How does the 802.3ad configuration (mode 4) differ from mode 0 which doesn’t require switches with 802.ad support?  After some further research I found that while mode 0 uses sequential transmission, it can often receive packets out of order which creates the need for segment retransmission (as mentioned <a href="http://wiki.mikrotik.com/wiki/Manual:Interface/Bonding" target="_blank">here</a>).  It seems that mode 4 is able to receive all packets in order which produces an overall increase in efficiency.  I would be curious to see some performance benchmarks between the two and plan to do so once I have a managed switch – so stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/setup-link-aggregation-in-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing Network Performance Using Iperf</title>
		<link>http://maddhat.com/testing-network-performance-using-iperf-3</link>
		<comments>http://maddhat.com/testing-network-performance-using-iperf-3#comments</comments>
		<pubDate>Wed, 11 Mar 2009 01:09:46 +0000</pubDate>
		<dc:creator>MadHatter</dc:creator>
				<category><![CDATA[Bash]]></category>
		<category><![CDATA[Education]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[iperf]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://maddhat.com/?p=34</guid>
		<description><![CDATA[Just a quick post on a great tool for testing network performance. Iperf is a very slim tool that will measure TCP/UDP bandwidth performance. It is an available ubuntu package “iperf ” and also has Windows/OSX binaries available. I found a working mirror here. What makes Iperf a good test versus a simple SMB/CIFS transfer for bandwidth performance is that it works in memory versus being limited by hard drive and CPU limitations. Now a quick guide to get things up and running. The guide will be for two Ubuntu machines, testing network performance between the two. 1.Install – Type the following in terminal “sudo apt-get install iperf ” for both machines 2.Server Setup &#8211; Decide upon a server machine and a client. On the server type the following in terminal “iperf -s ”. This will place iperf in server mode, and it will listen for incoming connections. 3.Client Setup - On the client machine you have a lot of options to play around with regarding how you want to connect to the server. You can explore what each of these are by typing “iperf –-help ”. The following is a simple test between the server (192.168.2.104), and the client [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick post on a great tool for testing network performance.  Iperf is a very slim tool that will measure TCP/UDP bandwidth performance.  It is an available ubuntu package “<strong>iperf</strong> ” and also has Windows/OSX binaries available.  I found a working mirror <a title="iperf" href="http://noc.pregi.net/iperf.html" target="_blank">here</a>.  What makes Iperf a good test versus a simple SMB/CIFS transfer for bandwidth performance is that it works in memory versus being limited by hard drive and CPU limitations.</p>
<p>Now a quick guide to get things up and running.  The guide will be for two Ubuntu machines, testing network performance between the two.</p>
<p><strong>1.Install</strong> – Type the following in terminal “<strong>sudo apt-get install iperf</strong> ” for both machines</p>
<p><strong>2.Server Setup</strong> &#8211; Decide upon a server machine and a client.  On the server type the following in terminal “<strong>iperf -s</strong> ”.  This will place iperf in server mode, and it will listen for incoming connections.</p>
<p align="center"><img src="http://maddhat.com/wp-content/uploads/2009/03/iperf_server2.png" alt="iperf server" width="481" height="144" /></p>
<p><strong>3.Client Setup -</strong> On the client machine you have a lot of options to play around with regarding how you want to connect to the server.  You can explore what each of these are by typing “<strong>iperf –-help</strong> ”.  The following is a simple test between the server (192.168.2.104), and the client (192.168.2.103).</p>
<p><strong>4.Testing -</strong> Type “<strong>iperf 192.168.2.104 -i 2</strong>” (replacing the IP here with the test server IP and then enter key to start testing.  This will connect to the server running on 192.168.2.104 and have an interval of 2 seconds.  There will then be 6 tests completed.  This should give you all of the information you need regarding your connection speed between the two machines.</p>
<p align="center"><img src="http://maddhat.com/wp-content/uploads/2009/03/iperf_client2.png" alt="iperf client" width="481" height="209" /></p>
<p>This should be enough to get you started using iperf.  Check out the man page <a title="iperf man page" href="http://staff.science.uva.nl/~jblom/gigaport/tools/man/iperf.html" target="_blank">here</a> if you have any usage questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://maddhat.com/testing-network-performance-using-iperf-3/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

