As we need a phone number to make a call to someone, we need an address to communicate with a network host over the Internet. This address is called an "Internet Protocol (IP) address". Generally, IP addresses are dynamically allocated to clients accessing the Internet, through Dynamic Host Configuration Protocol (DHCP), a protocol designed for dynamic allocation of IP addresses, as defined in RFC 2131.
DHCP adopts the concept of a “lease” in IP allocation. This means, a DHCP server does not allocate an IP address to a client permanently. What it does instead is set a “lease duration” and allow the client to use the allocated IP address only during the set lease duration. If the client wishes to use the allocated IP address for longer than the lease duration, it should request the DHCP server for renewal of the lease. If not, it performs an IP address release procedure instead.
Now, we will look at the IP address allocation procedure that describes how a DHCP client gets an IP address allocated by a DHCP server.
A DHCP message used for the IP address allocation/lease consists of four message flows as shown in the following figure:
1) DHCP Discover
- Message direction: DHCP Client -> DHCP Server
- Broadcast message (Destination MAC = FF:FF:FF:FF:FF:FF)
- What it is and what it does: This is a message sent by a DHCP client looking for a DHCP server. The client broadcasts this message on the LAN (same subnet), actually saying “Any DHCP server available out there? Answer me if you hear me!”.
- Key parameter:
- Client MAC: Client MAC address
2) DHCP Offer
- Message direction: DHCP Server -> DHCP Client
- Can be a broadcast-type or unicast-type message, depending on the Broadcast Flag value in the DHCP Discover message sent by the DHCP client. The DHCP server sends a broadcast-type DHCP Offer message if the broadcast flag value is 1, but a unicast-type message if it is 0.
- What it is and what it does: This is the DHCP server's response to the DHCP client's call, saying “I can hear you!”. With this message, the DHCP server not only announces the presence of itself, but also provides the DHCP client with all the network configuration data including an IP address to be allocated to the DHCP client.
- Key parameters:
- Client MAC: Client MAC address
- Your IP: IP address to be allocated/leased to the client
- Subnet Mask (option 1)
- Router (option 3): Client default gateway IP address
- DNS (option 6): DNS server IP address
- IP Lease Time (option 51): the time/period for which the client is permitted to use/lease the allocated IP address (Your IP)
- DHCP Server Identifier (option 54): the IP address of the DHCP server that sent this DHCP Offer message. Occasionally, multiple DHCP servers may send the same DHCP Offer message, so each server includes its own IP address in this field before sending the message to the client.
3) DHCP Request
- Message direction: DHCP Client -> DHCP Server
- Broadcast message (Destination MAC = FF:FF:FF:FF:FF:FF)
- What it is and what it does: The client recognized the presence of DHCP server(s) and acquired the network configuration data (client IP address, subnet mask, default gateway IP address, etc.) from the DHCP servers. Now, the client selects one of them and then sends a DHCP Request message asking for the network configuration data to be used by the client.
- Key parameters:
- Client MAC: Client MAC address
- Requested IP Address (option 50): An IP address that the client claimed saying "I will use this IP address." ("Your IP address" in the DHCP Offer message is used in this field)
- DHCP Server Identifier (option 54): In case more than one DHCP server sends a DHCP Offer message, the client selects one of the servers to access and has the IP address of the selected server entered in this field. In other words, the client sends a DHCP Request message to the DHCP server of which ID address is defined in the DHCP Server Identifier field, and then obtains the network configuration data, including an IP address, from the server.
4) DHCP Ack
- Message direction: DHCP Server -> DHCP Client
- Can be a broadcast-type message (Destination MAC = FF:FF:FF:FF:FF:FF) or unicast-type message, depending on the broadcast flag value in the DHCP Discover message sent by the DHCP client. The DHCP server sends a broadcast-type DHCP Offer message if the broadcast flag value is 1, but a unicast-type message if it is 0.
- What it is and what it does: The last message sent in the DHCP procedure. With this message, the DHCP server delivers the network configuration data to the DHCP client. This message includes the same network parameters contained in the network configuration data of the DHCP Offer message discussed above.
- Key parameters:
- Client MAC: Client MAC address
- Your IP: IP address to be allocated/leased to the client
- Subnet mask (option 1)
- Router (option 3): Client default gateway IP address
- DNS (option 6): DNS server IP address
- IP Lease Time (option 51): the time/period for which the client is permitted to use/lease the allocated IP address (Your IP)
- DHCP Server Identifier (option 54): the IP address of the DHCP server that sent this DHCP Ack message.
Now, the client, having exchanged all the messages including the last DHCP Ack, has obtained/leased the network configuration data, including an IP address, and thus is ready to use the Internet.
please update dhcp negative acknowledgement,dhcp inform and dhcp decline messages
please update remaining dhcp messages also
what a nice document