Home » Linux » How To » How to setup the dhcp server in LAN

How to setup the dhcp server in LAN

Introduction of DHCP:

DHCP means dynamic host configuration protocol. DHCP server serves the ip address and dns server and gateway address to the every computer which are exist in the Local Area network. DHCP uses the port address 67 and 68. Dhcp server perform his work on the principle of DORA.

D= Discover
O=Offer
R=Recover
A=Acknowledgement

dhcp process

Here I will show you how to configure DHCP server into the Linux system.

OS: Ubuntu server 14.04 LTS

Server ip address:192.168.0.1

follow the steps:

step 1:

at first install the isc-dhcp server to the Linux system.

root@ani# sudo apt-get install isc-dhcp-server -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
isc-dhcp-server-ldap
The following NEW packages will be installed:
isc-dhcp-server
0 upgraded, 1 newly installed, 0 to remove and 11 not upgraded.
Need to get 0 B/411 kB of archives.
After this operation, 938 kB of additional disk space will be used.
Preconfiguring packages ...
Selecting previously deselected package isc-dhcp-server.
(Reading database ... 281728 files and directories currently installed.)
Unpacking isc-dhcp-server (from .../isc-dhcp-server_4.1.1-P1-15+squeeze8_amd64.deb) ...
Processing triggers for man-db ...
Setting up isc-dhcp-server (4.1.1-P1-15+squeeze8) ...
Generating /etc/default/isc-dhcp-server...

Step 2:
Now edit the main configuration file of the dhcp. This configuration file of dhcp is located in the /etc/dhcp directory which is named as dhcpd.conf
Now open the dhcpd.conf file in the Nano editor
root@ani#nano /etc/dhcp/dhcpd.conf

Step 3:
Here I am showing that how to assign 192.168.0.0/24 network to user computer.
Open /etc/dhcpd.conf and edit
Now you have to uncommented authoritive.
#authoritive to authoritive
Next add some lines at the button

subnet 192.168.0.0 netmask 255.255.255.0{range 192.168.0.2 192.168.0.10
option-gateway 192.168.0.1
option-dns servers 8.8.8.8
max-lease time 200
}

For more details write on comment box.
Thank you.

Check Also

Password less SSH authentication

Password less SSH authentication is one of the best security practices to avoid any password …

Leave a Reply

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