DEBIAN | Configuration of ISC DHCP Server

  • by
  1. Install ISC DHCP Server
root@debian:~# apt search isc-dhcp
Sorting... Done
Full Text Search... Done
isc-dhcp-client/stable,now 4.4.1-2 amd64 [installed]
  DHCP client for automatically obtaining an IP address

#Install ISC-DHCP Server
apt install isc-dhcp-server
  1. Modify the /etc/default/isc-dhcp-server
  • uncomment DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
  • Enter the Network Interface Name – INTERFACESv4="ens192"
nano /etc/default/isc-dhcp-server
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
#       Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#       Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="ens192"
INTERFACESv6=""

  1. Modify the /etc/dhcp/dhcpd.conf by adding the DHCP Range
  • Default-Lease-Time from 600 (10 Min) to 8 Hours (28800)
  • Max-Lease-Time from 7000 to 86400 (1 Day)
  • uncomment authoritative
nano /etc/dhcp/dhcpd.conf

default-lease-time 28800;
max-lease-time 86400;
authoritative;

	subnet 192.168.1.0 netmask 255.255.255.0 {
        range 192.168.1.60 192.168.1.79;
        option routers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option broadcast-address 192.168.1.255;
        option domain-name-servers 192.168.1.200;
}
  1. Restart ISC DHCP
systemctl restart isc-dhcp-server
#Enable isc dhcp server during system startup
systemctl enable isc-dhcp-server
  1. Verify the version of ISC DHCP Server installed
root@debian:~# dhcpd
Internet Systems Consortium DHCP Server 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Config file: /etc/dhcp/dhcpd.conf
Database file: /var/lib/dhcp/dhcpd.leases
PID file: /var/run/dhcpd.pid
There's already a DHCP server running.
  1. Monitor the DHCP Lease information from /var/log/syslog or /var/lib/dhcp/dhcpd.lease
tail -f /var/log/syslog
root@debian:~# cat /var/lib/dhcp/dhcpd.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.4.1

# authoring-byte-order entry is generated, DO NOT DELETE
authoring-byte-order little-endian;

lease 192.168.1.60 {
  starts 3 2019/09/11 08:05:28;
  ends 3 2019/09/11 16:05:28;
  tstp 3 2019/09/11 16:05:28;
  cltt 3 2019/09/11 08:05:28;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 00:0c:29:bb:a3:9d;
  uid "\001\000\014)\273\243\235";
  set vendor-class-identifier = "MSFT 5.0";
  client-hostname "LAB-WIN10";
}
server-duid "\000\001\000\001%\013^\371\000\014)i\014\266";