Linux: Configure a tiny DHCP Server


the best choice to setup a very tiny dhcp server on linux is the busybox udhcpd DHCP implemention.

root@debdev:~# apt-get install udhcpd

Enable the daemon by setting DHCPD_ENABLED to yes in /etc/default/udhcpd. Use this:

root@debdev:~# sed -i '/DHCPD_ENABLED/ s/no/yes/' /etc/default/udhcpd

Next is editing the config file /etc/udhcpd.conf or create a new one

# Range from with IP Addresses should be offer
# Interface on which the daemon listen.
interface eth2
# How long the offer is available
offer_time 60
# Lease file , where the leases written to
lease_file /var/lib/misc/udhcpd.leases
#Some options
opt dns
option subnet
opt router
option domain
option lease 3600 # 1h in seconds
# If a client needs a static IP Address binding
static_lease 00:50:56:31:BE:4E
# For more options see

Create the lease file and start the daemon

root@debdev:~# touch /var/lib/misc/udhcpd.leases
root@debdev:~# update-rc.d udhcpd defaults
root@debdev:~# /etc/init.d/udhcpd start

And check syslog for any errors

root@debdev:~# grep udhcpd /var/log/syslog
Jul 23 11:40:33 debdev udhcpd[3769]: udhcpd (v1.20.2) started

If started you can monitor syslog to see if ip addresses whould assign to clients

root@debdev:~# tail -f /var/log/syslog | grep udhcpd
Jul 22 20:39:11 debdev udhcpd[3704]: Sending OFFER of
Jul 22 20:39:11 debdev udhcpd[3704]: Sending ACK to


Advertisment to support

One thought on “Linux: Configure a tiny DHCP Server”

  1. Hello,

    I’m encountering issue to start the eibd daemon at the startup:
    I use your script, it runs well if I run it using the command line: “sudo /etc/init.d/eibd start” BUT I always have to remove the eib socket before using “sudo rm /tmp/eib”.

    It seems that this one is always created at each startup using “root” user.

    So by reading your article “EIB/KNX: Upstart startup script for eibd” , I understand that eibd should have been started as root before my startup script… Do you think it is the case? How can I check it? or disable it?

    Thanks for your help!

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.