You are on page 1of 10

DHCP( Dynamic Host Configuration

Protocol )
By
M.QASIM

History & Evolution


The primary motivation for
In computer networking, the
replacing RARP with BOOTP
Bootstrap Protocol, or BOOTP,
was that RARP was a data link is a network protocol used by a
layer protocol. This made
network client to obtain an IP
implementation difficult on many address from a configuration
server platforms, and required server.
that a server be present on
each individual IP subnet.

The Dynamic Host Configuration Protocol (DHCP) is a more


advanced protocol for the same purpose and has superseded
the use of BOOTP.

Router
Configuration
info

IP

Printers,Smart
phones,PCs

Modem

ISP

The router receives the configuration information through


a modem from an internet service provider, which also
operates DHCP servers with this router as one of the
clients. The clients request configuration settings using
the DHCP protocol such as an IP address, a default
route and one or more DNS server addresses. Once the
client implements these settings, the host is able to
communicate on the internet

The DHCP server maintains a database of available IP


addresses and configuration information. When the server
receives a request from a client, the DHCP server determines
the network to which the DHCP client is connected, and then
allocates an IP address or prefix that is appropriate for the
client, and sends configuration information appropriate for
that clientThe query is typically initiated immediately after
booting, and must complete before the client can initiate IPbased communication with other hosts. Upon disconnecting,
the IP address is returned to the pool for use by another
computer. This way, many other computers can use the same
IP address within minutes of each other.For example, the
DHCP Message type option for an Offer would appear as
0x35,0x01,0x02, where 0x35 is code 53 for "DHCP Message
Type", 0x01 means one octet follows and 0x02 is the value of
"Offer".

Three methods of allocating IP-addresses

Dynamic allocation: A network administrator assigns a range


of IP addresses to DHCP, and each client computer on the
LAN is configured to request an IP address from the DHCP
server during network initialization. The request-and-grant
process uses a lease concept.

Automatic allocation: The DHCP server permanently assigns a free


IP address to a requesting client from the range defined by the
administrator. This is like dynamic allocation, but the DHCP server
keeps a table of past IP address assignments, so that it can
preferentially assign to a client the same IP address that the client
previously had.

Static allocation: The DHCP server allocates an IP address


based on a table with MAC address/IP address pairs, which
are manually filled in (perhaps by a network administrator).
Only clients with a MAC address listed in this table will be
allocated an IP address.

Disadvantage

Because the DHCP server has no secure mechanism for


authenticating the client, clients can gain unauthorized access
to IP addresses by presenting credentials, such as client
identifiers, that belong to other DHCP clients

Important Commands
less /var/lib/dhcp/dhclient.leasesgrep dhcp-serveridentifier /var/lib/dhcp/dhclient.leasesman dhcpoptionsnetstat -au | grep bootp

Change Ubuntu Server from DHCP


to a Static IP Address

sudo vi /etc/network/interfacesFor the primary


interface, which is usually eth0, you will see these
lines:auto eth0iface eth0 inet dhcp

Instead type the below lines:auto loiface lo inet


loopbackauto eth0iface eth0 inet staticaddress
192.168.1.10netmask 255.255.255.0gateway
192.168.1.1

sudo nano /etc/resolv.confAdd appropriate


nameserver for eg:nameserver 192.168.1.1sudo
/etc/init.d/networking restartIfconfigping
http://www.google.com. If you get a response, name
resolution is working:

You might also like