Ubuntu, DHCP and hostnames

I just worked out that Ubuntu won’t set the hostname according to what is returned from dhcp. This makes sense in some ways, but I was deploying a VM template and I wanted the hostname set by dhcp.

I am not using network-manager in the following examples. And honestly network-manager only makes life easier on a laptop, or desktop when operating wirelessly.

Make sure your network interface is set to dhcp, as network-manager is installed by default the relevant line may be commented out (also if your not using it, purge network-manager from your system). The relevant entries from my /etc/network/interfaces:


# The primary network interface
auto eth0
iface eth0 inet dhcp

Add an script in /etc/dhcp3/dhclient-exit-hooks.d. It should check if GDM is running, as after it has started up you should not change the hostname. My script read as follows:
/etc/dhcp3/dhclient-exit-hooks.d/set_hostname

# If you want to enable this script, change SETHOSTNAME to "yes"

SETHOSTNAME="yes"

if [ "$SETHOSTNAME" = "yes" ]; then
	if test -r /var/run/gdm.pid && ps -ef | grep $(cat /var/run/gdm.pid) | g
rep -q /usr/sbin/gdm ; then
	echo "$(date): GDM running, not changing host name"
	else
		hostname $new_host_name;
	fi
fi

That should be it. Though you may need to remove some incorrect entries from /etc/hosts, and remove /etc/hostname if the file contents are wrong.

Lucid and iPhone tethering

I am loving Ubuntu 10.04. It is a genuinely brilliant release.

It has very good iPhone integration too. What it is still lacking is some of the utilities to make tethering easy. For USB tethering you can you can use Diego Giagio’s ipheth driver. I haven’t yet found a PPA for lucid, so you will need to compile from source.

For Bluetooth Tethering, Ubuntu comes with a nice new version of blueman, but it does not have the tight integration with network-manager.

To install blueman:
# apt-get install blueman

Pair your 2 devices. Pairing between blueman and the iphone generally works (even when it says it failed).

The trick to getting the network tether to work everytime is by starting the connection from your iphone. Once bluetooth is connected you can then right-click on you phone in blueman and access the network-point.

Because blueman and network-manager are not integrated you need one final commnand:

# dhcliet bnep0

OpenVPN client with Username and Password auth

Following on from last week’s post. We now need to setup the client.
Continue reading ‘OpenVPN client with Username and Password auth’

OpenVPN server with Username and Password auth

I did this on Debian but these instruction should work equally well for Ubuntu
Continue reading ‘OpenVPN server with Username and Password auth’

OpenVPN

I just replaced my potop install with openvpn. It is relatively easy to set up, and once working it is more secure, and much. much faster. From my completely unscientific, anecdotal observations, about 3 times faster.

I will get around to writing a full howto in the next week or so.

Android

I was given an Google ION to play with. It is the developer phone from the 2009 Google IO Conference, basically an HTC Magic with some developer stuff enabled. I really liked it.

The OS is nice, I upgraded to the OpenEclair ROM to give 2.1 a try. It was way to slow on the Magic but it gave me an appreciation for where google is going, and I would love a Nexus One. I also tried rolling my own android ROM and it was surprisingly easy.

I installed the Cyanogen ROM. It was nice. Fast and Stable. My problem is simple. The Magic has a fairly small screen and the default Android fonts are tiny. I can’t use it. After 5 minutes, my eyes hurt and I can no longer focus them. My eyes are crap, but I have no problem using the iPhone. So for the moment I am sticking with my iPhone. When the Nexus One finally makes it to Australia, I will get one I think.

USB Ethernet drivers for iPhone

Diego Giagio has built coded a Linux network driver to allow USB tethering with an unmodified iPhone. The source and more info can be found at: http://giagio.com/wiki/moin.cgi/iPhoneEthernetDriver.

For an easy to install Ubuntu package use this PPA, from pmcenery.

GMail Notifier

Gmail Notifier is the best gmail checker I have found. It makes use of libnotify and the Indicator Applet in GNOME, so it plugs in brilliantly with Karmic

HP Mini 1000, Ubuntu and WIFI

Getting Ubuntu on a HP mini 100 is well documented and well supported, to make wireless and ethernet work see here:

https://wiki.ubuntu.com/HardwareSupport/Machines/Netbooks#Karmic

Thing is, the driver packges needed by the Broadcom Wireless card are on the Install Media, they are just not included in the default install set. So a couple of commands during the install process and you can have wireless working on first boot.

Install Ubuntu. After install, before you hit restart press: ctrl+alt+F1

At the terminal prompt:

$ sudo su -
# chroot /target
# aptitude install bcmwl-kernel-sources

Now press ctrl+alt+F7 and click Reboot. You should now have wireless on first boot.

DavMail, open standards for Exchange

I have been frustrated with the Exchange server here at work, and found that Evolution MAPI support simply crashes everytime I try it. It is in the ubuntu bug list if you want to go hunting. And I really don’t like Evolution anyway.

But I just found DavMail, and it appears to work great. It is basically a java program that connects to an Outlook OWA (up tp 2007) and presents the information through standard services IMAP/SMTP/CalDAV. So I can now use Sunbird as my Calendar client, pointing it to a CalDAV server running on localhost,  and it seems to work a treat. Installation is straightforward on most platforms and after a bit of fidlling with the settings it is up and running.