No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Fat AP and Cloud AP V200R008C00 CLI-based Configuration Guide

Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Understanding DHCP

Understanding DHCP

Typical Networking of DHCP

Figure 7-66 shows the typical DHCP networking.

Figure 7-66  DHCP networking

The following roles are involved on a typical DHCP network:

  • DHCP client: applies for network parameters including IP addresses through DHCP. A DHCP client can be an IP phone, PC, mobile phone, or diskless workstation.

  • DHCP server: allocates network parameters to DHCP clients.

  • (Optional) DHCP relay agent: forwards DHCP messages between a DHCP server and DHCP clients and helps the DHCP server to dynamically allocate network parameters to the DHCP clients.

    When a DHCP client broadcasts DHCP Discovery messages with the destination IP address 255.255.255.255, only the DHCP server on the same network segment as the DHCP client can receive the messages. If a DHCP server is on a different network segment from the DHCP client, a DHCP relay agent must be deployed to forward DHCP Discovery messages to the DHCP server. The DHCP relay agent modifies the format of a DHCP Discovery or Offer message to generate a new DHCP message and then forwards it.

    A DHCP relay agent is required in scenarios where terminals on an enterprise network are located on multiple network segments and need to obtain network parameters through DHCP. This enables the terminals to communicate with one DHCP server, saving server resources and facilitating unified management.

DHCP Server Allocating Network Parameters to New DHCP Clients

This section describes how a DHCP server allocates network parameters to DHCP clients with and without a DHCP relay agent.
Network Parameter Allocation Without a DHCP Relay Agent

When accessing a network for the first time, a DHCP client exchanges DHCP messages with a DHCP server to obtain network parameters, as shown in Figure 7-67.

NOTE:

DHCP messages are transmitted using the User Datagram Protocol (UDP). A DHCP client uses UDP port 68 to send messages to a DHCP server, and a DHCP server uses UDP port 67 to send messages to a DHCP client.

Figure 7-67  DHCP server exchanging messages with a new DHCP client without a DHCP relay agent.

  1. Discovery stage: The DHCP client detects DHCP servers.

    Because the DHCP client does not know the IP addresses of DHCP servers, it broadcasts a DHCP Discover message (with destination IP address 255.255.255.255) to detect DHCP servers. All DHCP servers on the same network segment as the DHCP client can receive the DHCP Discover message. Information carried in a DHCP Discover message includes the client's MAC address (Chaddr field), parameter request list (Option 55 field, indicating the network parameters required by the client), and broadcast flag (Flags field, indicating whether the response should be sent in unicast or broadcast mode).

    • The Options field in a DHCP Discover message defines network parameters that a client requires. Each option identifies a parameter. For example, Option 3 indicates the requested gateway address. (A client adds Option 3 in the Option 55 field when it requests the gateway address.) Option 53 indicates the DHCP message type (such as Discover message). Options are classified into well-known and self-defined options. For more information about well-known DHCP options, see RFC 2132. Vendors can define their own options (for example, Option 43 is defined to indicate vendor-specific information). For details about options, see DHCP Options.

    • The Flags field is defined in RFC 2131. The leftmost bit of this field indicates whether the server is required to unicast or broadcast the DHCP Offer/ACK message. The value 0 indicates unicast, and the value 1 indicates broadcast.

  2. Offer stage: A DHCP server offers network parameters to the DHCP client.

    All DHCP servers on the same network segment as the DHCP client can receive the DHCP Discover message. Each DHCP server may have multiple address pools to manage network parameters including allocatable IP addresses. A DHCP server selects an address pool on the same network segment as the IP address of the interface receiving the DHCP Discover message, and from the address pool selects an idle IP address. The DHCP server then sends a DHCP Offer message carrying the allocated IP address (in the Yiaddr field) to the DHCP client. The DHCP Offer message also carries other network parameters such as the IP address lease.

    In most cases, an address pool specifies the leases of the IP addresses it contains. If the DHCP Discover message carries an expected lease, the DHCP server compares the expected lease with the specified lease and allocates the IP address with the shorter of the two leases to the DHCP client.

    IP addresses in an address pool are added to IP address lists based on their IP address status:
    • Unallocated IP addresses are added to the allocatable IP address list.
    • Allocated IP addresses are added to the in-use IP address list.
    • Conflicting IP addresses are added to the conflicting IP address list.
    • IP addresses that cannot be allocated are added to the unallocatable IP address list.
    The DHCP server selects an IP address for the client from the address pool in the following sequence:
    1. IP address statically bound to the MAC address of the client on the DHCP server
    2. IP address specified in the Option 50 field (requested IP address) in the DHCP Discover message
    3. IP address that has been previously allocated to the client
    4. Randomly selected IP address from the address pool for allocatable IP addresses
    5. If the DHCP server does not find any allocatable IP address, it searches for expired IP addresses and, if none is found, it searches for conflicting IP addresses. If a valid IP address is found, the DHCP server allocates it to the client. Otherwise, the DHCP server replies with a DHCP NAK message to notify the client that no IP address is available. After receiving the DHCP NAK message, the DHCP client sends a DHCP Discover message to apply for a new IP address.

    DHCP servers can exclude certain IP addresses that cannot be allocated through DHCP from address pools. For example, if 192.168.1.100/24 has been manually configured for a DNS server, the DHCP server excludes this IP address from the address pool on network segment 192.168.1.0/24 so that it is not allocated through DHCP. This helps prevent IP address conflicts.

    To prevent a newly allocated IP address from conflicting with IP addresses of other clients on the network, the DHCP server sends an ICMP Echo Request packet before sending a DHCP Offer message. The DHCP server uses this packet to check whether the IP address to be allocated conflicts with other clients' IP addresses. The source and destination IP addresses of the ICMP Echo Request packet are the DHCP server's IP address and the IP address to be allocated, respectively. If the DHCP server receives no ICMP Echo Reply packet within the detection period, no client is using this IP address, and the DHCP server can allocate it. If the DHCP server receives an ICMP Echo Reply packet within the detection period, this IP address is in use by another client, and the DHCP server lists this IP address as a conflicting IP address. The DHCP server then waits for the next DHCP Discover message to start the IP address selection process again.

    NOTE:

    The IP address allocated in this stage may not be the final IP address used by the client. This is because the IP address may be allocated to another client if the DHCP server receives no response 16 seconds after the DHCP Offer message is sent. The IP address for the client can be determined only after the request and acknowledgment stages.

  3. Request stage: The DHCP client selects an IP address.

    The client broadcasts a DHCP Discover message to all DHCP servers on the local network segment. If multiple DHCP servers reply with a DHCP Offer message to the DHCP client, the client accepts only the first received DHCP Offer message.

    The client then broadcasts a DHCP Request message carrying the selected DHCP server identifier (Option 54) and IP address (Option 50, with the IP address specified in the Yiaddr field of the accepted DHCP Offer message).

    The DHCP Request message notifies all the DHCP servers of the IP address that the DHCP client has selected. The unselected IP addresses from other servers are then free to be allocated to other clients.

  4. Acknowledgment stage: The DHCP server acknowledges the IP address offered to the client.

    After receiving the DHCP Request message, the DHCP server sends a DHCP ACK message to the client, carrying the IP address specified in the Option 50 field of the Request message.

    After receiving the DHCP ACK message, the DHCP client broadcasts gratuitous ARP packets to check whether any other terminal is using the IP address allocated by the DHCP server.

    If no response is received within the specified time, the DHCP client can use the IP address. However, if the DHCP client receives a response within the specified time, this IP address is in use by another terminal. In this case, the client then sends a DHCP Decline message to the DHCP server and applies for a new IP address. The DHCP server lists this IP address as a conflicting IP address. A conflicting IP address is allocated only when there is no idle IP address in the address pools, minimizing IP address conflicts.

    Occasionally, the DHCP server may fail to allocate the IP address specified in the Option 50 field because, for example, an error occurs during negotiation or it takes a long time to receive the DHCP Request message. In this case, the DHCP server replies with a DHCP NAK message to notify the DHCP client that the requested IP address cannot be allocated. The DHCP client then sends a DHCP Discover message to apply for a new IP address.

Network Parameter Allocation with DHCP Relay Agents

After a DHCP client connects to the network for the first time, the client exchanges DHCP messages with a DHCP relay agent and DHCP server to obtain network parameters, as shown in Figure 7-68. The interaction between the DHCP client and server is similar to that described in Network Parameter Allocation Without a DHCP Relay Agent. The following describes the working mechanism of the DHCP relay agent.

Figure 7-68  Message exchange among a new DHCP client, DHCP server, and DHCP relay agent

  1. Discovery stage

    When receiving a DHCP Discover message broadcast by a DHCP client, the DHCP relay agent performs the following steps:
    1. Checks the value of the Hops field. If this value exceeds 16, the DHCP relay agent discards the message. Otherwise, the DHCP relay agent increases this value by 1 and proceeds to the next step.

      The Hops field indicates the number of DHCP relay agents that a DHCP message has passed through. This field is set to 0 by a DHCP client or server. Its value is incremented by 1 each time the message passes through a DHCP relay agent. This field limits the number of DHCP relay agents that a DHCP message can pass through. A maximum of 16 DHCP relay agents are allowed between a DHCP client and server.

    2. Checks the value of the Giaddr field. If this value is 0, the DHCP relay agent sets the Giaddr field to the IP address of the interface receiving the DHCP Discover message. Otherwise, the DHCP relay agent does not change the field and proceeds to the next step.

      The Giaddr field indicates the gateway IP address. If the DHCP server and client are located on different network segments, the first DHCP relay agent fills its own IP address in this field and forwards the message to the DHCP server. Other DHCP relay agents on the path forward the message without changing this field. The DHCP server determines on which network segment the client resides based on the Giaddr field, and allocates an IP address on this network segment to the client.

    3. Changes the destination IP address of the DHCP Discover message to the IP address of the DHCP server or the next-hop DHCP relay agent, and changes the source IP address to the IP address of the interface connecting the DHCP relay agent to the client. The message is then unicast to the DHCP server or the next-hop DHCP relay agent.

    If there are multiple DHCP relay agents between the DHCP client and server, each the DHCP relay agent processes the DHCP Discover message using the same method.

  2. Offer stage

    After receiving the DHCP Discover message, the DHCP server selects an address pool on the same network segment as that specified in the Giaddr field and allocates an IP address and other network parameters from the address pool. The sequence in which an IP address is selected is the same as that described in Network Parameter Allocation Without a DHCP Relay Agent. The DHCP server then unicasts a DHCP Offer message to the DHCP relay agent specified in the Giaddr field.

    When receiving the DHCP Offer message, the DHCP relay agent performs the following steps:
    • Checks the value of the Giaddr field. If this value is the IP address of the interface receiving the DHCP Offer message, the DHCP relay agent discards the message. Otherwise, the DHCP relay agent proceeds to the next step.

    • Checks the value of the Flags field. If this value is 1, the DHCP relay agent broadcasts a DHCP Offer message to the DHCP client. Otherwise, the DHCP relay agent unicasts a DHCP Offer message.
  3. Request stage

    The DHCP relay agent processes the DHCP Request message from the client using the same method described in the Discovery stage.

  4. Acknowledgment stage

    The DHCP relay agent processes the DHCP ACK message from the server using the same method described in the Offer stage.

DHCP Client Reuse of an IP Address

If a DHCP client reconnects to a network, it may be able to reuse an IP address that has been previously allocated to it. If a DHCP relay agent is deployed, the DHCP relay agent processes DHCP messages. For more details, see DHCP Server Allocating Network Parameters to New DHCP Clients.

Not all clients can reuse IP addresses that have been allocated to them. Figure 7-69 uses a PC as the DHCP client to describe how the DHCP client reuses an IP address.

The DHCP client exchanges DHCP messages with a DHCP server to obtain the network parameters, including the IP address that has been allocated to it.

Figure 7-69  Message exchange for IP address reuse between a DHCP client and server

  1. The DHCP client broadcasts a DHCP Request message carrying the IP address that the client has previously used. The requested IP address is added in the Option 50 field.

  2. After receiving the DHCP Request message, the DHCP server checks whether there is a lease record based on the MAC address in the message. If there is a lease record matching the MAC address, the DHCP server replies with a DHCP ACK message to notify the DHCP client that the requested IP address can be used. Otherwise, the DHCP server performs no operation and waits for a new DHCP Discover message from the client.

DHCP Client Renewal of Its IP Address Lease

IP addresses that are dynamically allocated by a DHCP server have leases. A DHCP Discover message from a DHCP client can carry an expected lease. When allocating network parameters, the DHCP server compares the expected lease with the specified lease in the address pool and allocates an IP address with the shorter of the two leases to the DHCP client. When the lease expires or the client goes offline, the DHCP server reclaims the IP address, which can then be allocated to other clients. This mechanism improves IP address utilization.

To continue to use this IP address, the DHCP client must renew its IP address lease.

The following describes how a DHCP client renews its IP address lease with and without a DHCP relay agent.
IP Address Lease Renewal Without a DHCP Relay Agent

Figure 7-70 shows how a DHCP client renews its IP address lease.

Figure 7-70  Renewing an IP address lease

  1. When the lease reaches 50% (T1) of its validity period, the DHCP client unicasts a DHCP Request message to the DHCP server to request lease renewal. If the DHCP client receives a DHCP ACK message, the IP address lease is successfully renewed (counted from 0). If the DHCP client receives a DHCP NAK message, the DHCP client must send a DHCP Discover message to apply for a new IP address.
  2. If no response is received from the DHCP server when the lease reaches 87.5% (T2) of its validity period, the DHCP client broadcasts a DHCP Request message to request lease renewal. If the DHCP client receives a DHCP ACK message, the IP address lease is successfully renewed (counted from 0). If the DHCP client receives a DHCP NAK message, the DHCP client must send a DHCP Discover message to apply for a new IP address.
  3. If no response is received when the lease expires, the DHCP client stops using the IP address and sends a DHCP Discover message to apply for a new IP address.

When a DHCP client no longer needs to use the allocated IP address and the lease has not expired, the DHCP client sends a DHCP Release message to the DHCP server to request IP address release. The DHCP server saves the configuration of this DHCP client and records the IP address in the allocated IP address list. The IP address can then be allocated to this DHCP client or other clients.

To request a configuration update, a DHCP client can send a DHCP Inform message to the DHCP server.

IP Address Lease Renewal with DHCP Relay Agents

Figure 7-71 shows how a DHCP client renews its IP address lease with a DHCP relay agent deployed.

Figure 7-71  Renewing the IP address lease when a DHCP relay agent is deployed

  1. When the lease reaches 50% (T1) of its validity period, the DHCP client unicasts a DHCP Request message to the DHCP server to request lease renewal. If the DHCP client receives a DHCP ACK message, the IP address lease is successfully renewed (counted from 0). If the DHCP client receives a DHCP NAK message, the DHCP client must send a DHCP Discover message to apply for a new IP address.
  2. If no response is received from the DHCP server when the lease reaches 87.5% (T2) of its validity period, the DHCP client broadcasts a DHCP Request message to request lease renewal. The DHCP relay agent then unicasts a DHCP Request message to the DHCP server. For details about how the DHCP relay agent processes received messages, see DHCP Server Allocating Network Parameters to New DHCP Clients. If the DHCP client receives a DHCP ACK message, the IP address lease is successfully renewed (counted from 0). If the DHCP client receives a DHCP NAK message, the DHCP client must send a DHCP Discover message to apply for a new IP address.
  3. If no response is received when the lease expires, the DHCP client stops using the IP address and sends a DHCP Discover message to apply for a new IP address.

Translation
Download
Updated: 2019-01-11

Document ID: EDOC1000176006

Views: 129844

Downloads: 312

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next