Debian Setup Server DHCP

blog.pucc.or.id

Steps I follow from google :

iptables -A POSTROUTING -j MASQUARADE

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

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

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.11 192.168.1.254;
option domain-name-servers 8.8.8.8;
option domain-name "server.local";
option routers 192.168.1.2;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
}

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

INTERFACESv4="eth0"

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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