This is a very quick guide to setting up a DHCP server. There are loads of things that you can do with DHCP but when you have only got a couple of machines that isn't a lot of point messing about as it is probably quicker to just go and set up the machine statically.

Mac Address

The first thing you need is the MAC address of the client machine. This can be recovered using the command ifconfig (you will need /sbin/ifconfig if you don't have /sbin on your path). The line you ar looking for looks like this:

eth0      Link encap:Ethernet  HWaddr 00:B0:CF:8B:49:37

The six pairs of hex digits after the HWaddr are what you are looking for.

Common Home DHCP Setup

Switch to your server machine and install dhcp3-server if you haven't currently got it. Open or create the file /etc/dhcp3/dhcpd.conf. A common home setup of DHCP assigns fixed IP addresses to machines that are always on the network and has a range of dynamically assigned addresses for machines that just appear (friends laptops for instance). The firewall, amongst other tools, can be used to minimize what the machines on the dynamically assigned addresses can do on your network.

Dynamic IP Block Addresses

Dynamic addresses are setup like this (using a standard range of non-routable IP addresses):

subnet 192.168.0.0 netmask 255.255.255.0 {
    option routers 192.168.0.1;

         # Unknown clients get this pool.
         pool {
           #option domain-name-servers bogus.example.com;
           max-lease-time 7200;
           range 192.168.0.128 192.168.0.255;
           allow unknown clients;
         }
}

Static IP Block Addresses

The static machines are set up like this:

host hostname {
    hardware ethernet 00:B0:CF:8B:49:37;
    fixed-address 192.168.0.19;
}

Using DHCP to Assign DNS

If you want your DHCP server to tell your client machines which DNS server to use (you normally do) then you need to add a section like this indicating where the DNS servers can be found:

#ns1.example.com = 222.164.30.7
#ns2.example.com = 112.105.170.5
option domain-name-servers 192.168.0.2, 222.164.30.7, 112.105.170.5;

Assigning a Defualt Domain Name

DHCP can be used to assign a default domain name for your client machines:

option domain-name "crazysquirrel.com";

DHCP IP Lease Time

If your network doesn't change very much a long (default) lease time is generally better. If the network is quite dynamic shorten the lease time accordingly. A good lease time is shown below:

default-lease-time 6000;
max-lease-time 72000;

Binding DHCP to an Interface

The default Debian install of DHCP doesn't bind it to any interface. This is to stop a default DHCP configuration from polluting the network. To bind and interface you need to make and entry in /etc/default/dhcp3-server for example:

INTERFACES="eth1"

If you don't make this entry the DHCP server will complain about any interfaces with addresses you don't have a subnet declaration for:

No subnet declaration for eth0 (81.5.183.107).
Ignoring requests on eth0.  If this is not what
you want, please write a subnet declaration
in your dhcpd.conf file for the network segment
to which interface eth0 is attached. **

Finally restart your dhcp server and reconfigure your host machine so that it picks up it's IP address and other information from your server via DHCP.