How To Configure DHCP server on CentOS 7, Ubuntu 18.04 & Debian 9.

Windows Articles

How to create a registry backup in Windows Server 2019/2016

Hello! The registry is one of the essential elements within Windows Server. Additionally, the system has an editor to be able to...

How to update apps on Android

Hi folks! In this post, we will show you how to update your Android apps. Updating the apps on your device is...

How to install Apache Ant on Ubuntu 20.04?

Hello, friends. Apache Ant is a very important tool for the development of applications in Java. So in this post, we will...

How to use the ss command

For Linux users, there will come a time when you need to know about the network. Several tools help in this process,...

How to create user template in Windows Server 2019/2016

Hello! Windows Server has many features that support system administration. For example, through the users it is possible to manage many administrative...

Introduction:

Dynamic Host Configuration Protocol is a network protocol which is used to Distribute network configuration parameters. It involves the configuration of IP addresses, gateways, and DNS for Network interfaces. It provides the automation of IP assigning.

Install & Configure DHCP server on CentOS 7

Run the given command to Install DHCP server and client.

yum install dhcp

After the successful installation of packages, copy the sample configuration file to /etc/dhcp/directory

cp /usr/share/doc/dhcpd.conf.example /etc/dhcp/dhcpd.conf

When you have finishing copying, edit the dhcpd.conf file.

vi /etc/dhcp/dhcpd.conf

You can define the subnet, range of IP addresses, domain & domain name servers as below:

[…]
Configuring subnet and iprange
subnet 192.168.12.0 netmask 255.255.255.0 {
range 192.168.12.100 192.168.12.200;
Specify DNS server ip and additional DNS server ip
option domain-name-servers 8.8.8.8, 8.8.4.4;
Specify Domain Name
option domain-name "osradar.local";
Default Gateway
option routers 192.168.12.2;
option broadcast-address 192.168.12.255;
Specify Default and Max lease time
default-lease-time 600;
max-lease-time 7200;
}
[…]

Note: You can define according to your own requirements.

For assigning fixed IP address to your clients, you will need to enter their MAC id and the IP address in the following syntax.

[…]
host mywindows-client {
hardware ethernet 00:0C:29:05:A7:CB;
fixed-address 192.168.12.110;
}
[…]

Start and Enable dhcpd services

Type the below commands to take the effect of configurations

systemctl start dhcpd 
systemctl enable dhcpd

Note: If you face any issue, you can update the SELinux or disable it permanently.

/sbin/restorecon -v /etc/dhcp/dhcpd.conf

Now, proceed towards the configuration of DHCP Client’s to attain the IP addresses automatically from the DHCP server.

Install & Configure DHCP Server on Ubuntu 18.04 / Debian 9

Type the below command to get install DHCP on Ubuntu system.

sudo apt-get install isc-dhcp-server

After installing assign the interfaces that would requests to DHCP . If you have only one interface it will assign that one.

Configure the file /etc/default/isc-dhcp-server

sudo nano /etc/default/isc-dhcp-server

Bold eth0 in the file.

Now, edit the dhcpd.conf file

sudo nano /etc/dhcp/dhcpd.conf

Make the changes as given below

[…]
Configuring subnet and iprange
subnet 192.168.12.0 netmask 255.255.255.0 {
range 192.168.12.100 192.168.12.200;
Specify DNS server ip and additional DNS server ip
option domain-name-servers 8.8.8.8, 8.8.4.4;
Specify Domain Name
option domain-name "osradar.local";
Default Gateway
option routers 192.168.12.2;
option broadcast-address 192.168.12.255;
Specify Default and Max lease time
default-lease-time 600;
max-lease-time 7200;
}
[…]

To configure fixed IP addresses follow the below pattern

host mywindows-client {
hardware ethernet 00:0C:29:05:A7:CB;
fixed-address 192.168.12.110;
}

After Installing , now start the dhcpd services and do it start automatically on system reboot

sudo service isc-dhcp-server restart

So, this is how you can Configure DHCP client server.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to create a registry backup in Windows Server 2019/2016

Hello! The registry is one of the essential elements within Windows Server. Additionally, the system has an editor to be able to...

How to update apps on Android

Hi folks! In this post, we will show you how to update your Android apps. Updating the apps on your device is...

How to install Apache Ant on Ubuntu 20.04?

Hello, friends. Apache Ant is a very important tool for the development of applications in Java. So in this post, we will...

How to use the ss command

For Linux users, there will come a time when you need to know about the network. Several tools help in this process,...

How to create user template in Windows Server 2019/2016

Hello! Windows Server has many features that support system administration. For example, through the users it is possible to manage many administrative...
x