How to set up a DHCP server on a local network

DHCP stands for Dynamic Host Configuration Protocol. A DHCP server maintains IP addresses and DNS servers and a gateway address on every computer that exists on the local network. DHCP uses port 67 and 68. The DHCP server does its job like DORA:

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

Here we will show you how to set up a DHCP server on Linux system.

OS : Ubuntu Server 04.14 LTS

Server IP address : 192.168.0.1

Follow the simple steps:

Step 1:

When installing ISC-DHCP Server on Linux for the first time.

[email protected]# 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 you need to edit the main DHCP configuration file. This DHCP configuration file is located in the / etc / dhcp directory, which is named as the dhcpd.conf file

Now open the dhcpd.conf file in nano editor

[email protected]#nano /etc/dhcp/dhcpd.conf

Step 3:

Here we will show you how to assign 192.168.0.0/24 on the network on the user’s computer.

Let’s open and edit the file /etc/dhcpd.conf.

You should now comment out authoritive.

#authoritive to authoritive

Then add some lines

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
}

Sidebar