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

CX11x, CX31x, CX710 (Earlier Than V6.03), and CX91x Series Switch Modules V100R001C10 Configuration Guide 12

The documents describe the configuration of various services supported by the CX11x&CX31x&CX91x series switch modules The description covers configuration examples and function configurations.
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).
Principles

Principles

This section describes the implementation of DHCP.

DHCP Overview

DHCP uses the client/server model. A DHCP client sends a packet to a DHCP server to request configuration parameters such as the IP address, subnet mask, and default gateway address. The DHCP server responds with a packet carrying the requested configurations based on a policy.

DHCP Architecture

Figure 6-23 shows the DHCP architecture.

Figure 6-23 DHCP architecture

DHCP involves the following roles:

  • DHCP Client

    A DHCP client exchanges messages with a DHCP server to obtain an IP address and other configuration parameters. On the device, an interface can function as a DHCP client to dynamically obtain configuration parameters such as an IP address from a DHCP server. This facilitates configurations and centralized management.

  • DHCP Relay

    A DHCP relay agent forwards DHCP packets exchanged between a DHCP client and a DHCP server that are located on different network segments so that they can complete their address configuration. Using a DHCP relay agent eliminates the need for deploying a DHCP server on each network segment. This feature reduces network deployment costs and facilitates device management.

    In the DHCP architecture, the DHCP relay agent is optional. A DHCP relay agent is required only when the server and client are located on different network segments.

  • DHCP Server

    A DHCP server processes requests of address allocation, address lease extending, and address releasing from a DHCP client or a DHCP relay agent, and allocates IP addresses and other network configuration parameters to the DHCP client.

Introduction to DHCP Messages

DHCP Message Format

Figure 6-24 shows the format of a DHCP message.

Figure 6-24 Format of a DHCP message

In Figure 6-24, numbers in the round brackets indicate the field length, expressed in bytes.

Table 6-7 Description of each field in a DHCP message

Field

Length

Description

op(op code)

1 byte

Indicates the message type. The options are as follows:
  • 1: DHCP Request message

  • 2: DHCP Reply message

htype (hardware type)

1 byte

Indicates the hardware address type. For Ethernet, the value of this field is 1.

hlen (hardware length)

1 byte

Indicates the length of a hardware address, expressed in bytes. For Ethernet, the value of this field is 6.

hops

1 byte

Indicates the number of DHCP relay agents that a DHCP Request message passes through. This field is set to 0 by a DHCP client or a DHCP server. The value increases by 1 each time a DHCP Request message passes through a DHCP relay agent. This field limits the number of DHCP relay agents that a DHCP message can pass through.
NOTE:

A maximum of 16 DHCP relay agents are allowed between a server and a client. That is, the number of hops must be smaller than or equal to 16. Otherwise, DHCP messages are discarded.

xid

4 bytes

Indicates a random number chosen by a DHCP client. It is used by the DHCP client and DHCP server to exchange messages.

secs (seconds)

2 bytes

Indicates the time elapsed since the client obtained or renewed an IP address, in seconds.

flags

2 bytes

Indicates the Flags field. Only the leftmost bit of the Flags field is valid and other bits are set to 0. The leftmost bit determines whether the DHCP server unicasts or broadcasts a DHCP Reply message. The options are as follows:
  • 0: The DHCP server unicasts a DHCP Reply message.

  • 1: The DHCP server broadcasts a DHCP Reply message.

ciaddr (client ip address)

4 bytes

Indicates the IP address of a client. The IP address can be an existing IP address of a DHCP client or an IP address assigned by a DHCP server to a DHCP client. During initialization, the client has no IP address and the value of this field is 0.0.0.0.
NOTE:

The IP address 0.0.0.0 is used only for temporary communication during system startup in DHCP mode. It is an invalid address.

yiaddr (your client ip address)

4 bytes

Indicates the DHCP client IP address assigned by the DHCP server. The DHCP server fills this field into a DHCP Reply message.

siaddr (server ip address)

4 bytes

Server IP address from which a DHCP client obtains the startup configuration file.

giaddr (gateway ip address)

4 bytes

Indicates the IP address of the first DHCP relay agent. If the DHCP server and client are located on different network segments, the first DHCP relay agent fills its IP address into this field of the DHCP Request message sent by the client and forwards the message to the DHCP server. The DHCP server determines the network segment where the client resides based on this field, and assigns an IP address on this network segment from an address pool.

The DHCP server also returns a DHCP Reply message to the first DHCP relay agent. The DHCP relay agent then forwards the DHCP Reply message to the client.
NOTE:

If the DHCP Request message passes through multiple DHCP Relay agents before reaching the DHCP server, the value of this field is the IP address of the first DHCP relay agent and remains unchanged. However, the value of the Hops field increases by 1 each time a DHCP Request message passes through a DHCP relay agent.

chaddr (client hardware address)

16 bytes

Indicates the client MAC address. This field must be consistent with the hardware type and hardware length fields. When sending a DHCP Request message, the client fills its hardware address into this field. For Ethernet, a 6-byte Ethernet MAC address must be filled in this field when the hardware type and hardware length fields are set to 1 and 6 respectively.

sname (server host name)

64 bytes

Indicates the name of the server from which a client obtains configuration parameters. This field is optional and is filled in by the DHCP server. The field must be filled in with a character string that ends with 0.

file (file name)

128 bytes

Indicates the Bootfile name specified by the DHCP server for a DHCP client. This field is filled in by the DHCP server and is delivered to the client when the IP address is assigned to the client. This field is optional. The field must be filled in with a character string that ends with 0.

options

Variable

Indicates the DHCP Options field, which has a maximum of 312 bytes. This field contains the DHCP message type and configuration parameters assigned by a server to a client, including the gateway IP address, DNS server IP address, and IP address lease.

For details about the Options field, see DHCP Options.

DHCP Message Types

DHCP messages are classified into eight types. A DHCP server and a DHCP client communicate by exchanging DHCP messages.

Table 6-8 DHCP message types
Message Name Description

DHCP DISCOVER

A DHCP Discover message is broadcast by a DHCP client to locate a DHCP server when the client attempts to connect to a network for the first time.

DHCP OFFER

A DHCP Offer message is sent by a DHCP server to respond to a DHCP Discover message. A DHCP Offer message carries various configuration information.

DHCP REQUEST

A DHCP Request message is sent in the following conditions:

  • After a DHCP client is initialized, it broadcasts a DHCP Request message to respond to the DHCP Offer message sent by a DHCP server.
  • After a DHCP client restarts, it broadcasts a DHCP Request message to confirm the configuration including the assigned IP address.
  • After a DHCP client obtains an IP address, it unicasts or broadcasts a DHCP Request message to update the IP address lease.

DHCP ACK

A DHCP ACK message is sent by a DHCP server to acknowledge the DHCP Request message from a DHCP client. After receiving a DHCP ACK message, the DHCP client obtains the configuration parameters including the IP address.

DHCP NAK

A DHCP NAK message is sent by a DHCP server to reject the DHCP Request message from a DHCP client. For example, after a DHCP server receives a DHCP Request message, it cannot find matching lease records. Then the DHCP server sends a DHCP NAK message, notifying that no IP address is available for the DHCP client.

DHCP DECLINE

A DHCP Decline message is sent by a DHCP client to notify the DHCP server that the assigned IP address conflicts with another IP address. Then the DHCP client applies to the DHCP server for another IP address.

DHCP RELEASE

A DHCP Release message is sent by a DHCP client to release its IP address. After receiving a DHCP Release message, the DHCP server can assign this IP address to another DHCP client.

DHCP INFORM

A DHCP Inform message is sent by a DHCP client to obtain other network configuration parameters such as the gateway address and DNS server address after the DHCP client has obtained an IP address.

DHCP Options

Options Field in a DHCP Packet

The Options field in a DHCP packet carries control information and parameters that are not defined in common protocols. When a DHCP client requests an IP address from the DHCP server configured with the Options field, the server replies a packet containing the Options field. Figure 6-25 shows the format of the Options field.

Figure 6-25 Format of the Options field

The Options field consists of Type, Length, and Value. The following table provides the details.

Table 6-9 Description of the Options field

Field

Length

Description

Type

1 byte

Indicates the type of the message content.

Length

1 byte

Indicates the length of the message content.

Value

Depending on the setting of the Length field

Indicates the message content.

The value of the Options field ranges from 1 to 255. Table 6-10 lists common DHCP options.

Table 6-10 Description of the Options field in DHCP packets

Options No.

Function

1

Specifies the subnet mask.

3

Specifies the gateway address.

6

Specifies the DNS server IP address.

12

Specifies the hostname.

15

Specifies the domain name.

33

Specifies a group of classful static routes. This option contains a group of classful static routes. When a DHCP client receives DHCP packets with this option, it adds the classful static routes contained in the option to its routing table. In classful routes, masks of destination addresses are natural masks and masks cannot be used to divide subnets. If Option 121 exists, this option is ignored.

44

Specifies the NetBIOS name.

46

Specifies the NetBIOS object type.

50

Specifies the requested IP address.

51

Specifies the IP address lease.

52

Specifies the additional option.

53

Specifies the DHCP packet type.

54

Specifies the server identifier.

55

Specifies the parameter request list. It is used by a DHCP client to request specified configuration parameters.

58

Specifies the lease renewal time (T1), which is 50% of the lease time.

59

Specifies the lease renewal time (T2), which is 87.5% of the lease time.

60

Specifies the vendor classification information option, which identifies the DHCP client type and configuration.

61

Specifies Client identifier.

66

Specifies the TFTP server name allocated to DHCP clients.

67

Specifies the Bootfile name allocated to DHCP clients.

77

Specifies the user type.

121

Specifies a group of classless routes. This option contains a group of classless static routes. After a DHCP client receives DHCP packets with this option, it adds the classless static routes contained in the option to its routing table. Classless routes are routes of which masks of destination addresses can be any values and masks can be used to divide subnets.

The objects of this field vary with the functions of the Options field. For example, Option 77 is used on a DHCP client to identify user types of the DHCP client. The DHCP server selects an address pool to allocate an IP address and configuration parameters to the DHCP client based on the User Class in the Option field. Option 77 is manually configured only on the DHCP client but not on the server.

For more information about common DHCP options, see RFC 2132.

Customized DHCP Options

Some options are not defined in RFC 2132. Customized options Option 82 are described as follows:

The Option 82 field is called the DHCP relay agent information field. It records the location of a DHCP client. A DHCP relay agent or a device enabled with DHCP snooping appends the Option 82 field to a DHCP Request message sent from a DHCP client, and then forwards the DHCP Request message to a DHCP server.

You can use the Option 82 field to locate a DHCP client and implement control security and accounting of the DHCP client. The DHCP server that supports the Option 82 field can determine allocation of IP addresses and other parameters according to the information in the Option 82 field. IP addresses can be assigned flexibly.

The Option 82 field contains a maximum of 255 suboptions. If the Option 82 field is defined, at least one suboption must be defined. Currently, the device supports only two suboptions: sub-option 1 (circuit ID) and suboption 2 (remote ID).

The content of the Option 82 field is not defined uniformly, and various vendors fill in the Option 82 field as required.

DHCP Principles

Modes for Interaction Between the DHCP Client and Server

To obtain a valid dynamic IP address, a DHCP client exchanges different messages with the server at different stages. Generally, the DHCP client and server interact in the following modes.

  • The DHCP client dynamically obtains an IP address.

    Figure 6-26 Procedure for a DHCP client to dynamically obtain an IP address

    As shown in Figure 6-26, when a DHCP client accesses the network for the first time, the DHCP client sets up a connection with a DHCP server through the following four stages.

    • Discovery stage: The DHCP client searches for the DHCP server.

      In this stage, the DHCP client sends a DHCP Discover message to search for the DHCP server. The DHCP server address is unknown to the client, so the DHCP client broadcasts the DHCP Discover message. All the DHCP servers send Reply messages after they receive the Discover message. In this way, the DHCP client knows locations of the DHCP servers on the network.

    • Offer stage: The DHCP server offers an IP address to the DHCP client.

      The DHCP server receives the DHCP Discover message, selects an IP address from the address pool, and sends a DHCP Offer message to the DHCP client. The Offer message carries information such as the IP address, lease of the IP address, gateway address, and DNS server address.

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

      If multiple DHCP servers send DHCP Offer messages to the DHCP client, the client receives the first DHCP Offer message. Then the client broadcasts a DHCP Request message including the information about the DHCP server address (Option 54 field).

      The client broadcasts a DHCP Request message to notify all the DHCP servers that the client uses the IP address provided by the DHCP server in the Option 54 field and that all the other servers can use the assigned IP addresses.

    • Acknowledgment stage: The DHCP server acknowledges the IP address that is offered.

      When the DHCP server receives the DHCP Request message from the DHCP client, the server searches the lease record based on the MAC address in the Request message. If there is the IP address record, the server sends a DHCP ACK message to the client, carrying the IP address and other configurations. After receiving the DHCP ACK message, the DHCP client broadcasts gratuitous ARP packets to detect whether any host is using the IP address assigned by the DHCP server. If no response is received within the specified time, the DHCP client uses the IP address.

      If there is no IP address record or the server cannot assign IP addresses, the server sends a DHCP NAK message to notify the DHCP client that the server cannot assign IP addresses. The DHCP client needs to send a new DHCP Discover message to request a new IP address.

      After obtaining the IP address, the DHCP client checks the status of the gateway in use before the client goes online. If the gateway address is incorrect or the gateway device fails, the DHCP client requests a new IP address using the four modes for interaction.

  • The DHCP client uses the assigned IP address.

    Figure 6-27 Procedure for the DHCP client to use the assigned IP address

    As shown in Figure 6-27, when the DHCP client accesses a network for the second time, it set ups a connection with the DHCP server in the following procedure.

    • The client accesses a network for the second time with the IP address that does not expire. The client does not need to send a DHCP Discover message again. It directly sends a DHCP Request message carrying the IP address assigned in the first time, namely, the Option 50 field in the message.

    • After receiving the DHCP Request message, if the requested IP address is not assigned to another DHCP client, the DHCP server sends a DHCP ACK message to instruct the DHCP client to use the IP address again.

    • If the IP address cannot be assigned to the DHCP client, for example, it has been assigned to another DHCP client, the DHCP server sends a DHCP NAK message to the DHCP client. After receiving the DHCP NAK message, the DHCP client sends a DHCP Discover message to request a new IP address.

  • The DHCP client renews the IP address lease.

    An expected lease can be contained in the DHCP Request message sent to the server for an IP address. The server compares the expected lease with the lease in the address pool and assigns a shorter lease to the client.

    The IP address dynamically assigned to the DHCP client usually has a validity period. The DHCP server withdraws the IP address after the validity period expires. To keep using the IP address, the DHCP client needs to renew the IP address lease.

    When obtaining an IP address, the DHCP client enters the binding state. The client is configured with three timers to control lease renewal, rebinding, and lease expiration respectively. When assigning an IP address to the DHCP client, the DHCP server also specifies values for the timers. If the server does not specify values for the timers, the client uses the default values. Table 6-11 lists the default timer values.

    Table 6-11 Default values of timers

    Timer

    Default Value

    Lease renewal

    50% of the lease

    Rebinding

    87.5% of the lease

    Lease expiration

    Overall lease

    Figure 6-28 Procedure for a DHCP client to renew the IP address lease

    As shown in Figure 6-28, when the DHCP client renews the IP address lease, it set ups a connection with the DHCP server in the following procedures:

    • When 50% of the IP address lease (T1) has passed, the DHCP client unicasts a DHCP Request message to the DHCP server to renew the lease. If the client receives a DHCP ACK message, the address lease is successfully renewed. If the client receives a DHCP NAK message, it sends a request again.
    • When 87.5% of the IP address lease (T2) has passed and the client has not received the Reply message, the DHCP client automatically sends a broadcast message to the DHCP server to renew the IP address lease. If the client receives a DHCP ACK message, the address lease is successfully renewed. If the client receives a DHCP NAK message, it sends a request again.
    • If the client has not received a Reply message from the server when the IP address lease expires, the client must stop using the current IP address and send a DHCP Discover message to request a new IP address.
  • The DHCP client releases an IP address.

    When the DHCP client does not use the assigned IP address, it sends a DHCP Release message to notify the DHCP server of releasing the IP address. The DHCP server retains the DHCP client configurations so that the configurations can be used when the client requests an address again.

DHCP Relay Principles

The DHCP relay function enables message exchanges between a DHCP server and a client on different network segments. When the DHCP client and server are on different network segments, the DHCP relay agent transparently transmits DHCP messages to the destination DHCP server. In this way, DHCP clients on different network segments can communicate with one DHCP server.

Figure 6-29 shows how a DHCP client uses the DHCP relay agent to apply for an IP address for the first time.
Figure 6-29 Working process of a DHCP relay agent

Figure 6-29 shows the working process of a DHCP relay agent. The DHCP client sends a Request message to the DHCP server. When receiving the message, the DHCP relay agent processes and unicasts the message to the specified DHCP server on the other network segment. The DHCP server sends requested configurations to the client through the DHCP relay agent based on information in the Request message.

  1. After receiving a DHCP Discover message or a Request message, the DHCP relay agent performs the following operations:
    • Discards DHCP Request messages whose number of hops is larger than the hop limit to prevent loops. Or, increases the value of the hop by 1, indicating that the message passes through a DHCP relay agent.
    • Checks the giaddr field. If the value is 0, set the value of the giaddr field to the IP address of the interface which receives the Request message. Selects one IP address if the interface has multiple IP addresses. All the Request messages received by the interface later use this IP address to fill the giaddr field. If the value is not 0, do not change the value.
    • Sets the TTL in the request packets to the default value 255 in the DHCP relay device, not the value calculated by decreasing the original TTL by 1. You can change the value of the hops field to prevent loops and limit hops.
    • Changes the destination IP address of the DHCP Request message to the IP address of the DHCP server or the IP address of the next DHCP relay agent. In this way, the DHCP Request message can be forwarded to the DHCP server or the next DHCP relay agent.
  2. The DHCP server assigns IP addresses to the client based on the Relay Agent IP Address field and sends the DHCP Reply message to the DHCP relay agent specified in the Relay Agent IP Address field. After receiving the DHCP Reply message, the DHCP relay agent performs the following operations:
    • The DHCP relay agent assumes that all the Reply messages are sent to the directly-connected DHCP clients. The Relay Agent IP Address field identifies the interface directly connected to the client. If the value of the Relay Agent IP Address field is not the IP address of a local interface, the DHCP relay agent discards the Reply message.
    • The DHCP relay agent checks the broadcast flag bit of the message. If the broadcast flag bit is 1, the DHCP relay agent broadcasts the DHCP Reply message to the DHCP client; otherwise, the DHCP relay agent unicasts the DHCP Reply message to the DHCP client. The destination IP address is the value in the Your (Client) IP Address field, and the MAC address is the value in the Client Hardware Address field.

Figure 6-30 shows how a DHCP client extends the IP address lease through the DHCP relay agent.

Figure 6-30 Extending the IP address lease through the DHCP relay agent

  1. After accessing the network for the first time, the DHCP client only needs to unicast a DHCP Request message to the DHCP server that assigned its currently-used IP address.
  2. The DHCP server then directly unicasts a DHCP ACK message or a DHCP NAK message to the client.
DHCP Releasing

The DHCP relay agent, instead of the client, can send a Release message to the DHCP server to release the IP addresses that assigned to the DHCP clients. You can configure a command on the DHCP relay agent to release the IP addresses that the DHCP server assigns to the DHCP client.

IP Address Assignment and Renewal

IP Address Assignment Sequence

The DHCP server assigns IP addresses to a client in the following sequence:

  • IP address that is in the database of the DHCP server and is statically bound to the MAC address of the client
  • IP address that has been assigned to the client before, that is, IP address in the Requested IP Addr Option of the DHCP Discover message sent by the client
  • IP address that is first found when the DHCP server searches the DHCP address pool for available IP addresses
  • If the DHCP address pool has no available IP address, the DHCP server searches the expired IP addresses and conflicting IP addresses, and then assigns a valid IP address to the client. If all the IP addresses are in use, an error is reported.
Method of Preventing Repeated IP Address Assignment

Before assigning an IP address to a client, the DHCP server needs to ping the IP address to avoid address conflicts.

By using the ping command, you can check whether a response to the ping packet is received within the specified period. If no response to the ping packet is received, the DHCP server keeps sending ping packets to the IP address to be assigned until the number of the sent ping packets reaches the maximum value. If there is still no response, this IP address is not in use, and the DHCP server assigns the IP address to a client. (This is implemented based on RFC 2132.)

IP Address Reservation

DHCP supports IP address reservation for clients. The reserved IP addresses can be those in the address pool or not. If an address in the address pool is reserved, it is no longer assignable. Addresses are usually reserved for DNS servers.

Method of IP Address Releasing and Lease Renewal on the PCs

The PCs (DHCP clients) must release the original IP addresses before obtaining new IP addresses.

  • Releasing the original IP address

    Commands for renewing the lease of an IP address vary in different operating systems. You can use either of the following methods to renew the lease of an IP address:

    • Run the ipconfig /release command in the Window Vista/Windows 2000/Windows 2007/DOS environment of the user PC to release the IP address of the PC.
    • Run the winipcfg /release command in the MS-DOS interface of Windows 98 to release the IP address of the PC.

    The user PC needs to send a DHCP Release message to the DHCP server.

  • Renewing the IP address lease or applying for a new IP address

    The same command is used to apply for a new IP address and renew the IP address in the same operating system. Before applying for a new IP address, the PCs (DHCP clients) must release the original IP addresses. If you want to renew the IP address lease, you do not have to release the IP address.

    Different commands are used in different operating systems. You can use either of the following methods to apply for a new IP address:

    • Run the ipconfig /renew command in the Windows Vista/Windows 2000/Windows 2007/DOS environment of the user PC to apply for a new IP address.
    • Run the winipcfg /renew command in the MS-DOS interface of Windows 98 to apply for a new IP address.

    The user PC needs to send a DHCP Discover message to the DHCP server.

Translation
Download
Updated: 2019-08-09

Document ID: EDOC1000041694

Views: 57178

Downloads: 3617

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