How To Install DHCP Server in Ubuntu & Debian
Abstract: option host-name "station1.local.tecadmin.net"and LinuxMint systems. Step 1 – Install DHCP Server Debian based systems provides package ‘isc-dhcp-serv
How To Install DHCP Server In Ubuntu & Debian. DHCP (Dynamic Host Configuration Protocol) is a network protocol used for assigning the IP address to network clients dynamically from predefined IP pool. It is useful for LAN network, but not generally used for production servers. Read more about DHCP here.
This tutorial will help you to install DHCP Server on Ubuntu, Debian, and LinuxMint systems.
Step 1 – Install DHCP ServerDebian based systems provides package ‘isc-dhcp-server’ for installing DHCP server. Open a terminal on your system and install DHCP using the following command.
sudo apt install isc-dhcp-serverStep 2: Configure DHCP Server
Follow the below steps to configure your DHCP server.
2.1 – Setup Interfaces to ListenFirst of all, edit /etc/default/isc-dhcp-server
to specify the interface to listen by dhcpd. You can specify multiple interfaces seprate by space.
INTERFACES="eth0 eth1"2.2 – Global Configuration
First of all, edit DHCP configuration file /etc/dhcp/dhcpd.conf
and set the global settings for domain-name and domain-name-servers to be used for local clients.
option domain-name "local.tecadmin.net"; option domain-name-servers ns1.tecadmin.net, ns2.tecadmin.net;
Furthermore, if you want this DHCP server as an official DHCP server for the local network, uncomment the authoritative directive
authoritative;2.3 – IP Subnet Declaration
Let’s set up your first subnet for your local network. You can create multiple subnets with different-2 settings, as per your requirements in /etc/dhcp/dhcpd.conf
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.100; option routers 192.168.1.1; option subnet-mask 255.255.255.0; option domain-search "local.tecadmin.net"; option domain-name-servers n1.local.tecadmin.net; option time-offset -18000; option broadcast-address 192.168.1.255; default-lease-time 600; max-lease-time 7200; }2.4 – Setup Host with Fixed IP
In addition, you can also specify the fixed IPs for some systems based on MAC address. For example system with MAC address 「00:11:1A:2B:3C:AB」, will get ip 192.168.1.99.
host station1 { option host-name "station1.local.tecadmin.net"; hardware ethernet 00:11:1A:2B:3C:AB; fixed-address 192.168.1.99; }Step 3: Start/Stop DHCP Service
Finally, you have successfully installed and configured DHCP server. Use the following command to start/stop and restart service.
sudo systemctl start isc-dhcp-server.service sudo systemctl stop isc-dhcp-server.service sudo systemctl restart isc-dhcp-server.service