DHCP Configuration
DHCP Configuration
DHCP Configuration
information, DNS addresses, and other network settings to client devices. When a device
connects, it requests an IP address from the server, which responds through the DORA
and renewing IP addresses, which are leased to clients for a specific period rather than
being permanently assigned.
If a computer is using a static IP address, it means that the IP has been manually set by
an administrator or user. This manual configuration can sometimes lead to accidental IP
conflicts, where two devices are assigned the same IP address. To avoid such issues, a
DHCP server is typically implemented. However, there are situations where using a static
IP address is essential.
Static IP addresses are typically reserved for network devices that require a consistent
address, such as servers, routers, and switches, where the IP must remain unchanged for
reliable operation.
1
Network Details:
We will now use our virtual network to implement the DHCP server. The server will be
Considering the DHCP server information given in the figure above, start the devices in
the GNS3. After the devices are started, log in to your CentOS-DHCP-Srv.
2
Installing the DHCP Package:
Before assigning a static IP address to the DHCP server, it's important to connect the
system to the internet to download necessary packages. Ensure that your CentOS DHCP
server is connected to the internet. If it's not, you can use the dhclient command to
obtain an IP address.
Once the system is connected, you can proceed to install the DHCP package using the
YUM (Yellow Dog Updater, Modified) package manager. The following command will
# vim /etc/dhcp/dhcpd.conf
The interface as shown in the figure below should welcome you after executing the
command.
3
Parameters:
After opening the file, first configure the basic options which is common to all
supported networks
default-lease-time 600;
max-lease-time 7200;
authoritative;
IP Subnet:
After that, we will specify the subnet details as per our network requirement. For this
session, we are configuring the DHCP for 172.168.30.0/24 network (LAN) to assign IP
addresses ranging from
4
Static IP address to Host:
There are some cases where we have to assign a fixed IP address to an interface every
time it is requested from the DHCP. We can do this on the basis of MAC address
(hardware Ethernet) of that interface. In this session we will assign fixed IP address to the
08:00:27:C5:E2:32 MAC address. We have to add the following details to the file.
host Windows10 {
fixed-address 172.168.30.12:
Considering that every detail is being configured, the file must contain the following
parameters.
5
Assigning Static IP address to the server: Before we start the DHCP service on the server,
we have to assign static IP address because we have dynamic IP address for now. To
assign static, we will make use to nmtui utility. We will set the hostname as shown in the
figure below. You have to use the arrow keys to navigate through the interface.
We will now configure the IP address details of the server and make sure to tick
6
Once the IP address is being configured, make sure that you can connect to the routers
IP address (172.168.30.2).
7
Now that all the required packages are installed and all the IP details are configured, it is
now
If everything is configured correctly, the service should start without any error as shown
in the figure below. If it is configured correctly there won’t be any message on the
terminal but in case of error, message will be displayed on the terminal. Make sure the
spellings are correct in the configuration file. Rectify the error and run the DHCP service.
Client Device:
It is finally time to add client to the network and test the functionality of the service. As
per our configuration, the server must assign IP address anywhere between
configuration file. We will now take our verification to the next level by connecting both
router and DHCP server from the client device.
8
9