# DHCPCDGUI

#### 0.1

Current release (0.1, unix)

## Overview

### Abstract

DHCPCDGUI is a very small Ruby script that can be used to control dhcp clients through a simple GUI interface.

### Introduction

When I finally caved in and bought laptops for my wife and myself, I immediately found myself in need of a more dynamic home network. Setting up DHCP and masquerading was nearly trivial (I'll go over the basics below), but I had a problem in that there seemed to be no user-friendly utilities for starting and stopping the DHCP client on the laptops -- something I need to do rather regularly. I have a nagging feeling that I'm missing something obvious, but after a quick web search, I decided to hack up a start/stop client utility. The actual program is smaller than this document.

Why did I use the Qt2 binding for the GUI? Good question. I could have used the Tk binding and reduced the dependancies list, but I think Tk is ugly, and I don't like the API. I don't much like the Qt2 API, either, but at least Qt2 apps look better. Which doesn't matter much for this application, since it consists entirely of a single button... but I'm trying to learn the Qt2 API for Ruby, and I'm hoping that someday the Qt2 binding will include KDE extensions, so I can stick my little app in the dock. My other choice was the FLTK binding, but I'm waffling about which API I want to use. I like the FLTK API and the toolkit itself is aesthetic for being small and simple. On the other hand, FLTK is missing some pretty basic, and IMHO, minimal functionality, such as layout managers.

1

## Requirements

- Ruby
- Qt2 (comes with most Linux distributions)
- Qt2 for Ruby

## Screenshots

This is it.

## Operation

### Setting up DHCP

Setting up the dhcp client is trivial, if you're on an RPM based system. Just install the RPM and (as root) run 'dhcpcd'. Easy. Runnig 'dhcpcd' is basically all dhcpcdgui does.

For the server, I cheated, and used the 'wizard' utility, a Java-based configuration tool supplied on the Mandrake install CDs. If you don't want to use this, I can't help you much, but the files you want to look at are in /etc/sysconfig, specifically in the network* subdirectories. Actually, the wizard DHCP configuration utility broke my system, killing the loop device, among other things, but hacking around in the sysconfig files, I eventually got it working.

Sorry I can't supply more information, but I'm a programmer, not a network engineer, dammit.

### Setting up masquerading

Masquerading is something you set up on your dhcp server (the one that is connected to the internet) to allow your local networked machines to access the internet. Masquerading is something you need if your machines don't have "registered" IP addresses (usually the case for home networks). Masquerading is only required if the machines on your LAN are all getting to the internet through one machine; IE, they aren't individually connected to the network.

There are very good howtos available for the full monty, but the basic sequence is to make sure you have the proper modules compiled in your kernel (in particular iptables and routing), and then use the iptables tool to enable masquerading on your server. I've set up masquerading before, but with ipchains. The howto I found most helpful in setting up masquerading on my 2.4 based systems was the NAT-HOWTO, provided by the folks at samba.org.

### Running dhcpcdgui

The best thing to do is chmod u+s and chown root the script, unless you're concerned about security. Then just run the script. You may have to change the first line of the script to point to your Ruby runtime and chmod +x it when you install it. If you're worried about the security of u+s, then you'll have to work your own way around it; I don't have any other suggestions.

Once the app is running, using it is straightforward. dhcpcdgui detects whether dhcpcd is already running and acts accordingly. When the button says "Connect", click it to start dhcpcd. When it says "Disconnect", click it to stop dhcpcd nicely.

1)