Install and Configure DHCP Server on Debian 8

Install and Configure DHCP Server on Debian 8

Definition and Functions of DHCP Server

DHCP server or Dynamic Host Configuration Protocol is a protocol that allows a computer or server to assign IP addresses dynamically or automatically to other computers, or client computers.

When the DHCP client on the client computer is activated, the client computer will make a request to the server computer to get an IP address from the DHCP server. Then the DHCP server will provide an answer to the client computer by providing the available IP Address in the IP Address pool or range on the DHCP server.

So with this mechanism, a server administrator no longer needs to set IP addresses statically or manually one by one on each client computer so that they can connect to the server computer or other computers. Imagine if a network has tens or hundreds of computers, how much time is saved by using a DHCP server.

Configuring IP Address on Debian

IP Address is the main requirement for a device or computer to be able to connect with other devices. Before starting to install and configure the Dynamic Host Configuration Protocol (DHCP server) on Debian, we must first set the IP Address or Network Interfaces on the computer.

If you have followed the previous tutorial, namely Install and Configure DNS Server on Debian 8 or have configured the IP Address correctly, you can skip this step. But the IP address that you set must be the same as the configuration on the DHCP server that we will do later.

If not, to set the IP Address on Debian, open the interfaces file in the /etc/network/ directory. Type the following command to open the file:

# nano /etc/network/interfaces

After the file opens, add or replace the existing configuration file as follows:

auto eth0
iface eth0 inet static
        address 192.168.1.1
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1
        nameserver 192.168.1.1

When finished, save the configuration by pressing the CTRL + O key combination on the keyboard, then press Enter. Then press CTRL + X to exit the nano editor or the file.

Adding Domain and Name Server to the resolv.conf File File

Type the following command to open the resolv.conf file:

# nano /etc/resolv.conf

Delete the contents of the file and replace it with the DNS and nameservers you use as follows:

domain sudoway.xyz
search sudoway.xyz
nameserver 192.168.1.1

Save the configuration.

Since Network Interfaces have just been configured, the machine needs to restart the networking service for the newly configured IP address to work. Type the following command to restart the networking service:

# /etc/init.d/networking restart

Then you can check whether the Network Interfaces configuration is running or not by typing the “ifconfig” command.

# ifconfig

Then the IP Address settings will appear on the computer, check whether it matches what you have configured.

At this point the IP Address configuration has been completed. Or if you want to know more about IP Address configuration, please read the article on how to configure IP Address with command line on Linux/Debian.

Install DHCP Server Package on Debian 8

On Debian 8 (specifically Debian 8.6 as used in this tutorial), the package provided by default for running a DHCP server task is “isc-dhcp-server”. If you used a DVD for installation, on Debian 8.6 the package is DVD-Binary 2.

Insert DVD-Binary 2 and type the following command to have the package list added:

# apt-cdrom add

Then type the following command to install the isc-dhcp-server package as a DHCP server.

# apt-get install isc-dhcp-server

Make sure the package is successfully installed properly. During the isc-dhcp-server installation process, a failed message will appear. No need to be afraid, the failed message occurs because the IP Address configuration in the network interfaces file is different from the default IP Address configuration in the DHCP Server configuration.

Next: Configure DHCP Server on Debian 8 >>

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *