Saturday, July 30, 2005

Home networking with Ubuntu

Sad to say but my Linux networking skills have grown rusty over the years. For the most part, I've either been working from behind a firewall, with a SOHO router, or direct broadband connection. So it's been a long time since I've had to configure DHCP, DNS, or IP masquerading.

And that's precisely what I needed to do with my present home network. In the past six months, I've accumulated three desktop PCs and a Thinkpad, ostensibly for my education, but otherwise not really doing anything. I thought I needed to get my much-delayed personal projects off the ground.

Primary problem: since I'm on Globe DSL, I'm using a Speedtouch 330 modem which only has a USB connection. That means hooking it up to a SOHO router from D-Link or Linksys is out. That means I'd have to use my primary PC as my firewall/router.

Activating the Speedtouch 330 for Linux wasn't really much of a problem. It's a fairly well-documented process, and there's even a nifty little script that does automates the configuration.

Next thing was configuring DHCP, DNS, and IP masquerading. In the old days, I would have installed the appropriate packages, dhcp-server, bind, and iptables, and configured each individually. What a hassle!

So I did a little searching in Ubuntu's packages and came upon a few nuggets which greatly eased my troubles.

First, there was dnsmasq, a lightweight DNS server with an integrated DHCP server. All I really needed was a DNS forwarder, which dnsmasq is. But dnsmasq also converts the host files and DHCP leases into DNS entries, clearly an added plus. The configuration file was clear and simple, too. That took care of two of my tasks straightaways.

Then, there was ipmasq which has the basic scripts and rules to turn netfilter/iptables into a NAT firewall. I didn't even have to twiddle with configuration files anymore. Post-installation, my routing was up and running.

And just to round things out, since I'm too cheap to buy additional monitors, I run the other PCs headless and use VNC as my virtual KVM. It's great that Ubuntu already has a terminal server client built-in.

Granted, the system I'm running may not be very secure, but as far as getting a home network up and running, well, now it's just an hour's work for a rusty old-timer.