Menu

US Region

Grandmetric LLC
Lewes DE 19958
16192 Coastal Hwy USA
EIN: 98-1615498
+1 302 691 94 10
info@grandmetric.com

EMEA Region

GRANDMETRIC Sp. z o.o.
ul. Metalowa 5, 60-118 Poznań, Poland
NIP 7792433527
+48 61 271 04 43
info@grandmetric.com

UK

Grandmetric LTD
Office 584b
182-184 High Street North
London
E6 2JA
+44 20 3321 5276
info@grandmetric.com

  • en
  • pl
  • What is DHCP protocol and how does it work?

    What is DHCP protocol and how does it work?

    Date: 18.07.2017

    Author:


    DHCP protocol (Dynamic Host Configuration Protocol) is commonly used in networks for dynamic IP addressing configuration. Every user’s device needs at least an IP address to join the network and connect to services. When the computer first connects to a local network with cable or WiFi SSID, first thing is to look for the IP address, netmask, default gateway and DNS servers.

    How does DHCP protocol work?

    1. A host connecting to the network (cable or wireless) sends DHCP to discover message to all hosts in Layer 2 segment (destination address is FF:FF:FF:FF:FF:FF). Frame with this DISCOVER message hits the DHCP Server.
    DHCP Discover packet

    2. After the DHCP Server receives the discover message it suggests the IP addressing offering to the client host by unicast. This OFFER message contains:

    • the proposed IP address for the client (here 192.168.1.10)
    • subnet mask to identify the subnet space (here 255.255.255.0)
    • IP of the default gateway for the subnet (here 192.168.1.1)
    • IP of DNS server for name translations (here 8.8.8.8)
    • Options (read full article)
    DHCP Offer packet

    3. Now after the client receives the offer it requests the information officially sending a REQUEST message to the server this time by unicast.

    DHCP Request packet

    4. Server sends ACKNOWLEDGE message confirming the DHCP lease to client. Now the client is allowed to use new IP settings.

    DHCP Acknowledge packet
    LAN security design

     

    What information getting from DHCP protocol are necessary and which are optional?

    In theory, only an IP address and mask are needed for the device to work. This is true in a scenario the device is within the same subnet as other devices and communicates with others knowing their IP addresses. This way there is no need for going beyond our own subnet and that’s why a gateway is not needed. Using only IP addresses for communication also eliminates the need of name translations so DNS is still optional. However, in real-world scenarios, most of the communication goes beyond the subnet and relies on Fully Qualified Domain Names (FQDN).

    In addition to necessary DHCP parameters, there are DHCP options like popular Option 150 used in IP Telephony to inform IP Phones about the IP address of IP PBX for proper phone registration – for example Cisco Call Manager or Asterisk PBX. Almost all DHCP server vendors are able to pass DHCP options.

    What if DHCP server is not in the same subnet ?

    You can ask yourself if there is a need for having a DHCP server in the same L2 segment (VLAN), because the DHCP OFFER message relies on the broadcast destination address which is good for the same subnet only. Right trace! But for the sake of DHCP scalability there is an option to have a DHCP server outside the subnet. In such solution, DHCP discover packets typically getting to the default gateway interface are transformed into unicast packets (DHCP discover embedded message) with giaddr field that tells the server about logical attachment identification. The packet is sent directly to the IP of the server located somewhere in the routable IP cloud. Giaddr helps the DHCP server to find the correct address pool for granting the address.

    DHCP relay

    Check how to configure DHCP server on network devices.

    Author

    Marcin Bialy

    Marcin Biały is Network and Security Architect with over 14 years of experience, with Service Provider and Enterprise networking background. He used to work for large service providers, global vendors and integration services companies as Network Architect, Leading Architect and Techincal Solution Manager positions. He designed, implemented and supported dozens large scale projects and infrastructure migrations, solved hundreds of tickets and spent hours with CLI and GUI of many flavors. Marcin is also holding industry recognizable certificates such as CCNP, CCNA, CCSI #35269, FCNSP #7207, FCNSA and more.

    4 Comments
    Alok Rawat
    22 April 2019 at 13:44

    Thanks a lot brother !! live long

     
    Harsh
    15 September 2019 at 15:44

    Really good article. Especially, the point you have mentioned about Giaddr.

     
    Ross Flaherty
    15 November 2021 at 12:05

    Awesome blog! Is your theme custom made or did you download it
    from somewhere? A dewsign like yours with a few simple
    tweks would really make my blog stand out. Please let me know where you got your design. Cheers

     
    Joanna Sajkowska
    22 November 2021 at 10:00

    Thanks, Ross. Our design’s custom made.

     

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    Cisco ISR Routers Offer

    Up to 60% discount for Cisco ISR routers portfolio. Get quote for ISR4300 | ISR4400 C1000 | C800

    Get a Quote
    Grandmetric