Setting up a DHCP server on Ubuntu Hardy Heron

Update: There is now an updated version of this guide for Ubuntu 12.04: Setting up a DHCP server on Ubuntu 12.04 (Precise Pangolin) server.

This is my really short installation log of how I installed and configured a DHCP server on Ubuntu Hardy Heron.

1: Make sure that the latest version is installed:

sudo apt-get install dhcp3-server

Note: Don’t be alarmed if the startup fails; that’s because you haven’t configured it yet.

2.1: Edit the DHCP server configuration:

sudo nano /etc/dhcp3/dhcpd.conf 

2.2: The contents of my configuration file, for me the comments already in the file was what I needed to make the necessary changes:

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# option definitions common to all supported networks...
option domain-name "home.lan";
option domain-name-servers ubuntu.home.lan;

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;

# This is a very basic subnet declaration.
subnet 10.10.10.0 netmask 255.255.255.0 {
  range 10.10.10.100 10.10.10.200;
  option routers router.home.lan;
}

3: Start the DHCP server (it should now start without problems):

sudo /etc/init.d/dhcp3-server start

Done 🙂

16 thoughts on “Setting up a DHCP server on Ubuntu Hardy Heron

  1. Pingback: Make your DHCP server dynamically update your DNS records on Ubuntu Hardy Heron « Lani’s Weblog

  2. Pingback: Ubuntu Podcast by the Ubuntu Georgia LoCo - Ubuntu Podcast Episode#5

  3. JPierre

    Hey Lami,
    Nice post.

    Are you using 2 Network Cards? and if that’s so, did you have both of them connected during the setup?

    I am failing to get my DHCP to start, and to this moment, could not find the reason.

    Reply
  4. lani78 Post author

    Hi JPierre, thanks for your comments.

    I’m only using 1 network card.

    Maybe you can find a clue of what’s wrong in the system log:

    “tail /var/log/syslog”

    Regards,
    Lani

    Reply
  5. JPierre

    I can now get DHCP, but can’t get the connected clients to browse the web. I can ping google from the server though for example. Any tips?

    Reply
  6. lani78 Post author

    JPierre: Make sure that “option domain-name-servers” is set to your dns in the configuration, as this is the dns that the clients will be told to use. Also make sure that if you have specified your external router in the configuration file, if you have one. You do this with the “option routers” statement. I think this is what the clients will use as the default gateway.

    To narrow down the problem I would do these simple tests:

    1. Ping the server from a client.
    2. Ping the IP-address of google. If this works it is a DNS problem.

    Reply
  7. Pingback: am nevoie de un cunoscator server ubuntu - Computer Games Forum

  8. Pingback: Ubuntu Podcast Episode#5 « softaoglu.com

    1. lani78 Post author

      I think you should be able to just install the dhcp-server with apt. But I have not tried it myself and I do not have time to help you more than this, unfortunately.

      Reply
  9. Johnny

    I have this setup for IPv4. Its been working. Now I am venturing in to the realm of IPv6. all my workstations are IPv6 compliant. But I am having issues resolving IPv6 address with host names.
    Do you have an example for IPv6?
    I have dhcpv6 running off another box. But I am confused how to integrate the IPv6 AAAA records via Dynamic DNS in to lookup table.

    Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.