Installing DHCP Server to Raspberry Pi 3

In this blog, I am going to show you how to set up a DHCP on Raspberry Pi 3 and assign IP addresses to the devices in our network.

Let’s make sure our Pi is up-to-date:

sudo apt-get update && sudo apt-get upgrade

We will use isc-dhcp-server:

sudo apt-get install isc-dhcp-server -y

It is OK to get errors as we did not set our DHCP Server.

To make our setting we will edit “dhcpd.conf”

sudo vi /etc/dhcp/dhcpd.conf

Set it up like the network we want, I want my network to:

  • use IP Addresses,
  • route it over,
  • have netmask,
  • have a range of IP Addresses.
subnet netmask {
 option routers;

Save it:

sudo dhcpd -cf /etc/dhcp/dhcpd.conf

Set the interface’s IP Address with ifconfig and restart the service:

sudo ifconfig eth0
sudo service isc-dhcp-server restart

After we connect it to a hub or a switch with devices connected to it, we will see the devices getting the IP Addresses.

Restart the service if it doesn’t.

Leave a Reply

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