Linux Server How To

How To Setup, Configure, Manage and Secure a Linux Server


Linux Server How To - Install DHCPD Using Apt-get


Installing DHCPD Using Apt-get

Installing DHCPD using apt-get is an easy process that can be performed in around about one minute. Apt-get retrieves the selected packages from a source server on the internet and automatically installs the software you have selected for you, in this instance DHCPD, the Linux DHCP server. An internet connection is necessary for this process to be successful. The commands documented here worked effectively on our Ubuntu Linux server and the majority of the information provided here will hold true for any Linux server using a distribution based on Debian.

Installing DHCPD using apt-get is as simple as typing-

john@ubuntu-linux-server:~$ sudo apt-get install dhcp3-server

This will install the DHCP daemon onto your Linux server as /usr/sbin/dhcpd3 and it can be configured by editing /etc/dhcp3/dhcpd.conf. The DHCP server can be started by typing-

john@ubuntu-linux-server:~$ sudo service dhcp3-server start

Quick Configuration

Once you have installed DHCPD using apt-get and attempted to start it you most likely found that it did not work! Although Linux Server How To features a more thorough guide to configuring your Linux DHCP server on Configuring DHCPD the example dhcpd.conf below will get your installation started with some basic parameters.

ddns-update-style none;

# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers 192.168.10.100, 192.168.10.110;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# This is a very basic subnet declaration.

subnet 192.168.10.0 netmask 255.255.255.0 {
range 192.168.10.150 192.168.10.200;
option routers 192.168.10.1;
}

The above example dhcpd.conf will work quite acceptably and supplies the basic information required to get your DHCP clients accessing the internet via a gateway. You will have to change the IP addresses specified here to suit your network.