Saturday 8 October 2016

DHCP Interview Questions

For Quick Overview You can refer to the below video.
For Detailed explanation refer to the DHCP Section in the BLOG.
OR
Go through the below link:
http://www.omnisecu.com/tcpip/dhcp-dynamic-host-configuration-protocol-how-dhcp-works.php





Q1. In a DHCP environment, which of the components (Client or Server) initiates the request
Ans.The client would always initiate the DHCP request. The request is triggered from the client , when the TCP/IP adapter is configured for the option “Obtain IP address automatically”. When this is selected, the operating system would automatically generate the DHCP Discover to identify valid DHCP Servers on the network.

Q2. How many DHCP packets are exchanged between a client and a server before the client receives an IP address?
Ans. 4 DHCP packets are exchanged between the client and the server. They are DHCP Discover, DHCP Offer, DHCP Request, DHCP Ack.

Q3. What type of packet is a DHCP Discover packet
Ans. DHCP Discover is a layer 3 broadcast packet with destination IP address as 255.255.255.255

Q4. What is an IP Helper address feature and why is it required in a DHCP environment?
Ans. DHCP Discover packets are broadcast packets. This means that a DHCP Discover packet which is sent from the client would not reach the DHCP Server , if the server resides on a different network. This is because , routers are required for communication between different networks and routers do not forward broadcast packets. The IP Helper address feature is configured on the router. The feature informs the router the DHCP Servers IP address for the network. So, When the router receives the DHCP Discover packet, it would convert it from broadcast to unicast packet and then send it to the DHCP Server.

Q5. What is a DHCP Scope and why is it required?
Ans: A scope includes information like IP address ranges, Subnet Masks, gateway address, DNS Server etc. This required so that clients would require the necessary information from the server.

Q6. What would happen if there are multiple DHCP servers on a network?
Ans. The clients would trigger DHCP Discover packets and the server which responds first would provide the IP address to the client

Q7. How does a client know that a lease has expired and how is it renewed?
Ans. When a client receives an IP address from the DHCP Server, the lease expiry date and time is provided as part of DHCP options. This is maintained and recorded by the client. Just before the lease expiry time, the client would initiate a renew request to the server for a new lease

Q8. How many DHCP Servers can reside on one subnet?
Ans. It’s unlimited. But if there is a DHCP client, which server would lease out the IP address ? It’s a simple logic. The first server which responds to the DHCP clients IP address request would lease out the IP address.

Q9. Explain the communication flow between a DHCP client and server on a network with two DHCP Servers ??
Ans. The first packet the DHCP Client initiates would be the DHCP Discover packet. The DHCP Discover packet is broadcast in nature and would be received by both the DHCP servers. The DHCP servers would respond with DHCP offer packet containing the IP addresses which they offer. Based on the first DHCP offer the client receives, the client would respond with DHCP request packet which contains the IP address which it would be using along with the DHCP servers IP address which had provide the respective. This packet is send as broadcast. The packet, when received by the other DHCP server would understand that the IP address which it had leased to the client (In the DHCP offer packet) is not taken. So the DHCP server would put the IP address back to it’s pool.

NOTE:
=====

  1.  DHCP was created by the Dynamic Host Configuration Working Group of the Internet  Engineering Task Force
  2. October 1993: RFC 1531 initially defined DHCP as a standard-track protocol succeeding the Bootstrap Protocol (BOOTP), which is a network protocol used by a network client to obtain an IP address from a configuration server 
  3. October 1997: RFC 2131 released is the current DHCP definition for Internet Protocol version 4 (IPv4) networks
  4. The extensions of DHCP for IPv6 (DHCPv6) were published as RFC 3315 

How DHCP Works?
Below are the steps :
Step 1: When the client computer (or device) boots up or is connected to a network, a DHCPDISCOVER message is sent from the client to the server. As there is no network configuration information on the client so the message is sent with 0.0.0.0 as source address and 255.255.255.255 as destination address. If the DHCP server is on local subnet then it directly receives the message or in case it is on different subnet then a relay agent connected on client’s  subnet is used to pass on the request to DHCP server. The transport protocol used for this message is UDP and the port number used is 67. The client enters the initializing stage during this step.
  Step 2: When the DHCP server receives the DHCPDISCOVER request message then it replies with a DHCPOFFER message. As already explained, this message contains all the network configuration settings required by the client. For example, the yaddr field of the message will contain the IP address to be assigned to client. Similarly the the subnet mask and gateway information is filled in the options field. Also, the server fills in the client MAC address in the chaddr field. This message is sent as a broadcast (255.255.255.255) message for the client to receive it directly or if DHCP server is in different subnet then this message is sent to the relay agent that takes care of whether the message is to be passed as unicast or broadcast. In this case also, UDP protocol is used at the transport layer with destination port as 68. The client enters selecting stage during this step
  Step 3: The client forms a DHCPREQUEST message in reply to DHCPOFFER message and sends it to the server indicating it wants to accept the network configuration sent in the DHCPOFFER message. If there were multiple DHCP servers that received DHCPDISCOVER then client could receive multiple DHCPOFFER messages. But, the client replies to only one of the messages by populating the server identification field with the IP address of a particular DHCP server. All the messages from other DHCP servers are implicitly declined. The DHCPREQUEST message will still contain the source address as 0.0.0.0 as the client is still not allowed to use the IP address passed to it through DHCPOFFER message. The client enters requesting stage during this step.
  Step 4: Once the server receives DHCPREQUEST from the client, it sends the DHCPACK message indicating that now the client is allowed to use the IP address assigned to it. The client enters the bound state during this step.
The Concept of Lease:
With all the necessary information on how DHCP works, one should also know that the IP  address assigned by DHCP server to DHCP client is on a lease. After the lease expires the DHCP server is free to assign the same IP address to any other host or device requesting for the same. For example, keeping lease time 8-10 hours is helpful in case of PC’s that are shut down at the end of the day.  So, lease has to be renewed from time to time. The DHCP client tries to renew the lease after half of the lease time has expired. This is done by the exchange of DHCPREQUEST and DHCPACK messages. While doing all this, the client enters the renewing stage.
 What is an IP Helper address feature and why is it required in a DHCP environment

DHCP Discover packets are broadcast packets. This means that a DHCP Discover packet which is sent from the client would not reach the DHCP Server , if the server resides on a different network. This is because, routers are required for communication between different networks and routers do not forward broadcast packets. The IP Helper address feature is configured on the router. The feature informs the router the DHCP Servers IP address for the network. So, when the router receives the DHCP Discover packet, it would convert it from broadcast to unicast packet and then send it to the DHCP Server.


1 comment:


  1. Very nice and informative blog. It really helped me add some useful points in my knowledge. Thanks for sharing!
    Also check out these amazing Cisco products if you want:

    C3850-NM-8-10G
    C3850-NM-2-10G
    C9200L-24P-4X-E

    ReplyDelete

Note: only a member of this blog may post a comment.