2. What is DHCP
01
Introduction, components,
how it works
Installing
02
Updating system & installing
server
Configuration
03
Commands and screenshots
Testing
04
Screenshots of usage
Table of contents
4. The Dynamic Host Configuration Protocol is a network management protocol
that assigns an IP address and other information to each host on the network
dynamically so that they can interact effectively. DHCP simplifies the job of
network administrators by automating and centrally managing IP address
assignment, in addition to:
■ Subnet masks
■ Default gateway
■ DNS address
■ Other parameters
What is DHCP
4
5. Components of DHCP
■ DHCP server
Answers IP address requests, provides
an available IP address, stores it for
the time of the lease and renew it
later. It will handle the communication
with all the client devices. The server
could be a computer or a part of the
router.
■ DHCP Client
Requests an IP address and communicates
with the DHCP server to get it with the rest
of the data and confirm the process.
■ DHCP relay agent
In charge of communication between the
DHCP server and the client. It will listen for
messages and pass them to the right place.
5
6. How it works
2. DHCP Offer:
When the DHCP server receives the DHCP
Discovery message it sends a DHCP Offer
message to the client containing the
proposed IP address, server IP address, client
MAC address, subnet mask, default gateway,
DNS address, and lease information.
DHCP works at the application layer to dynamically assign the IP address to the
client through exchanging a series of messages called DHCP transactions or
DHCP conversation as follows:
1. DHCP Discovery:
The DHCP client broadcast messages to
discover the DHCP servers. The client
computer sends a packet with the default
broadcast destination or the specific
subnet broadcast address if any
configured.
6
7. 4. DHCP ACK:
The server then sends Acknowledgment to
the client confirming the DHCP lease to the
client. The server might send any other
configuration that the client may have asked.
At this step, the IP configuration is
completed and the client can use the new IP
settings.
How it works
3. DHCP Request:
In response to the offer, the client sends a
DHCP Request requesting the offered
address from one of the DHCP servers. All
the other offered IP addresses from
remaining DHCP servers are withdrawn and
returned to the pool of IP available
addresses.
7
9. Installing
The first step would be to make sure the the device has the last updates necessary
through the following command
➔ Then, we go on to install
the ISC DHCP server
package
Now that all is set, let’s move to configuring a
DHCP server on the device.
9
11. Picking Interface
The first step of configuration will be to identify the interface that we will work
with, with the command ‘ip a’ or ‘ifconfig’ that lists our available interfaces.
11
12. Heading now to the configuration file and introduce the options we want in our server
➔ Our server is the official server for the
local network.
➔ The default time for a lease is 600 ms,
maximum is 86400 ms.
➔ The Address pool is defined between
192.168.1.150 and 192.168.1.200.
➔ The server will advise to use the
address 192.168.1.254 as default
gateway.
Config file
12
13. We need to define the interface that the server should listen to, as it can have many,
and we have already picked it.
Binding an interface
And just before starting up our DHCP server, we might want to check if the firewall
is activated or not, in case it is, we should allow the server activities.
13
14. Binding an interface
Now we’re left with just turning the Server on and checking if it’s functioning by typing
the following commands, it should show the message below
➔ The server is up and running !
14
16. Server testing
To test our configured DHCP server, we will need another device to be the client
in our case. The client, while on DHCP, has taken an IP address from the address
pool: 192.168.1.150, which is the first address in the pool.
16
17. Server testing
Now moving to the server-side, we can
check what devices have obtained
their IP address from our server
through the ‘dhcp-lease-list’ command
as follows.
And our system is working well!
17