How To Configure Linux DHCP Server

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 7
At a glance
Powered by AI
The key takeaways are that DHCP allows centralized management of client IP addresses and network settings, and makes network administration easier. It assigns IP addresses, subnet masks, gateways and DNS servers to clients.

The steps are to install the DHCP package, configure the DHCP server interface, edit the dhcpd.conf file to define the DHCP options and IP range, restart the DHCP service, and check for leases.

To assign a fixed IP address, edit the dhcpd.conf file and specify the client's MAC address and the desired fixed IP under a host statement.

How to configure linux dhcp server step by

step guide Example and Implementation


DHCP, or Dynamic Host Configuration Protocol, allows an administrator to configure network settings for
all clients on a central server.
The DHCP clients request an IP address and other network settings from the DHCP server on the network. The
DHCP server in turn leases the client an IP address within a given range or leases the client an IP address based
on the MAC address of the client's network interface card (NIC). The information includes its IP address, along with
the network's name server, gateway, and proxy addresses,including the netmask.
Nothing has to be configured manually on the local system, except to specify the DHCP server it should get its
network configuration from. If an IP address is assigned according to the MAC address of the client's NIC, the same
IP address can be leased to the client every time the client requests one. DHCP makes network administration
easier and less prone to error.
Exam Question Configure the DHCP server by matching the following conditions:
Subnet and netmask should be 192.168.0.0 255.255.255.0
Gateway Should be 192.168.0.254
DNS Sever Should be 192.168.0.254
Domain Name should be example.com
Range from 192.168.0.10-50
Exam Question You have DHCP server, which assigns the IP, gateway and DNS server ip to Clients.
There is one DNS servers having MAC address (00:50:FC:98:8D:00 in your LAN, But it always required
fixed IP address (192.168.0.10). Configure the DHCP server to assign the fixed IP address to DNS
server.

Configure dhcp server


In this example we will configure a dhcp server and will lease ip address to clients.
For this example we are using three systems one linux server one linux clients and one window clients.
dhcp

rpm

is

required

to

configure

dhcp

server.

check

it

if

not

found

then

install

Now check dhcpd service in system service it should be on


#setup
Select System service from list
[*]dhcpd

To assign IP to dhcp server

DHCP server have a static a ip address. First configure the ip address 192.168.0.254 with netmask of
255.255.255.0 on server.
Run setup command form root user
#setup

this will launch a new window select network configuration

Your Ad Here

now a new window will show you all available LAN card select your LAN card ( if you dont see any LAN card
here mean you dont have install driver)

assign IP in this box and click ok

click on ok, quit and again quit to come back on root prompt.
restart the network service so new ip address can take place on LAN card
#service network restart
main configuration file of dhcp server is dhcpd.conf. This file located on /etc directory. If this file is
not present there or you have corrupted this file, then copy new file first, if ask for overwrite press y

now
default

open
entry

in

this

/etc/dhcpd.conf
file

look

like

this

make these change in this file to configure dhcp server


remove this line
# - - - default gateway
set option routers to
192.168.0.254
set option subnet-mask to
255.255.255.0
option nis domain to
example.com
option domain-name to
example.com
option domain-name-servers to
192.168.0.254
range dynamic-bootp to
192.168.0.10 192.168.0.50;

After

change

this

file

should

look

like

this

how to assign fix ip address to any host

locate this paragraph and change hardware Ethernet to client's mac address and fixed -address to ip
address
which
you
want
to
provide
that
host

after making necessary change save file and exit


now
create
a
blank
file
use
to
store

the

allocated

ip

address

information

Now restart dhcpd service and on it with chkconfig commands

Linux Client configuration


Client configuration is very easy and straightforward. All you need to do is set ip address to dynamic in
the properties of lan card. In linux
#setup
select network configuration from menu list
Select lan card and enter on ok

Select USE DHCP and enter on ok


Now click on quit and quit to come back on root prompt
Now restart the network service to obtain ip from dhcp server

Window Client configuration

To configure windows system as dhcp clients open lan card properties and select tcp/ip and click on
properties
and
set
obtain
ip
address
automatically

Go

on

command

prompt

and

check

new

ip

address

Check lease on DHCP server


you

can

check

allocated

address

on

server.

You might also like