How to set up a DHCP Server

Check to see that the DHCP server is loaded by typing the following: rpm -qa | grep dhcp You should see something like the following:

dhcp-3.0pl1-9

If not, then you will have to install it from the Fedora CD. To do this, get the Fedora CD #3. then mount the CD drive with the following commands:

mount /dev/cdrom
cd /mnt/cdrom/Fedora/RPMS
rpm -ivh dhcp*.rpm
If you have a CDR drive, you might need to use this command:

mount /media/cdrecorder
cd /media/cdrecorder/Fedora/RPMS
rpm -ivh dhcp*.rpm
Or download yum for your package. I am on FC3 so I went to the following:
http://mirrors.kernel.org/fedora/core/3/i386/os/Fedora/RPMS/

Next you need to configure the DHCP server. If you are going to support Microsoft Windows based computers, you need to type the following command:

route add -host 255.255.255.255 dev eth0

Next you need to configure your /etc/dhcpd.conf file. Below is an example of one:

# Sample /etc/dhcpd.conf
# (add your comments here)
# Below is what I used for my home network
# the DNS servers are for AT&T


ddns-update-style ad-hoc;


# don't let clients modify their own records
ignore client-updates;

default-lease-time 450000;
max-lease-time2592000;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 204.127.160.1;
option domain-name "att.net";

# for WINS
option netbios-name-servers 192.168.0.50;
option netbios-dd-server 192.168.0.50;
option netbios-node-type 8;

subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.10 192.168.0.40;
range 192.168.0.51 192.168.0.200;


host MacBookPro
{
hardware ethernet 00:17:f2:4b:c6:33;
fixed-address 192.168.0.40;
}

}


This configuration will give out IP addesses from 192.168.0.10-192.168.0.40 or 192.168.0.51-192.168.0.200. If the client doesn't ask for a specific time frame, it will lease the ip address for 32000 seconds. If the client asks for a time frame, the maximum it will allow is 65000 seconds. It also sets up the default gateway of 192.168.0.1, the subnet mask of 255.255.255.0, the broadcast address of 192.168.0.255, and 204.127.160.1 as the DNS server (AT&T's DNS server).

Next you need to create a dhcpd.leases file. You will also need to create the following path: /var/state/dhcp. Then create the file with the following command:
touch /var/state/dhcpd/dhcpd.leases

Run dhcpd in debug mode to make sure it is working properly with the following command: /usr/sbin/dhcpd -d -f. In this mode, you will be able to see the clients requesting an IP address.

If everything is ok, then set the dhcpd server to start automatically with the following command: chkconfig dhcpd on.

The DHCP leaese are kept in /var/lib/dhcp/dhcpd.leases