isc-dhcp-server

Dynamic Host Configuration Protocol (DHCP) is a client/server based networking protocol that automatically provides Internet Protocol (IP) address and other related configuration information such as the subnet mask and default gateway. DHCP server will provide IP to DHCP client.

For more info, follow DHCP wiki

isc-dhcp-server is implementation of DHCP Server protocol by isc.org.

uses

Most of time we have used isc-dhcp-server for bootp protocol to boot embedded devices using ethernet.

NOTE

isc-dhcp-server is no longer supported by its vender and it has been replaced by Kea

so its recommended to install Kea from Ubuntu 23.04 or greater.

Follow this link for Kea installation Guide.

install isc-dhcp-server

sudo apt-get install isc-dhcp-server

Configure isc-dhcp-server

The isc-dhcp-server installed with default configuration and you need to change it based on your system configuration.

You can update the default configuration by editing /etc/dhcp/dhcpd.conf

For refrence, here is the dhcpd.config which we have used

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as
# configuration file instead of this file.
#

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

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

# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;

# 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 10.42.0.0 netmask 255.255.255.0 {
  range 10.42.0.10 10.42.0.100;
  range 10.42.0.150 10.42.0.200;
}

# This declaration allows BOOTP clients to get dynamic addresses,

subnet 10.42.0.0 netmask 255.255.255.0 {
  range dynamic-bootp 10.42.0.110 10.42.0.130;
  option broadcast-address 10.42.0.1;
  if substring (option vendor-class-identifier, 0, 16) = "XX XX XXXXX XXXX"
  {
    filename "yyyyyyyy";
  } elsif substring (option vendor-class-identifier, 0, 16) = "YY YY YYYYY YYYY"
  {
    filename "zzzzzzzz";
  }
}



You also need to modify /etc/default/isc-dhcp-server to specify the network interfaces dhcpd should listen to.

INTERFACESv4="eth4"

Make sure to change eth4 based on your network interfaces, you can list avalible network interface by using ifconfig command.

souce code

To get the source implimentation of isc-dhcp-server. follow DHCP source code


©2023-2024 rculock.com