Configure DHCP

A DHCP server automates the network configuration process for clients. In detail, DHCP allows a Linux computer to serve dynamic IP addresses. It supports the configuration of a range of IP addresses and allows you to reserve a specific IP address, based on the hardware address associated with a client’s network card. It can assign more information such as the gateway and DNS IP address to every system that requests an IP address.

DHCP servers can simplify and centralize network administration if you’re administering more than a few computers on a network. They are especially convenient for networks with a significant number of mobile users. The standard Ubuntu DHCP server is based on the dhcp3-server package. That server must be on the same system as the TFTP server for a network installation of this type to work.

 Just be aware that many users already have a configured DHCP service. Even home users may already have a DHCP server on the router that connects their home networks to the Internet. Multiple DHCP servers on a single network can lead to problems. It’s best to deactivate other DHCP servers before testing the DHCP servers described here. Now review the configuration of the DHCP server.

 The default configuration file, which is /etc/dhcp3/dhcpd.conf, does not configure any IP addresses by default. So if you try to activate the DHCP3 server without modifying the configuration file, the attempt will fail. This article reviews only those directives required for a basic service on a standard private IPv4 network, customized for network booting. In the /etc/dhcp3/dhcpd.conf configuration file, Dynamic DNS updates are not enabled based on the following directive:

ddns-update-style none;

In the following directives, you should substitute the domain name for the local private network with example.org. You should also substitute the FQDN or IP address of the DNS servers with ns1.example.org and ns2.example.org:

option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

Of course, you need to configure a system for some local network. The following stanza takes advantage of the PXE Linux configuration file on the Ubuntu Server installation CD. It then configures the DHCP server on the  192.168.0.0/255.255.255.0 network. It assigns IP addresses between 192.168.0.200 and 192.168.0.220.


filename = "ubuntu/install/netboot/pxelinux.0";
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.200 192.168.0.220;
}


There are a number of additional suggested options commented out in the default version of the /etc/dhcp3/dhcpd.conf configuration file. They provide hints for configuring the DHCP server for remote networks and reserved IP addresses, as well as allowing or denying DHCP access to a group of systems. Once configured, turn off any other DHCP services, and start this one with the following command:

$ sudo /etc/init.d/dhcp3-server restart

Success or failure is logged in files such as /var/log/messages. First test this server from a remote client, with a command such as this:

$ sudo dhclient eth0

Now you’re ready to make this work with a TFTP server. When you’re finished with the remote installation process, deactivate this DHCP server with the following command:

$ sudo /etc/init.d/dhcp3-server stop

If you deactivated other DHCP servers in this section, it’s now OK to reactivate those servers.

Posted on: 22/12/2009








0 Comments
If you want to leave a comment please Login or Register