User Tools

Site Tools


computers:dhcp_server_configuration

DHCP server configuration

Installation

Download and install the package

sudo apt-get install isc-dhcp-server

Configuration

Specify the interfaces dhcpd should listen to in /etc/default/isc-dhcp-server, for example:

INTERFACESv4="eno1np0"

Edit /etc/dhcp/dhcpd.conf, for example:

# /etc/dhcp/dhcpd.conf
ddns-update-style none;
log-facility local7;
option domain-name-servers 192.168.1.1, 140.109.1.10, 8.8.8.8;
default-lease-time 86400;
max-lease-time 86400;
 
subnet 192.168.1.0 netmask 255.255.255.0 {
	option routers                  192.168.1.1;
	option subnet-mask              255.255.255.0;
	option broadcast-address        192.168.1.255;
 
	range 192.168.1.200 192.168.1.250;
}
 
# printer
host poplar {
	hardware ethernet XX:XX:XX:XX:XX:XX;
	fixed-address 192.168.1.11;
}
 
# server
host oak {
	hardware ethernet XX:XX:XX:XX:XX:XX;
	fixed-address 192.168.1.21;
}
 
# workstation
host sage {
	hardware ethernet XX:XX:XX:XX:XX:XX;
	fixed-address 192.168.1.101;
}

Activation

To start/stop/restart the service:

sudo service isc-dhcp-server start
sudo service isc-dhcp-server stop
sudo service isc-dhcp-server restart

Monitoring

To check dhcpd status:

sudo service isc-dhcp-server status

To see the leases:

more /var/lib/dhcp/dhcpd.leases

References

computers/dhcp_server_configuration.txt · Last modified: 2020/08/16 00:52 by chkuo