DHCP Dynamic Host Configuration Protocol 1706857559
DHCP Dynamic Host Configuration Protocol 1706857559
Dynamic Host Configuration Protocol (DHCP) is a network management protocol used to automate the process of
assigning IP addresses and other configuration information to devices on a network. DHCP uses a client-server model to
allocate ip addresses and optional parameters to the clients upon client boot up. These parameters are leased by the
server to the client for some specified amount of time DHCP simplifies the administration of IP addresses and reduces the
likelihood of address conflicts.
When a device (such as a computer, smartphone, or network printer) joins a network, it initially does not have an assigned
IP address. The device sends out a DHCP Discover message to find a DHCP server on the network.
DHCP servers on the network respond with a DHCP Offer message, providing the client with an IP address and other
configuration parameters, such as subnet mask, default gateway, and DNS servers. The DHCP server reserves the offered
IP address for the client for a specific lease duration.
The client selects one of the offered IP addresses and sends a DHCP Request message to the chosen DHCP server,
indicating its acceptance of the offered configuration.
The DHCP server responds with a DHCP Acknowledge message, confirming the client's request and providing the client
with the approved IP address and configuration details.
5. IP Address Lease:
The client now uses the assigned IP address for communication on the network. The IP address is leased to the client for a
defined period, after which the client may need to renew the lease.
6. Lease Renewal:
Before the lease expires, the client may attempt to renew the lease by sending a DHCP Request message to the DHCP
server that initially provided the configuration.
If the client moves to a new network or the lease expires without renewal, it releases the IP address back to the DHCP
server. If the client cannot renew its lease with the original DHCP server, it may attempt to rebind with any available DHCP
server on the network.
DHCP operates over the User Datagram Protocol (UDP) using port 67 for server communication and port 68 for client
communication. The protocol helps to manage IP addresses efficiently, especially in large networks, by automating the
assignment process and avoiding conflicts. DHCP is widely used in both wired and wireless networks to simplify the
network configuration process for end-users and administrators.
When a host boots up, the TCP/IP stack in the host sends a broadcast (DHCP DIS) massage in order to gain an ip address
and subnet mask. This process initiates an exchange between the DHCP server and the host. During this exchange, the
client passes through the several states.
(A) Initializing
(B) Selecting
(C) Requesting
(D) Bound
(E) Renewing
(F) Rebinding
--------------------------------------------------------------------------www.NCeducations.com-----------------------------------------------------------------------------------
In moving between these states the client and the server exchanges some DHCP massages.
1:- DHCP Discover Massage- When a client boots up, it is said to be in initializing state, and broadcasts a DHCP discover
massage on local subnet over UDP port 67. since the client has no ip address configured, the src ip will be 0.0.0.0 and the
client has no way of knowing DHCP server so the dest ip will be broadcast 255.255.255.255. If a DHCP exists on the local
subnet, the server will hear the broadcast and respond with DHCP offer massage. If a DHCP Server does not exist on local
subnet there must be a DHCP-relay agent on the local subnet to forward the DHCP discover to the network that contains
DHCP server.
2:- DHCP offer- A DHCP server that receives a DHCP discover may respond with a DHCP offer message on UDP port 68. The
client receives the DHCP offer and moves in selecting state, this massage contains initial information like server will fill the
YIADDR field of DHCP offer massage with the offered ip add. The subnet mask and gateway are specified in the options
field. The DHCP server will send the offer to the broadcast but will include the clients MAC Address in the CHADDR field so
the client knows that it is the dest. if the DHCP server is not in local subnet, the server will send the DHCP offer to the relay
agent as a unicast on UDP port 67. Then Relay agent will broadcast or unicast the DHCP offer on UDP port 68, depending
on the broadcast flag set by client.
3:- DHCP Request:- After the client receives the offer, It responds with a DHCP request, indicating that it accepts the
parameters in DHCP offer and moves into Requesting state The client may receive multiple DHCP offer, the client chooses
one offer and responds to that DHCP server only, The client identifies the selected server by the server identifier option
with the DHCP server's ip. The DHCP request is also a broadcast. and the src ip will be 0.0.0.0 because, at this time client
has not yet received verification that it is clear to use the ip address.
4:- DHCP ACK:- After the DHCP server receives the DHCP Request, it acknowledges the request with a DHCP ACK. Then the
process will be completed. DHCP ACK massage has src ip of DHCP server and the dest will be broadcast and contains all
parameters that client requested in DHCP request. When a client receives the ACK it moves in Bound state and can use the
ip address. the DHCP server stores the lease in its database and uniquely identifies it using the client ID or CHADDR, and
the associated ip address. the Client identifier is the combination of MAC address of the device and the media type.
5:- DHCP NAK:- If the DHCP server is unable to satisfy or rejects the DHCP request, the server will respond with a DHCP
NAK. When the client receives a DHCP NAK or does not receive a response to a DHCP request, the client restarts the
process by going into the requesting state. the client will retransmit the DHCP request at least four times within 60 sec
before restarting from the initializing state
6:- DHCP DECLINE:- The client receives the DHCP ACK and will perform a check on the parameters. the client sends a GARP
request for the provided ip add to check the duplicacy. If the client detects that the ip add is in use by receiving the reply
to the GARP request means a conflict in ip address. the client will send a DHCP DECLINE message to the server and restart
the process by going into requesting state.
7:- DHCP INFORM:- If a client has a manually configured ip address. client may use DHCP INFORM massage to obtain other
parameters such as domain-name, DNS. After receiving DHCP INFORM message server constructs a DHCP ACK with
parameters for the client without allocating a new ip address. This ACK will be unicast.
8:- DHCP Release:- When a client wants to release the ip address it sends the DHCP Release to the server. it will put its ip
address in this message so that server can remove the binding for the assigned ip. and that ip address will be available in
the pool.
A DHCP relay agent is a networking device or software feature that facilitates the forwarding of DHCP (Dynamic Host
Configuration Protocol) messages between DHCP clients and DHCP servers when they are not on the same subnet. The
DHCP relay agent helps extend DHCP services beyond the local subnet by forwarding DHCP messages between the client
and server.
1. DHCP Discover on a Different Subnet: When a DHCP client is located on a different subnet than the DHCP server, it
sends a DHCP Discover message as a broadcast.
2. Broadcasts Are Not Routed: Broadcast messages, including DHCP Discover, are not typically routed by routers. As a
result, the DHCP server on a different subnet would not directly receive the client's DHCP Discover broadcast.
3. DHCP Relay Agent Intervention: A DHCP relay agent is configured on an intermediate networking device (such as a
router) on the client's local subnet. When the DHCP relay agent receives the DHCP Discover broadcast, it
encapsulates the broadcast message in a unicast packet and forwards it to the DHCP server's IP address.
--------------------------------------------------------------------------www.NCeducations.com-----------------------------------------------------------------------------------
4. Unicast to DHCP Server: The DHCP relay agent sends the encapsulated DHCP Discover message as a unicast packet
to the DHCP server's IP address. This allows the DHCP server to receive and process the client's request.
5. DHCP Server Responds: The DHCP server responds with a DHCP Offer, DHCP Acknowledge, or other appropriate
messages. The DHCP relay agent forwards the response back to the client on the local subnet.
DHCP Header:
FIELD DESCRIPTION
Op code (8 bits) Type of message (Boot Request (1) or Reply (2))
Htype (8 bits) Type of hardware address (1 for Ethernet)
Hlen (8 bits) length of hardware address (6 bytes)
Hops (8 bits) used in case of relay agents, it defines number of Hops this message has passed. Clients sets to 0.
Xid (4 bytes) Transaction ID used by the client and server to identify a session.
Secs (16 bits) Time elapsed (in seconds) since the client started the address acquisition or renewal process
Flags (16 bits) Broadcast flag
ciaddr (4 bytes) Client IP address.
yiaddr (4 bytes) The IP address assigned by server to the client
siaddr (4 bytes) Server IP address.
Giadd (4 bytes) IP address of the relay agent.
Chadd (16 bytes) Hardware address of the client.
Sname (64-byte) Host name of the server. This is ASCII character containing the server name, not always filled
File (128 bytes) This is used with Sname field where it provides the path to boot file.
Options (64-bytes) Additional options which contains the optional parameters like domain-name, dns-servers etc.
--------------------------------------------------------------------------www.NCeducations.com-----------------------------------------------------------------------------------