• HWIKI

    Build. Break. Explain.

    Understand DHCP

    What is DHCP?

    The Dynamic Host Configuration Protocol (DHCP) is a network protocol used to automatically assign IP addresses and other network configuration parameters to devices on a network. This simplifies IP address management and enables devices to connect to a network without manual intervention.

    How does DHCP work?

    The DHCP process is based on an exchange of messages between the DHCP client (the device that wishes to obtain an IP address) and the DHCP server (which assigns the IP address). This process is often referred to as the DORA cycle:

    1. D -> Discover: The client sends a discovery message (DHCPDISCOVER) to search for available DHCP servers.
    2. O -> Offer: DHCP servers respond with an offer (DHCPOFFER), containing an available IP address and other configuration information.
    3. R -> Request: The customer chooses one of the offers received and sends a request (DHCPREQUEST) to accept the offer.
    4. A -> Ack: The DHCP server confirms the customer's request with an acknowledgement (DHCPACK), finalizing the assignment of the IP address.

    Schematic of DHCP DORA process

    Schematic of DHCP DORA process showing message exchanges between client and server

    Unicast : Unicast refers to the transmission of data from a single sender to a single receiver. In this mode of communication, information is sent specifically to a unique address, ensuring that only the designated recipient receives the message.

    Broadcast : Broadcast, on the other hand, refers to the transmission of data from one sender to all receivers on a network. In this mode, the message is sent to all addresses on a local network, enabling every connected device to receive the message.

    Frame capture

    Discover

    Src MAC Addr Dst MAC Addr Src IP Addr Dst IP Addr Src Port Dst Port
    AA:AA:AA:AA:AA:AA FF:FF:FF:FF:FF:FF 0.0.0.0 255.255.255.255 UDP67 UDP68

    Offer

    Src MAC Addr Dst MAC Addr Src IP Addr Dst IP Addr Src Port Dst Port
    BB:BB:BB:BB:BB:BB AA:AA:AA:AA:AA:AA 192.168.10.254 0.0.0.0 UDP68 UDP67

    Request

    Src MAC Addr Dst MAC Addr Src IP Addr Dst IP Addr Src Port Dst Port
    AA:AA:AA:AA:AA:AA FF:FF:FF:FF:FF:FF 0.0.0.0 255.255.255.255 UDP67 UDP68

    Acknowlege

    Src MAC Addr Dst MAC Addr Src IP Addr Dst IP Addr Src Port Dst Port
    BB:BB:BB:BB:BB:BB AA:AA:AA:AA:AA:AA 192.168.10.254 192.168.10.1 UDP68 UDP67

    Conclusion

    DHCP is an essential protocol for managing IP addresses in a network. With the DORA process, customers can automatically obtain an IP address and other configuration parameters, simplifying network connectivity.