<?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>MickVaites.com &#187; Ubuntu</title>
	<atom:link href="http://mickvaites.com/category/ubuntu/feed/" rel="self" type="application/rss+xml" />
	<link>http://mickvaites.com</link>
	<description>Adventures of a techie ...</description>
	<lastBuildDate>Mon, 03 Aug 2009 16:33:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ubuntu Changing Network Device ID udev/rules.d</title>
		<link>http://mickvaites.com/2009/06/ubuntu-changing-network-device-id-udevrules-d/</link>
		<comments>http://mickvaites.com/2009/06/ubuntu-changing-network-device-id-udevrules-d/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 08:25:46 +0000</pubDate>
		<dc:creator>mick</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://mickvaites.com/?p=953</guid>
		<description><![CDATA[I do quite a bit of work with Virtual machines based on an ESX platform. One of the advantages of such a platform is the ability to create a template server, then duplicate copies as and when you need one. With most operating systems it&#8217;s just a question of changing the IP and hostname and [...]]]></description>
			<content:encoded><![CDATA[<p>I do quite a bit of work with Virtual machines based on an ESX platform. One of the advantages of such a platform is the ability to create a template server, then duplicate copies as and when you need one. With most operating systems it&#8217;s just a question of changing the IP and hostname and you are in business.</p>
<p>In the case of Ubuntu Linux a udev rule is created for each network interface and which is bound to the MAC address of the card. Which makes loads of sense in the &#8220;Real World&#8221; but when you create a new VM an additional MAC address is generated. This can be a little frustrating as the first machine would have an eth0 the second an eth1 the third and eth2 and so on.</p>
<p>The database which stores these values is located in a file :</p>
<pre>/etc/udev/rules.d/70-persistent-net.rules</pre>
<p>An example of one of mine &#8211; on a third install.</p>
<pre># This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
#
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c9:f4:13", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
#
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:c9:f3:19", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
#
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:fd:fa", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"</pre>
<p>In this case whilst I would prefer the device to be known as eth0 it is in fact known as eth2.</p>
<pre># This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
#
# PCI device 0x8086:0x100f (e1000)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:38:fd:fa", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"</pre>
<p>If the file is amended to the following and a reboot done all is sorted.<br />
Don&#8217;t forget to amend the network configuration to reflect the change of device ID. In the case of UBUNTU this would be /etc/network/interfaces.</p>
]]></content:encoded>
			<wfw:commentRss>http://mickvaites.com/2009/06/ubuntu-changing-network-device-id-udevrules-d/feed/</wfw:commentRss>
		<slash:comments>112</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 installation on ESX</title>
		<link>http://mickvaites.com/2009/06/ubuntu-9-04-installation-on-esx/</link>
		<comments>http://mickvaites.com/2009/06/ubuntu-9-04-installation-on-esx/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 07:43:04 +0000</pubDate>
		<dc:creator>mick</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://mickvaites.com/?p=948</guid>
		<description><![CDATA[Firstly grab a copy of the 64bit Ubuntu server ISO from the ubuntu website and store is somewhere you can get to from your ESX box. Over the years I have taken the approach of storing server VMDK&#8217;s on ESX&#8217;s local hard disk pushing installation media onto a NAS.
(Note: Earlier this year we went gigabit [...]]]></description>
			<content:encoded><![CDATA[<p>Firstly grab a copy of the 64bit Ubuntu server ISO from the <a href="http://www.ubuntu.com" target="_blank">ubuntu website</a> and store is somewhere you can get to from your ESX box. Over the years I have taken the approach of storing server VMDK&#8217;s on ESX&#8217;s local hard disk pushing installation media onto a NAS.</p>
<p>(Note: Earlier this year we went gigabit ethernet on the NAS LAN so plans are there to potentially store VM&#8217;s a NAS too).</p>
<p>Install the virtual machine as you would do normally. I selected 64bit Ubuntu &#8211; I&#8217;m finding that telling ESX the O/S is a 64bit version regardless of whether you actually install the 64bit version or not seems to make the virtual machine more stable.</p>
<p>Edit the VM and set the boot media to be the Ubuntu ISO you downloaded ealier and mark it as connected and connected on boot.</p>
<p>Run the installation as you would do on normal hardware.</p>
<p>Now it&#8217;s time to install VMWare tools.</p>
<p>From the VMWare menu select <strong>Install/Upgrade VMWare Tools</strong>.</p>
<p>Mount the media and extract the installation files into /tmp</p>
<pre>mount /cdrom
cd /tmp
tar zxf /media/cdrom/VMwareTools*.tar.gz</pre>
<p>As part of the installation some compiling needs to be done so we&#8217;ll need to put some source libraries on unless they&#8217;re already there.</p>
<pre>sudo apt-get install build-essential linux-headers-`uname -r`</pre>
<p>The config.h file whilst needed is not created by default so an empty one is created so the build will complete.</p>
<pre>sudo touch /usr/src/linux-headers-`uname -r`/include/linux/config.h</pre>
<p>(Thanks <a href="https://help.ubuntu.com/community/VMware" target="_blank">https://help.ubuntu.com/community/VMware</a> for the tip on this).</p>
<pre>cd vmware-distribution
sudo ./vmware-install.pl</pre>
<p>Follow the prompts for the installation &#8211; shared folders fails to build but in the ESX environment they&#8217;re not essential.</p>
<p>Reboot the box and you are in buisiness.</p>
]]></content:encoded>
			<wfw:commentRss>http://mickvaites.com/2009/06/ubuntu-9-04-installation-on-esx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using sftp on a non-standard port</title>
		<link>http://mickvaites.com/2009/06/using-sftp-on-a-non-standard-port/</link>
		<comments>http://mickvaites.com/2009/06/using-sftp-on-a-non-standard-port/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 07:22:59 +0000</pubDate>
		<dc:creator>mick</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://mickvaites.com/?p=877</guid>
		<description><![CDATA[Just a quick note about sftp.
It makes good security sense to change the ssh port on servers that are Internet accessable. To take advantage of this using ssh is quite straight forward as their is a parameter -p to support this eg:
ssh -p 3432 mick@mickvaites.com
Unfortunately the same is not true for sftp (secure file transfer). [...]]]></description>
			<content:encoded><![CDATA[<h3>Just a quick note about sftp.</h3>
<p>It makes good security sense to change the ssh port on servers that are Internet accessable. To take advantage of this using ssh is quite straight forward as their is a parameter <strong>-p</strong> to support this eg:</p>
<pre>ssh -p 3432 mick@mickvaites.com</pre>
<p>Unfortunately the same is not true for sftp (secure file transfer). To achieve the same result with sftp we need to use specify an option of &#8220;<strong>Port 3432</strong>&#8221; eg:</p>
<pre>sftp -o "Port 3432" mick@mickvaites.com</pre>
<p>Once done log it as you would normally.</p>
]]></content:encoded>
			<wfw:commentRss>http://mickvaites.com/2009/06/using-sftp-on-a-non-standard-port/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Escape commands</title>
		<link>http://mickvaites.com/2009/06/ssh-escape-commands/</link>
		<comments>http://mickvaites.com/2009/06/ssh-escape-commands/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 23:26:48 +0000</pubDate>
		<dc:creator>mick</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://mickvaites.com/?p=811</guid>
		<description><![CDATA[Note to self:
These are the ssh escape commands from within an ssh connected session.
%~?
Supported escape sequences:
 ~.  - terminate connection (and any multiplexed sessions)
 ~B  - send a BREAK to the remote system
 ~C  - open a command line
 ~R  - Request rekey (SSH protocol 2 only)
 ~^Z - suspend ssh
 ~#  - list forwarded [...]]]></description>
			<content:encoded><![CDATA[<h3>Note to self:</h3>
<p>These are the ssh escape commands from within an ssh connected session.</p>
<pre>%~?
Supported escape sequences:
 ~.  - terminate connection (and any multiplexed sessions)
 ~B  - send a BREAK to the remote system
 ~C  - open a command line
 ~R  - Request rekey (SSH protocol 2 only)
 ~^Z - suspend ssh
 ~#  - list forwarded connections
 ~&amp;  - background ssh (when waiting for connections to terminate)
 ~?  - this message
 ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)</pre>
<p>The ~ (tilda) is normally accessed by keying [shift] + [`]</p>
<p>To pull up the list as above send a Tilda + Question Mark ~?</p>
]]></content:encoded>
			<wfw:commentRss>http://mickvaites.com/2009/06/ssh-escape-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu 9.04 installed on my laptop</title>
		<link>http://mickvaites.com/2009/05/ubuntu-904-installed-on-my-laptop/</link>
		<comments>http://mickvaites.com/2009/05/ubuntu-904-installed-on-my-laptop/#comments</comments>
		<pubDate>Tue, 19 May 2009 23:44:04 +0000</pubDate>
		<dc:creator>mick</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://mickvaites.com/?p=463</guid>
		<description><![CDATA[Just some notes in respect of installing Ubuntu 9.04 on the Laptop Fujitsu Amilo Pro. In particular getting the wireless card to work.
The problem is that the wireless button doesn&#8217;t do anything so whilst the hardware is detected it cannot be brought up.
The solution is in two parts.
1. Get the OS to load the fsam7400 [...]]]></description>
			<content:encoded><![CDATA[<p>Just some notes in respect of installing Ubuntu 9.04 on the Laptop Fujitsu Amilo Pro. In particular getting the wireless card to work.</p>
<p>The problem is that the wireless button doesn&#8217;t do anything so whilst the hardware is detected it cannot be brought up.</p>
<p>The solution is in two parts.</p>
<p>1. Get the OS to load the fsam7400 driver and pass a parameter radio=1</p>
<pre>sudo echo fsam7400 &gt;&gt; /etc/modules
sudo echo options fsam7400 radio=1 &gt;&gt; /etc/modprobe.d/options</pre>
<p>2. To survive hibernate/resume</p>
<pre>modprobe -r ipw2200
modprobe -r fsam7400</pre>
<p>to /etc/acpi/sleep.sh and /etc/acpi/hibernate.sh and</p>
<pre>modprobe fsam7400 radio=1
modprobe ipw2200 led=1</pre>
<p>to /etc/acpi/resume.sh</p>
<p>A big thanks to <strong>cartes </strong>and <strong>ph1721</strong> for their postings on <a href="http://ubuntuforums.org" target="_blank">http://ubuntuforums.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mickvaites.com/2009/05/ubuntu-904-installed-on-my-laptop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load Balancing with Linux</title>
		<link>http://mickvaites.com/2009/03/load-balancing-with-linux/</link>
		<comments>http://mickvaites.com/2009/03/load-balancing-with-linux/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 00:04:52 +0000</pubDate>
		<dc:creator>mick</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://mickvaites.com/?p=294</guid>
		<description><![CDATA[Disaster had struck when both of the Arrowpoint Content Switches died with power supply faults. We needed to move them in the racks, they powered off but they didn&#8217;t power back on.
I looked at off the shelf solutions and was forced to rethink when I discovered that they come in with a price tag of [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Disaster had struck when both of the Arrowpoint Content Switches died with power supply faults. We needed to move them in the racks, they powered off but they didn&#8217;t power back on.</p>
<p style="text-align: left;">I looked at off the shelf solutions and was forced to rethink when I discovered that they come in with a price tag of between £2000 and £9000 each device. Whilst visiting on a good friend and colleague <strong><a href="http://www.sporticia.com" target="_blank">Scott</a></strong> the subject load balancers came up. His advise was to check out the <strong><a href="http://www.linuxvirtualserver.org/" target="_blank">Linux Virtual Server Project</a></strong> and in particular to look at <strong>ipvsadm</strong>.</p>
<p style="text-align: left;">We were looking for a simple solution to load balance both secure and non-secure web servers. After hunting around the internet I came across <a href="http://www.keepalived.org" target="_blank">Keepalived</a> and I am impressed to say that with a small amount of iptables it pretty much just works out of the box.</p>
<p><img class="size-full wp-image-298 alignright" title="lbnetwork" src="http://mickvaites.com/wp-content/uploads/2009/03/lbnetwork.png" alt="lbnetwork" width="247" height="347" /></p>
<p style="text-align: left;">The solution consists of two load balancers  <strong>lb1</strong> and <strong>lb2</strong> sitting between the Internet and the web server farm. VRRP is the redundancy protocol used to allow multiple boxes to work together.</p>
<p style="text-align: left;">The Internet facing IP addresses are managed by keepalived and associated with <strong>vrrp 1</strong>. An IP address is allocated as the default gateway for the web server farm and this is associated with <strong>vrrp 2.</strong> Keepalived ensures that only the active <strong>lb</strong> has these ip addresses active.</p>
<p style="text-align: left;">We run VMWare ESX Servers which aids fast deloyment of new services. It&#8217;s also quite useful as you can create the build you want the copy it as many times as you need &#8230; I digress.</p>
<p style="text-align: left;">From the list of Linux Distro&#8217;s I chose <a href="http://www.ubuntu.com" target="_blank">Ubuntu 8.10 Server</a> as it was one I had to hand.  Once installed the packages were patched using <strong>apt-get</strong> and then keepalived was installed</p>
<pre style="text-align: left;">apt-get install keepalived</pre>
<p style="text-align: left;">This creates a folder <strong>/etc/keepalived</strong> which contains the control file <strong>keepalived.conf</strong> an document example as follows.</p>
<pre style="text-align: left;">global_defs {
	notification_email {
		mick@mydomain.com
	}
	notification_email_from keepalived@mydomain.com
	smtp_server localhost
	smtp_connect_timeout 30
<strong># name associated with this load balancer LVS_BACKUP is my backup
</strong>	router_id LVS_MASTER
}

vrrp_sync_group VG1 {
	group {
		VI_PUBLIC
		VI_GATEWAY
	}
}

vrrp_instance VI_PUBLIC {
<strong># this denotes the default state - the backup is state BACKUP
</strong>	state MASTER
<strong># interface connected to the public lan
</strong>	interface eth0
<strong># vrrp 1
</strong>	virtual_router_id 1
	lvs_sync_daemon_interface eth0
<strong># sets who is primary and backup (backup priority is 150)
</strong>	priority 200
	authentication {
		auth_type PASS
		auth_pass xxx
	}
	virtual_ipaddress {
<strong># the public ip address associated with the web farm</strong>
		200.200.200.200/24
	}
}

vrrp_instance VI_GATEWAY {
<strong># this denotes the default state - the backup is state BACKUP
</strong>	state MASTER
<strong># interface connected to the web farm lan
</strong>	interface eth1
	lvs_sync_daemon_interface eth2
<strong># vrrp 2
</strong>	virtual_router_id 2
<strong># sets who is primary and backup (backup priority is 150)
</strong>	priority 200
	advert_int 1
	smtp_alert
	authentication {
		auth_type PASS
		auth_pass ThisPassword
	}
	virtual_ipaddress {
<strong># the default gateway for the web farm
</strong>		192.168.1.1/24
	}
}
<strong># public ip address associated with the webserver
</strong>virtual_server 200.200.200.200 80 {
<strong># HTTP 1.1 hostname
</strong>	virtualhost www.mydomain.com
	delay_loop 30
	lb_algo wlc
<strong># we are NAT'ing the addresses
</strong>	lb_kind NAT
	nat_mask 255.255.255.0
	persistence_timeout 50
	protocol TCP
<strong># ip address of real web server 1 from farm
</strong>	real_server 192.168.1.100 80 {
		weight 1
		HTTP_GET {
			url {
<strong># look for a small image that you know will always exist
</strong>				path /icons/unknown.gif
<strong># if web server okay you will get a status code 200
</strong>				status_code 200
			}
<strong># you'll need to tinker around with these to get them just right
</strong>			connect_timeout 20
			nb_get_retry 10
			delay_before_retry 30
<strong># web server runs of port 80
</strong>			connect_port 80
		}
	}
<strong># ip address of real web server 2 from farm
</strong>	real_server 192.168.1.101 80 {
		weight 1
		HTTP_GET {
			url {
				path /icons/unknown.gif
				status_code 200
			}
			connect_timeout 20
			nb_get_retry 10
			delay_before_retry 30
			connect_port 80
		}
	}
}</pre>
<p>Because the load balancers will be the default gateways for the web server farm. We need to configure <strong>iptables</strong> nat masqurade so that if the web server needs to talk to the internet it will have a public IP address. The following very basic <strong>/etc/iptables.rules</strong> is used to nat the replies.<strong><br />
</strong></p>
<pre>:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [4980:5513190]
:OUTPUT ACCEPT [3522:318353]
-A INPUT -i l0 -j ACCEPT
-A INPUT -i eth0 -j ACCEPT
-A INPUT -i eth1 -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
COMMIT
*nat
 <img src='http://mickvaites.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> REROUTING ACCEPT [4036:3275594]
 <img src='http://mickvaites.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> OSTROUTING ACCEPT [118:7080]
:OUTPUT ACCEPT [142:8825]

-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT</pre>
<p>To bind this in to ubunu a script <strong>load_tables</strong> containing</p>
<pre>#!/bin/sh
iptables-restore &lt; /etc/iptables.rules</pre>
<p>Is placed in<strong>/etc/network/if-pre-up.d</strong> and then it will be called on boot.</p>
<p style="text-align: left;">
<p style="text-align: left;">
<p style="text-align: left;">
]]></content:encoded>
			<wfw:commentRss>http://mickvaites.com/2009/03/load-balancing-with-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

