Debian Setup Server DHCP

Steps I follow from google :


The first step is to make sure the lan card that the dhcp service is serve is sharing its connection.

apt update
apt install isc-dhcp-server

Wait until everything is finished. I just found out that the dhcpd is no longer popular in latest ubuntu server. They are using isc-dhcp-server.

Then edit the configuration of /etc/dhcp/dhcpd.conf

default-lease-tie 600;
max-lease-time 7200;
ddns-update-style none;

subnet netmask {
option domain-name-servers;
option domain-name "server.local";
option routers;
option broadcast-address;
default-lease-time 600;
max-lease-time 7200;

Edit the /etc/default/isc-dhcp-server, add the line of INTERFACESv4 with:


I ignore the v6 cause I have not use it. I have not learnt it yet.

Now the important thing. When I start the isc-dhcp-server, it always failed. Then in this link (after weeks of searching), the cause is dnsmasq is running. After I remove the service, and start the isc again, it works.

systemctl start isc-dhcp-server

Here is the status when it shows it run

isc-dhcp-server.service - LSB: DHCP server
   Loaded: loaded (/etc/init.d/isc-dhcp-server; generated)
   Active: active (running) since Thu 2021-05-13 13:16:21 WIB; 24min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1408 ExecStart=/etc/init.d/isc-dhcp-server start (code=exited, status=0/SU
    Tasks: 1 (limit: 4915)
   Memory: 5.9M
   CGroup: /system.slice/isc-dhcp-server.service
           └─1421 /usr/sbin/dhcpd -4 -q -cf /etc/dhcp/dhcpd.conf enp0s25

May 13 13:30:53 xxx dhcpd[1421]: DHCPREQUEST for xxxxxxxxx from xxxxx
May 13 13:30:53 xxx dhcpd[1421]: DHCPACK on xxxxxxx to xxxxxxx
May 13 13:35:01 xxx dhcpd[1421]: DHCPREQUEST for xxxxx from xxxxxx
May 13 13:35:01 xxx dhcpd[1421]: DHCPACK on xxxxxx to 

Nevermind the xxx sign in the above code. It is just a personal reason.

Now the setting with two nic.

The dhcp setting is stay as above. But the iptables is important here. Let’s say that the eth1 is the internet. And leave eth0 as the dhcp services.

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

Restart the server. And it should work.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.