[debian] How to install and configure ISC DHCP Server

Install the server with apt

apt-get install isc-dhcp-server

Edit config file

nano /etc/default/isc-dhcp-server

Add your network interface, default eth0

INTERFACES="eth0"

Edit dhcpd config file

nano /etc/dhcp/dhcpd.conf

Uncomment

authoritative;

And add at the end of file

subnet 192.168.1.0 netmask 255.255.255.0 { # IP and Netmask
  option routers 192.168.1.1; # Gateway
  option domain-name-servers 8.8.8.8; # DNS
  pool {
    range 192.168.1.2 192.168.1.245; # IP Range
  }
}

Restart the server

service isc-dhcp-server restart

Static address reservation

subnet 192.168.1.0 netmask 255.255.255.0 { # IP and Netmask
  option routers 192.168.1.1; # Gateway
  option domain-name-servers 8.8.8.8; # DNS
  pool {
    range 192.168.1.3 192.168.1.245; # IP Range
  }
  host printer {
    hardware ethernet CA-FC-EB-91-D6-31;
    fixed-address 192.168.1.2;
  }
}

Logging: redirect syslog to dhcpd.log

Edit dhcpd.conf

nano /etc/dhcp/dhcpd.conf

Verify

log-facility local7;

Edit rsyslog default.conf

nano /etc/rsyslog.d/50-default.conf

Change “*.*;auth,authpriv.none -/var/log/syslog” to

*.*;auth,authpriv.none,local7.none  -/var/log/syslog

Add following line

local7.*    /var/log/dhcpd.log

Touch dhcpd.log and change owner

touch /var/log/dhcpd.log
chown syslog:adm /var/log/dhcpd.log

Restart syslog and isc-dhcp-server

service syslog restart
service isc-dhcp-server restart