04-Layer 3—IP Services Configuration Guide

HomeSupportRouters5G IPRAN Access RoutersConfigure & DeployConfiguration GuidesH3C RA5100[5100-HI] Routers Configuration Guides-R7607-6W10004-Layer 3—IP Services Configuration Guide
03-DHCP configuration
Title Size Download
03-DHCP configuration 460.75 KB

Contents

DHCP overview·· 1

DHCP network model 1

DHCP address allocation· 1

Allocation mechanisms· 1

IP address allocation process· 2

IP address lease extension· 2

DHCP message format 3

DHCP options· 4

Common DHCP options· 4

Custom DHCP options· 4

Vendor-specific option (Option 43) 5

Relay agent option (Option 82) 6

Option 184· 6

Protocols and standards· 7

Configuring the DHCP relay agent 8

About DHCP relay agent 8

DHCP relay agent operation· 8

DHCP relay agent support for Option 82· 9

DHCP relay agent tasks at a glance· 9

Enabling DHCP· 10

Enabling the DHCP relay agent on an interface· 10

Specifying DHCP servers· 11

Specifying DHCP servers on a relay agent 11

Configuring a remote BAS IP pool on a DHCP relay agent 11

Specifying the DHCP server selection algorithm·· 12

Configuring DHCP server liveness detection· 13

Configuring the DHCP relay agent security features· 14

Enabling the DHCP relay agent to record relay entries· 14

Enabling periodic refresh of dynamic relay entries· 14

Enabling DHCP starvation attack protection· 15

Enabling DHCP proxy on the DHCP relay agent 16

Enabling client offline detection on the DHCP relay agent 16

Configuring the DHCP relay agent to release an IP address· 17

Configuring DHCP relay agent support for Option 82· 17

Setting the DSCP value for DHCP packets sent by the DHCP relay agent 18

Specifying the DHCP relay agent address for the giaddr field· 18

Manually specifying the DHCP relay agent address for the giaddr field· 18

Configuring smart relay to specify the DHCP relay agent address for the giaddr field· 19

Specifying the source IP address for relayed DHCP requests· 19

About specifying the source IP address for relayed DHCP requests· 19

Specifying the source IP address for relayed DHCP requests (interface view) 20

Specifying the source IP address for relayed DHCP requests (remote BAS IP pool view) 20

Configuring the DHCP relay agent to always unicast relayed DHCP responses· 21

Configuring forwarding DHCP replies based on Option 82· 21

Setting the maximum number of DHCP-NAK packets· 22

Enabling the IP conflicting user offline feature· 23

Specifying a DHCP request processing method for roaming DHCP clients· 24

Display and maintenance commands for DHCP relay agent 25

DHCP relay agent configuration examples· 25

Example: Configuring basic DHCP relay agent 25

Example: Configuring Option 82· 26

Example: Configuring DHCP server selection· 27

Troubleshooting DHCP relay agent configuration· 28

Failure of DHCP clients to obtain configuration parameters through the DHCP relay agent 28

Configuring the DHCP client 30

About DHCP client 30

Restrictions and guidelines: DHCP client configuration· 30

DHCP client tasks at a glance· 30

Enabling the DHCP client on an interface· 30

Configuring a DHCP client ID for an interface· 31

Enabling duplicated address detection· 31

Setting the DSCP value for DHCP packets sent by the DHCP client 32

Display and maintenance commands for DHCP client 32

DHCP client configuration examples· 32

Example: Configuring DHCP client 32

Configuring the BOOTP client 35

About BOOTP client 35

BOOTP client application· 35

Obtaining an IP address dynamically· 35

Protocols and standards· 35

Configuring an interface to use BOOTP for IP address acquisition· 35

Display and maintenance commands for BOOTP client 36

BOOTP client configuration examples· 36

Example: Configuring BOOTP client 36

 


DHCP overview

DHCP network model

The Dynamic Host Configuration Protocol (DHCP) provides a framework to assign configuration information to network devices.

Figure 1 shows a typical DHCP application scenario where the DHCP clients and the DHCP server reside on the same subnet. The DHCP clients can also obtain configuration parameters from a DHCP server on another subnet through a DHCP relay agent. For more information about the DHCP relay agent, see "Configuring the DHCP relay agent."

Figure 1 A typical DHCP application

 

DHCP address allocation

Allocation mechanisms

DHCP supports the following allocation mechanisms:

·     Static allocation—The network administrator assigns an IP address to a client, such as a WWW server, and DHCP conveys the assigned address to the client.

·     Automatic allocation—DHCP assigns a permanent IP address to a client.

·     Dynamic allocation—DHCP assigns an IP address to a client for a limited period of time, which is called a lease. Most DHCP clients obtain their addresses in this way.

IP address allocation process

Figure 2 IP address allocation process

 

As shown in Figure 2, a DHCP server assigns an IP address to a DHCP client in the following process:

1.     The client broadcasts a DHCP-DISCOVER message to locate a DHCP server.

2.     Each DHCP server offers configuration parameters such as an IP address to the client in a DHCP-OFFER message. The sending mode of the DHCP-OFFER is determined by the flag field in the DHCP-DISCOVER message. For more information, see "DHCP message format."

3.     If the client receives multiple offers, it accepts the first received offer, and broadcasts it in a DHCP-REQUEST message to formally request the IP address. (IP addresses offered by other DHCP servers can be assigned to other clients.)

4.     All DHCP servers receive the DHCP-REQUEST message. However, only the server selected by the client does one of the following operations:

¡     Returns a DHCP-ACK message to confirm that the IP address has been allocated to the client.

¡     Returns a DHCP-NAK message to deny the IP address allocation.

After receiving the DHCP-ACK message, the client verifies the following details before using the assigned IP address:

·     The assigned IP address is not in use. To verify this, the client broadcasts a gratuitous ARP packet. The assigned IP address is not in use if no response is received within the specified time.

·     The assigned IP address is not on the same subnet as any IP address in use on the client.

Otherwise, the client sends a DHCP-DECLINE message to the server to request an IP address again.

IP address lease extension

A dynamically assigned IP address has a lease. When the lease expires, the IP address is reclaimed by the DHCP server. To continue using the IP address, the client must extend the lease duration.

When about half of the lease duration elapses, the DHCP client unicasts a DHCP-REQUEST to the DHCP server to extend the lease. Depending on the availability of the IP address, the DHCP server returns one of the following messages:

·     A DHCP-ACK unicast confirming that the client's lease duration has been extended.

·     A DHCP-NAK unicast denying the request.

If the client receives no reply, it broadcasts another DHCP-REQUEST message for lease extension when about seven-eighths of the lease duration elapses. Again, depending on the availability of the IP address, the DHCP server returns either a DHCP-ACK unicast or a DHCP-NAK unicast.

DHCP message format

Figure 3 shows the DHCP message format. DHCP uses some of the fields in significantly different ways. The numbers in parentheses indicate the size of each field in bytes.

Figure 3 DHCP message format

 

·     op—Message type defined in options field. 1 = REQUEST, 2 = REPLY

·     htype, hlen—Hardware address type and length of the DHCP client.

·     hops—Number of relay agents a request message traveled.

·     xid—Transaction ID, a random number chosen by the client to identify an IP address allocation.

·     secs—Filled in by the client, the number of seconds elapsed since the client began address acquisition or renewal process. This field is reserved and set to 0.

·     flags—The leftmost bit is defined as the BROADCAST (B) flag. If this flag is set to 0, the DHCP server sent a reply back by unicast. If this flag is set to 1, the DHCP server sent a reply back by broadcast. The remaining bits of the flags field are reserved for future use.

·     ciaddr—Client IP address if the client has an IP address that is valid and usable. Otherwise, set to zero. (The client does not use this field to request an IP address to lease.)

·     yiaddr—Your IP address. It is an IP address assigned by the DHCP server to the DHCP client.

·     siaddr—Server IP address, from which the client obtained configuration parameters.

·     giaddr—Gateway IP address. It is the IP address of the first relay agent to which a request message travels.

·     chaddr—Client hardware address.

·     sname—Server host name, from which the client obtained configuration parameters.

·     file—Boot file (also called system software image) name and path information, defined by the server to the client.

·     options—Optional parameters field that is variable in length. Optional parameters include the message type, lease duration, domain name server IP address, and WINS IP address.

DHCP options

DHCP extends the message format as an extension to BOOTP for compatibility. DHCP uses the options field to carry information for dynamic address allocation and provide additional configuration information for clients.

Figure 4 DHCP option format

 

Common DHCP options

The following are common DHCP options:

·     Option 3—Router option. It specifies the gateway address to be assigned to the clients.

·     Option 6—DNS server option. It specifies the DNS server IP address to be assigned to the clients.

·     Option 33—Static route option. It specifies a list of classful static routes (the destination addresses in these static routes are classful) that a client should add into its routing table. If both Option 33 and Option 121 exist, Option 33 is ignored.

·     Option 51—IP address lease option.

·     Option 53—DHCP message type option. It identifies the type of the DHCP message.

·     Option 55—Parameter request list option. It is used by a DHCP client to request specified configuration parameters. The option includes values that correspond to the parameters requested by the client.

·     Option 60—Vendor class identifier option. A DHCP client uses this option to identify its vendor. A DHCP server uses this option to distinguish DHCP clients, and assigns IP addresses to them.

·     Option 66—TFTP server name option. It specifies the TFTP server domain name to be assigned to the clients.

·     Option 67—Boot file name option. It specifies the boot file name to be assigned to the client.

·     Option 121—Classless route option. It specifies a list of classless static routes (the destination addresses in these static routes are classless) that a client should add into its routing table. If both Option 33 and Option 121 exist, Option 33 is ignored.

·     Option 150—TFTP server IP address option. It specifies the TFTP server IP address to be assigned to the clients.

For more information about DHCP options, see RFC 2132 and RFC 3442.

Custom DHCP options

Some options, such as Option 43, Option 82, and Option 184, have no standard definitions in RFC 2132.

Vendor-specific option (Option 43)

Option 43 function

DHCP servers and clients use Option 43 to exchange vendor-specific configuration information.

The DHCP client can obtain the following information through Option 43:

·     ACS parameters, including the ACS URL, username, and password.

·     Service provider identifier, which is acquired by the CPE from the DHCP server and sent to the ACS for selecting vender-specific configurations and parameters.

·     PXE server address, which is used to obtain the boot file or other control information from the PXE server.

·     AC address, which is used by an AP to obtain the boot file or other control information from the AC.

Option 43 format

Figure 5 Option 43 format

 

Network configuration parameters are carried in different sub-options of Option 43 as shown in Figure 5.

·     Sub-option type—The field value can be 0x01 (ACS parameter sub-option), 0x02 (service provider identifier sub-option), or 0x80 (PXE server address sub-option).

·     Sub-option length—Excludes the sub-option type and sub-option length fields.

·     Sub-option value—The value format varies by sub-option.

Sub-option value field format

·     ACS parameter sub-option value field—Includes the ACS URL, username, and password separated by spaces (hexadecimal number 20) as shown in Figure 6.

Figure 6 ACS parameter sub-option value field

 

·     Service provider identifier sub-option value field—Includes the service provider identifier.

·     PXE server address sub-option value field—Includes the PXE server type that can only be 0, the server number that indicates the number of PXE servers contained in the sub-option, and server IP addresses, as shown in Figure 7.

Figure 7 PXE server address sub-option value field

 

Relay agent option (Option 82)

Option 82 is the relay agent option. It records the location information about the DHCP client. When a DHCP relay agent receives a client's request, it adds Option 82 to the request and sends it to the server.

The administrator can use Option 82 to locate the DHCP client and further implement security control and accounting. The DHCP server can use Option 82 to provide individual configuration policies for the clients.

Option 82 can include a maximum of 255 sub-options and must include a minimum of one sub-option. Option 82 supports two sub-options: sub-option 1 (Circuit ID) and sub-option 2 (Remote ID). Option 82 has no standard definition. Its padding formats vary by vendor.

·     Circuit ID has the following padding modes:

¡     String padding mode—Includes a character string specified by the user.

¡     Normal padding mode—Includes the VLAN ID and interface number of the interface that receives the client's request.

¡     Verbose padding mode—Includes the access node identifier specified by the user, and the VLAN ID, interface number and interface type of the interface that receives the client's request.

·     Remote ID has the following padding modes:

¡     String padding mode—Includes a character string specified by the user.

¡     Normal padding mode—Includes the MAC address of the DHCP relay agent interface or the MAC address of the device that receives the client's request.

¡     Sysname padding mode—Includes the name of the device. To set the device name, use the sysname command in system view.

Option 184

Option 184 is a reserved option. You can define the parameters in the option as needed. The device supports Option 184 carrying voice related parameters, so a DHCP client with voice functions can get voice parameters from the DHCP server.

Option 184 has the following sub-options:

·     Sub-option 1—Specifies the IP address of the primary network calling processor. The primary processor acts as the network calling control source and provides program download services. For Option 184, you must define sub-option 1 to make other sub-options take effect.

·     Sub-option 2—Specifies the IP address of the backup network calling processor. DHCP clients contact the backup processor when the primary one is unreachable.

·     Sub-option 3—Specifies the voice VLAN ID and the result whether the DHCP client takes this VLAN as the voice VLAN.

Protocols and standards

·     RFC 2131, Dynamic Host Configuration Protocol

·     RFC 2132, DHCP Options and BOOTP Vendor Extensions

·     RFC 1542, Clarifications and Extensions for the Bootstrap Protocol

·     RFC 3046, DHCP Relay Agent Information Option

·     RFC 3442, The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4

 

a.      


Configuring the DHCP relay agent

About DHCP relay agent

The DHCP relay agent enables clients to get IP addresses and configuration parameters from a DHCP server on another subnet.

Figure 8 shows a typical application of the DHCP relay agent.

Figure 8 DHCP relay agent application

 

DHCP relay agent operation

The DHCP server and client interact with each other in the same way regardless of whether the relay agent exists. For the interaction details, see "IP address allocation process." The following only describes steps related to the DHCP relay agent:

1.     After receiving a DHCP-DISCOVER or DHCP-REQUEST broadcast message from a DHCP client, the DHCP relay agent processes the message as follows:

a.     Fills the giaddr field of the message with its IP address.

b.     Unicasts the message to the designated DHCP server.

2.     Based on the giaddr field, the DHCP server returns an IP address and other configuration parameters in a response.

3.     The relay agent conveys the response to the client.

Figure 9 DHCP relay agent operation

 

DHCP relay agent support for Option 82

Option 82 records the location information about the DHCP client. It enables the administrator to perform the following tasks:

·     Locate the DHCP client for security and accounting purposes.

·     Assign IP addresses in a specific range to clients.

For more information about Option 82, see "Relay agent option (Option 82)."

If the DHCP relay agent supports Option 82, it handles DHCP requests by following the strategies described in Table 1.

If a response returned by the DHCP server contains Option 82, the DHCP relay agent removes the Option 82 before forwarding the response to the client.

Table 1 Handling strategies of the DHCP relay agent

If a DHCP request has…

Handling strategy

The DHCP relay agent…

Option 82

Drop

Drops the message.

Keep

Forwards the message without changing Option 82.

Replace

Forwards the message after replacing the original Option 82 with the Option 82 padded according to the configured padding format, padding content, and code type.

No Option 82

N/A

Forwards the message after adding Option 82 padded according to the configured padding format, padding content, and code type.

 

DHCP relay agent tasks at a glance

To configure a DHCP relay agent, perform the following tasks:

1.     Enabling DHCP

2.     Enabling the DHCP relay agent on an interface

3.     Specifying DHCP servers

4.     (Optional.) Configuring advanced functions:

¡     Configuring DHCP server liveness detection

¡     Configuring the DHCP relay agent security features

¡     Configuring the DHCP relay agent to release an IP address

¡     Configuring DHCP relay agent support for Option 82

¡     Specifying the DHCP relay agent address for the giaddr field

¡     Specifying the source IP address for relayed DHCP requests

¡     Configuring the DHCP relay agent to always unicast relayed DHCP responses

¡     Configuring forwarding DHCP replies based on Option 82

¡     Setting the maximum number of DHCP-NAK packets

¡     Enabling the IP conflicting user offline feature

¡     Specifying a DHCP request processing method for roaming DHCP clients

Enabling DHCP

Restrictions and guidelines

You must enable DHCP to make other DHCP relay agent settings take effect.

Procedure

1.     Enter system view.

system-view

2.     Enable DHCP.

dhcp enable

By default, DHCP is disabled.

Enabling the DHCP relay agent on an interface

About this task

With the DHCP relay agent enabled, an interface forwards incoming DHCP requests to a DHCP server.

An IP pool that contains the IP address of the DHCP relay interface must be configured on the DHCP server. Otherwise, the DHCP clients connected to the relay agent cannot obtain correct IP addresses.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Enable the DHCP relay agent.

dhcp select relay

By default, when DHCP is enabled, an interface operates in the DHCP server mode.

Specifying DHCP servers

Specifying DHCP servers on a relay agent

About this task

To improve availability, you can specify several DHCP servers on the DHCP relay agent. When the interface receives request messages from clients, the relay agent forwards them to all DHCP servers.

Restrictions and guidelines

The IP address of any specified DHCP server must not reside on the same subnet as the IP address of the relay interface. Otherwise, the clients might fail to obtain IP addresses.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Specify a DHCP server address on the relay agent.

dhcp relay server-address ip-address

By default, no DHCP server address is specified on the relay agent.

To specify multiple DHCP server addresses, repeat this step. You can specify a maximum of eight DHCP servers.

Configuring a remote BAS IP pool on a DHCP relay agent

About this task

You can create a remote BAS IP pool and specify DHCP servers in this IP pool. This feature allows DHCP clients of the same type to obtain IP addresses and other configuration parameters from the DHCP servers specified in the matching remote BAS IP pool.

It applies to scenarios where the DHCP relay agent connects to clients of the same access type but classified into different types by their locations. In this case, the relay interface typically has no IP address configured. You can use the gateway-list command to specify gateway addresses for clients matching the same remote BAS IP pool and bind the gateway addresses to the device's MAC address.

Upon receiving a DHCP DISCOVER or REQUEST from a client that matches a remote BAS IP pool, the relay agent processes the packet as follows:

·     Fills the giaddr field of the packet with a specified gateway address.

·     Forwards the packet to all DHCP servers in the matching IP pool.

The DHCP servers select an IP pool according to the gateway address.

Procedure

1.     Enter system view.

system-view

2.     Create a remote BAS IP pool and enter its view.

ip pool pool-name bas remote

3.     Specify gateway addresses for the remote BAS IP pool.

gateway ip-address&<1-64> [ export-route ]

By default, no gateway address is specified.

4.     Specify DHCP servers for the remote BAS IP pool.

remote-server ip-address&<1-8>

By default, no DHCP server is specified for the remote BAS IP pool.

You can specify a maximum of eight DHCP servers for one remote BAS IP pool for high availability.

Specifying the DHCP server selection algorithm

About this task

The DHCP relay agent supports the polling and master-backup DHCP server selection algorithms.

By default, the DHCP relay agent uses the polling algorithm. It forwards DHCP requests to all DHCP servers. The DHCP clients select the DHCP server from which the first received DHCP reply comes.

If the DHCP relay agent uses the master-backup algorithm, it forwards DHCP requests to the master DHCP server first. If the master DHCP server is not available, the relay agent forwards the subsequent DHCP requests to a backup DHCP server. If the backup DHCP server is not available, the relay agent selects the next backup DHCP server, and so on. If no backup DHCP server is available, it repeats the process starting from the master DHCP server.

The master DHCP server is determined in one of the following ways:

·     In a common network where multiple DHCP server addresses are specified on the DHCP relay interface, the first specified DHCP server is the master. The other DHCP servers are backup.

·     In a network where remote BAS IP pools are configured on the DHCP relay agent, the first specified DHCP server in a remote BAS IP pool is the master. The other DHCP servers in the IP pool are backup.

DHCP server selection supports the following functions:

·     DHCP server response timeout time—The DHCP relay agent determines that a DHCP server is not available if it does not receive any response from the server within the DHCP server response timeout time. The DHCP server response timeout time is configurable and the default is 30 seconds.

·     DHCP server switchback—If the DHCP relay agent selects a backup DHCP server, it does not switch back to the master DHCP server by default. You can configure the DHCP relay agent to switch back to the master DHCP server after a delay. If the master DHCP server is available, the DHCP relay agent forwards DHCP requests to the master DHCP server. If the master DHCP server is not available, the DHCP relay agent still uses the backup DHCP server.

Specifying the DHCP server selection algorithm in interface view

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Specify the DHCP server selection algorithm.

dhcp relay server-address algorithm { master-backup | polling }

By default, the polling algorithm is used. The DHCP relay agent forwards DHCP requests to all DHCP servers.

4.     (Optional.) Set the DHCP server response timeout time for DHCP server switchover.

dhcp relay dhcp-server timeout time

By default, the DHCP server response timeout time is 30 seconds.

5.     (Optional.) Enable the switchback to the master DHCP server and set the delay time.

dhcp relay master-server switch-delay delay-time

By default, the DHCP relay agent does not switch back to the master DHCP server.

Specifying the DHCP server selection algorithm in remote BAS IP pool view

1.     Enter system view.

system-view

2.     Enter remote BAS IP pool view.

ip pool pool-name bas remote

3.     Specify the DHCP server selection algorithm.

dhcp relay server-address algorithm { master-backup | polling }

By default, the polling algorithm is used. The DHCP relay agent forwards DHCP requests to all DHCP servers.

4.     (Optional.) Set the DHCP server response timeout time for DHCP server switchover.

dhcp-server timeout time

By default, the DHCP server response timeout time is 30 seconds.

5.     (Optional.) Enable the switchback to the master DHCP server and set the delay time.

master-server switch-delay delay-time

By default, the DHCP relay agent does not switch back to the master DHCP server.

Configuring DHCP server liveness detection

About this task

The feature is applicable to a network where the relay agent selects a DHCP server from a remote BAS IP pool in an IP pool group.

This feature enables the relay agent to detect the liveness of the DHCP servers. Upon relaying the first DHCP request to a DHCP server, the DHCP relay agent starts the timeout timer and request counter.  If a reply is received within the timeout time, the relay agent resets packet counter and disables the timeout timer. The relay agent starts the timer and counter again if it relays a new request.  A communication failure occurs if the relay agent does not receive a reply.

The relay agent uses the following principles to mark the DHCP server as down ("dead") or has no assignable IP addresses:

·     At the end of every timeout period, the agent checks the total number of consecutive communication failures.

¡     If the failure count exceeds the dead-count-value value, the DHCP server is marked as dead.

¡     If the failure count does not exceed the dead-count-value value, the relay agent continues counting the number of requests. The DHCP server is marked as dead if the dead-count-value value is reached at next check.

·     The total number of consecutively received DHCP-NAK for the relayed lease renewal packets reaches the nak-count value.

When a DHCP server is marked as dead, the relay agent starts the dead time for the server. Within the dead period, the relay agent does not relay any packets to this DHCP server. After the dead period expires, the relay agent determines that the DHCP server becomes alive, and starts forwarding packets to this server.

If all DHCP servers are marked as dead, the DHCP relay agent treats all DHCP servers as alive if it receives a new DHCP request.

Restrictions and guidelines

If the DHCP server selection algorithm is polling, the longest timeout value among all DHCP servers is used as the check timer for all DHCP servers.

The liveness detection settings specific to a DHCP server have a higher priority than the shared settings. If no DHCP server-specific settings are configured, the shared ones apply.

Procedure

1.     Enter system view.

system-view

2.     Configure DHCP server liveness detection.

dhcp server [ ip-address [ vpn-instance vpn-instance-name ] ] { dead-count dead-count-value | dead-time dead-time | nak-count nak-count-value | timeout timeout } *

By default, the relay agent marks the DHCP server as dead if the DHCP relay agent does not receive a reply from a DHCP server within 25 seconds.

Configuring the DHCP relay agent security features

Enabling the DHCP relay agent to record relay entries

About this task

Perform this task to enable the DHCP relay agent to automatically record clients' IP-to-MAC bindings (relay entries) after they obtain IP addresses through DHCP.

Some security features use the relay entries to check incoming packets and block packets that do not match any entry. In this way, illegal hosts are not able to access external networks through the relay agent. One example of the security features is ARP address check.

Restrictions and guidelines

The DHCP relay agent does not record IP-to-MAC bindings for DHCP clients running on synchronous/asynchronous serial interfaces or for DHCP clients that use WAN access methods.

Procedure

1.     Enter system view.

system-view

2.     Enable the relay agent to record relay entries.

dhcp relay client-information record

By default, the relay agent does not record relay entries.

Enabling periodic refresh of dynamic relay entries

About this task

A DHCP client unicasts a DHCP-RELEASE message to the DHCP server to release its IP address. The DHCP relay agent conveys the message to the DHCP server and does not remove the IP-to-MAC entry of the client.

With this feature, the DHCP relay agent uses the following information to periodically send a DHCP-REQUEST message to the DHCP server:

·     The IP address of a relay entry.

·     The MAC address of the DHCP relay interface.

The relay agent maintains the relay entries depending on what it receives from the DHCP server:

·     If the server returns a DHCP-ACK message or does not return any message within an interval, the DHCP relay agent removes the relay entry. In addition, upon receiving the DHCP-ACK message, the relay agent sends a DHCP-RELEASE message to release the IP address.

·     If the server returns a DHCP-NAK message, the relay agent keeps the relay entry.

Procedure

1.     Enter system view.

system-view

2.     Enable periodic refresh of dynamic relay entries.

dhcp relay client-information refresh enable

By default, periodic refresh of dynamic relay entries is enabled.

3.     (Optional.) Set the refresh interval.

dhcp relay client-information refresh [ auto | interval interval ]

By default, the refresh interval is auto, which is calculated based on the number of total relay entries.

Enabling DHCP starvation attack protection

About this task

A DHCP starvation attack occurs when an attacker constantly sends forged DHCP requests using different MAC addresses in the chaddr field to a DHCP server. This exhausts the IP address resources of the DHCP server so legitimate DHCP clients cannot obtain IP addresses. The DHCP server might also fail to work because of exhaustion of system resources. The following methods are available to relieve or prevent such attacks.

·     To relieve a DHCP starvation attack that uses DHCP packets encapsulated with different source MAC addresses, you can use one of the following methods:

¡     Limit the number of ARP entries that a Layer 3 interface can learn.

·     To prevent a DHCP starvation attack that uses DHCP requests encapsulated with the same source MAC address, you can enable MAC address check on the DHCP relay agent. The DHCP relay agent compares the chaddr field of a received DHCP request with the source MAC address in the frame header. If they are the same, the DHCP relay agent forwards the request to the DHCP server. If not, the relay agent discards the request.

Enable MAC address check only on the DHCP relay agent directly connected to the DHCP clients. A DHCP relay agent changes the source MAC address of DHCP packets before sending them.

A MAC address check entry has an aging time. When the aging time expires, both of the following occur:

·     The entry ages out.

·     The DHCP relay agent rechecks the validity of DHCP requests sent from the MAC address in the entry.

Procedure

1.     Enter system view.

system-view

2.     Set the aging time for MAC address check entries.

dhcp relay check mac-address aging-time time

The default aging time is 30 seconds.

This command takes effect only after you execute the dhcp relay check mac-address command.

3.     Enter the interface view.

interface interface-type interface-number

4.     Enable MAC address check.

dhcp relay check mac-address

By default, MAC address check is disabled.

Enabling DHCP proxy on the DHCP relay agent

About this task

The DHCP proxy feature isolates DHCP servers from DHCP clients and protects DHCP servers against attacks.

Upon receiving a response from the server, the DHCP server proxy modifies the server's IP address as the relay interface's IP address before sending out the response. The DHCP client takes the DHCP relay agent as the DHCP server.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Enable DHCP proxy on the interface.

dhcp-proxy enable

By default, the interface operates in DHCP server mode after DHCP is enabled.

Enabling client offline detection on the DHCP relay agent

About this task

The client offline detection on the DHCP relay agent detects the user online status based on the ARP entry aging. When an ARP entry ages out, the DHCP client offline detection feature deletes the relay entry for the IP address and sends a RELEASE message to the DHCP server.

Restrictions and guidelines

The feature does not function if an ARP entry is manually deleted.

Procedure

1.     Enter system view.

system-view

2.     Enable the relay agent to record relay entries.

dhcp relay client-information record

By default, the relay agent does not record relay entries.

Without relay entries, client offline detection cannot function correctly.

3.     Enter interface view.

interface interface-type interface-number

4.     Enable the DHCP relay agent.

dhcp select relay

By default, when DHCP is enabled, an interface operates in the DHCP server mode.

5.     Enable client offline detection.

dhcp client-detect

By default, client offline detection is disabled on the DHCP relay agent.

Configuring the DHCP relay agent to release an IP address

About this task

Configure the relay agent to release the IP address for a relay entry. The relay agent sends a DHCP-RELEASE message to the server and meanwhile deletes the relay entry. Upon receiving the DHCP-RELEASE message, the DHCP server releases the IP address.

This command can release only the IP addresses in the recorded relay entries.

Procedure

1.     Enter system view.

system-view

2.     Configure the DHCP relay agent to release an IP address.

dhcp relay release ip ip-address [ vpn-instance vpn-instance-name ]

Configuring DHCP relay agent support for Option 82

To support Option 82, you must perform related configuration on both the DHCP server and relay agent.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Enable the relay agent to handle Option 82.

dhcp relay information enable

By default, handling of Option 82 is disabled.

4.     (Optional.) Configure the strategy for handling DHCP requests that contain Option 82.

dhcp relay information strategy { drop | keep | replace }

By default, the handling strategy is replace.

If the handling strategy is replace, configure a padding mode and a padding format for Option 82. If the handling strategy is keep or drop, you do not need to configure a padding mode or padding format for Option 82.

5.     (Optional.) Configure the padding mode and padding format for the Circuit ID sub-option.

dhcp relay information circuit-id { bas [ sub-interface-vlan ] [ with-vxlan ] | string circuit-id | { normal | verbose [ node-identifier { mac | sysname | user-defined node-identifier } ] [ interface [ vlan-in-vlan ] ] } [ sub-interface-vlan ] [ format { ascii | hex } ] }

By default, the padding mode for Circuit ID sub-option is normal, and the padding format is hex.

The device name (sysname) must not include spaces if it is configured as the padding content for sub-option 1. Otherwise, the DHCP relay agent will fail to add or replace Option 82.

6.     (Optional.) Configure the padding mode and padding format for the Remote ID sub-option.

dhcp relay information remote-id { normal [ format { ascii | hex } ] | string remote-id | sysname }

By default, the padding mode for the Remote ID sub-option is normal, and the padding format is hex.

Setting the DSCP value for DHCP packets sent by the DHCP relay agent

About this task

The DSCP value of a packet specifies the priority level of the packet and affects the transmission priority of the packet.

Procedure

1.     Enter system view.

system-view

2.     Set the DSCP value for DHCP packets sent by the DHCP relay agent.

dhcp dscp dscp-value

By default, the DSCP value in DHCP packets sent by the DHCP relay agent is 56.

Specifying the DHCP relay agent address for the giaddr field

Manually specifying the DHCP relay agent address for the giaddr field

About this task

This task allows you to specify the IP addresses to be encapsulated to the giaddr field of the DHCP requests. If you do not specify any DHCP relay agent address, the primary IP address of the DHCP relay interface is encapsulated to the giaddr field of DHCP requests.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Specify the DHCP relay agent address to be encapsulated in relayed DHCP requests.

dhcp relay gateway ip-address

By default, the primary IP address of the DHCP relay interface is encapsulated in the relayed DHCP requests.

Configuring smart relay to specify the DHCP relay agent address for the giaddr field

About this task

By default, the relay agent only encapsulates the primary IP address to the giaddr field of all requests before relaying them to the DHCP server. The DHCP server then selects an IP address on the same subnet as the address in the giaddr filed. If no assignable addresses on the subnet are available, the DHCP server does not assign any IP address. The DHCP smart relay feature is introduced to allow the DHCP relay agent to encapsulate secondary IP addresses when the DHCP server does not send back a DHCP-OFFER message.

The relay agent initially encapsulates its primary IP address to the giaddr field before forwarding a request to the DHCP server. If no DHCP-OFFER is received, the relay agent allows the client to send a maximum of two requests to the DHCP server by using the primary IP address. If no DHCP-OFFER is returned after two retries, the relay agent switches to a secondary IP address. If the DHCP server still does not respond, the next secondary IP address is used. After the secondary IP addresses are all tried and the DHCP server does not respond, the relay agent repeats the process by starting from the primary IP address.

Procedure

1.     Enter system view.

system-view

2.     Enable the DHCP smart relay feature.

dhcp smart-relay enable

By default, the DHCP smart relay feature is disabled.

Specifying the source IP address for relayed DHCP requests

About specifying the source IP address for relayed DHCP requests

This task is required if multiple relay interfaces share the same IP address or if a relay interface does not have routes to DHCP servers. You can perform this task to specify an IP address or the IP address of another interface on the DHCP relay agent as the source IP address for relayed DHCP requests.

For common networks, you can perform this task on the DHCP relay interface. If you specify the ip-address argument, the relay agent changes not only the source IP address but also the giaddr field of a DHCP request. The DHCP server assigns the client an IP address on the same subnet as the specified IP address in the giaddr field. As a result, the client might not be on the same subnet as the DHCP relay interface (the gateway). To avoid this problem, you must configure Option 82 on the relay interface before specifying the ip-address argument. This configuration enables the DHCP relay agent to insert the primary IP address of the relay interface in Option 82. Based on this option, the DHCP server assigns an IP address on the same subnet as the IP address of the relay interface. The DHCP relay agent looks up the MAC address table for the output interface to forward the DHCP reply packets.

For some networks, you must configure a remote BAS IP pool and specify the source IP address for DHCP requests in remote BAS IP pool view.

Specifying the source IP address for relayed DHCP requests (interface view)

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Specify the source IP address for DHCP requests.

dhcp relay source-address { ip-address [ option { 60 [ option-text ] | code } ] | gateway | relay-interface }

By default, the relay agent chooses the default source IP address for relayed requests depending on whether its server-side interface and the DHCP server belong to the same VPN instance:

¡     If they belong to the same VPN instance, the relay agent uses the IP address of the output interface for relayed requests as the default source IP address.

¡     If they belong to different VPN instances, the relay agent uses the lowest IP address that is in the same VPN instance as the DHCP server as the default source address.

 

Keyword

Description

ip-address [ option { 60 [ option-text ] | code } ]

If a DHCP request carries the specified option, the relay agent changes the source IP address and the giaddr field of the DHCP request to the specified IP address.

gateway

The relay agent uses the IP address in the giaddr field as the source IP address. If the giaddr field is empty, the relay agent follows the default rule to specify the source IP address for DHCP requests.

relay-interface

The relay agent uses the primary IP address of the relay interface as the source IP address. If this interface does not have an IP address, the relay agent follows the default rule to specify the source IP address for DHCP requests.

 

Specifying the source IP address for relayed DHCP requests (remote BAS IP pool view)

1.     Enter system view.

system-view

2.     Create a remote BAS IP pool and enter its view.

ip pool pool-name bas remote

3.     Specify the source IP address for DHCP requests.

dhcp-server source-address { ip-address | gateway | interface interface-type interface-number }

By default, the relay agent chooses the default source IP address for relayed requests depending on whether its server-side interface and the DHCP server belong to the same VPN instance:

¡     If they belong to the same VPN instance, the relay agent uses the IP address of the output interface for relayed requests as the default source IP address.

¡     If they belong to different VPN instances, the relay agent uses the lowest IP address that is in the same VPN instance as the DHCP server as the default source address.

 

Keyword

Description

ip-address

The relay agent uses the specified IP address as the source IP address for relay DHCP requests.

gateway

The relay agent uses the IP address in the giaddr field as the source IP address. If the giaddr field is empty, the relay agent follows the default rule to specify the source IP address for DHCP requests.

interface interface-type interface-number

The relay agent uses the IP address of the specified interface as the source IP address. If this interface does not have an IP address, the relay agent follows the default rule to specify the source IP address for DHCP requests.

 

Configuring the DHCP relay agent to always unicast relayed DHCP responses

About this task

This feature enables the DHCP relay agent to ignore the broadcast flag and always unicast relayed responses. This feature is useful in some LANs, such as a WLAN network, where broadcast communication is not recommended.

Procedure

1.     Enter system view.

system-view

2.     Enable the DHCP relay agent to always unicast relayed DHCP responses.

dhcp relay always-unicast

By default, the DHCP relay agent reads the broadcast flag to decide whether to broadcast or unicast a response.

Configuring forwarding DHCP replies based on Option 82

About this task

Configure this feature if the DHCP relay agent is required to forward DHCP replies to DHCP clients based on Option 82.

For example, an IPRAN network has a primary gateway and a secondary gateway. An L3VE interface is configured as the relay interface on each of the gateways. Multiple L2VE subinterfaces are configured to receive packets. One L2VE subinterface corresponds to one PW. Only the primary gateway receives DHCP requests, but both the primary and secondary gateways might receive DHCP replies. The primary gateway can forward DHCP replies based on locally recorded user information, but the secondary gateway cannot. The secondary gateway can only forward DHCP replies to all PWs.

To enable the secondary gateway to forward a DHCP reply to only the intended PW, perform the following tasks:

·     Configure the dhcp relay information enable and dhcp relay information circuit-id (with sub-interface-vlan specified) commands on the primary gateway. Then, when the primary gateway receives a DHCP request, it adds Option 82 to the reply and record the VLAN ID of the L2VE subinterface.

·     Configure the dhcp relay information enable, dhcp relay information circuit-id (with sub-interface-vlan specified), and dhcp relay forward reply by-option82 commands on the secondary gateway. Then, when the secondary gateway receives a DHCP reply, it resolves Option 82, records the VLAN ID of the L2VE subinterface, and forwards the reply to the PW.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Enable the relay agent to handle Option 82.

dhcp relay information enable

By default, handling of Option 82 is disabled.

4.     Configure the padding mode and padding format for the Circuit ID sub-option.

dhcp relay information circuit-id { bas [ sub-interface-vlan ] [ with-vxlan ] | string circuit-id | { normal | verbose [ node-identifier { mac | sysname | user-defined node-identifier } ] [ interface [ vlan-in-vlan ] ] } [ sub-interface-vlan ] [ format { ascii | hex } ] }

By default, the padding mode for the Circuit ID sub-option is normal, and the padding format is hex.

The device name (set by using the sysname command) must not include spaces if it is configured as the padding content for sub-option 1. Otherwise, the DHCP relay agent will fail to add or replace Option 82.

You must set the padding mode to bas, normal, or verbose, and specify the sub-interface-vlan keyword for this command.

5.     Configure the DHCP relay agent to forward DHCP replies based on Option 82.

dhcp relay forward reply by-option82

By default, the DHCP relay agent does not forward DHCP replies based on Option 82.

Setting the maximum number of DHCP-NAK packets

About this task

This value limits the maximum number of DHCP-NAK packets that the DHCP relay can receive from one DHCP server. Use this feature only in a network when the master-backup server selection is configured in the remote BAS IP pool. In such a network, you can use the gateway-list command to specify gateway addresses for users that match the remote BAS IP pool. When the relay agent receives a lease renew request from a DHCP client, the relay agent forwards the request to the currently selected DHCP server. When the number of DHCP-NAK packets from the DHCP server reaches the upper limit, the DHCP relay agent performs one of the following operations, depending on the configuration:

·     If the gateway-only keyword is not configured, the DHCP relay agent forwards the request to the next DHCP server.

·     If the gateway-only keyword is configured and smart relay is enabled, the relay agent uses the next gateway address configured in the gateway-list command to fill the giaddr field.

·     If the gateway-only keyword is not configured, and smart relay is enabled, the relay agent performs the following operations:

a.     Uses the next gateway address in the gateway-list command to fill the giaddr field.

b.     Forwards the request to the next DHCP server.

Procedure

1.     Enter system view.

system-view

2.     Enter remote BAS IP pool view.

ip pool pool-name bas remote

3.     Set the maximum of DHCP-NAK packets that the DHCP relay agent can receive from one DHCP server.

dhcp-server nak-count nak-count-value [ gateway-only ]

By default, the DHCP relay agent can receive a maximum of 10 DHCP-NAK packets from one DHCP server.

Enabling the IP conflicting user offline feature

About this task

The following IP address conflicts might occur in a network:

·     The IP address assigned by the authentication and authorization module to a new user is the same as the IP address of an online DHCP client.

·     The IP address assigned by the DHCP server to a new DHCP client is the same as the IP address in the DHCP relay entry for an online DHCP client.

If these conflicts occur, by default, the conflicting online DHCP clients still stay online, and new users cannot come online.

This feature enables the server to release the conflicting IP address when an IP conflict occurs, and informs the access module that the address is not available. Both the online user and requesting users are offline. It ensures that a new user can obtain an IP address next time the user request the IP address through DHCP.

With this feature enabled on the DHCP relay agent, the relay agent processes the conflicts as follows:

·     If the IP address assigned to a new user by the authentication and authorization module conflicts with the DHCP relay entry of an online client, the relay agent performs the following operations:

a.     Sends a DHCP-RELEASE packet to the DHCP server to release the conflicting IP address.

b.     Informs the access module of the new user that this IP address is not available.

·     If the IP address in the DHCP reply for a new user conflicts with the DHCP relay entry of an online client, the relay agent performs the following operations:

a.     Sends a DHCP-RELEASE packet to the server to release the conflicting IP address.

b.     Drops the DHCP reply.

Restrictions and guidelines

This feature takes effect on the DHCP relay agent only after you enable the recording of relay entries on it.

Enable this feature on the DHCP relay device if one DHCP relay agent-enabled interface connects to an IPoE network and the other DHCP relay agent-enabled interface connects to a common network. Because the following commands are required on the device for IPoE:

·     dhcp relay client-information record

·     undo dhcp relay client-information refresh enable

In this case, the common network-facing interface records DHCP relay entries but does not update them. An IP address conflict occurs if the IP address assigned to a new client already exists in a recorded DHCP relay entry. With this feature enabled, DHCP clients can obtain IP addresses correctly.

Procedure

1.     Enter system view.

system-view

2.     Enable the IP conflicting user offline feature.

dhcp conflict-ip-address offline

By default, the IP conflicting user offline feature is disabled. When the IP address assigned to a new DHCP client conflicts with the IP address of an online DHCP client, the online DHCP client still stays online.

Specifying a DHCP request processing method for roaming DHCP clients

About this task

When a DHCP client roams in a network, the client sends an offline request to the DHCP relay agent before requesting a new address. If the DHCP relay agent does not receive the offline request, it will discard the DHCP client's new address request because it determines that the request is an attack packet.

This feature allows the DHCP relay agent to process address requests as follows upon receiving them from roaming DHCP clients:

·     The fast-renew method enables the relay agent to inform the DHCP server to release existing address leases of roaming clients and forward the requests to the DHCP server.

·     The roam method enables the relay agent to forward the address requests to the DHCP server. The clients can use the original IP addresses to access the network without another authentication.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Specify a method for the DHCP relay agent to process address requests of roaming clients.

dhcp session-mismatch action { fast-renew | roam }

By default, the DHCP relay agent discards DHCP address requests sent from roaming DHCP clients.

Display and maintenance commands for DHCP relay agent

Execute display commands in any view and reset commands in user view.

 

Task

Command

Display information about DHCP servers on an interface.

display dhcp relay server-address [ interface interface-type interface-number ]

Display Option 82 configuration information on the DHCP relay agent.

display dhcp relay information [ interface interface-type interface-number ]

Display relay entries on the DHCP relay agent.

display dhcp relay client-information [ interface interface-type interface-number | ip ip-address [ vpn-instance vpn-instance-name ] ]

Display packet statistics on the DHCP relay agent.

display dhcp relay statistics [ interface interface-type interface-number ]

Display MAC address check entries on the DHCP relay agent.

display dhcp relay check mac-address

Clear relay entries on the DHCP relay agent.

reset dhcp relay client-information [ interface interface-type interface-number | ip ip-address [ vpn-instance vpn-instance-name ] ]

Clear packet statistics on the DHCP relay agent.

reset dhcp relay statistics [ interface interface-type interface-number ]

 

DHCP relay agent configuration examples

Example: Configuring basic DHCP relay agent

Network configuration

As shown in Figure 10, configure the DHCP relay agent on Router A. The DHCP relay agent enables DHCP clients to obtain IP addresses and other configuration parameters from the DHCP server on another subnet.

Figure 10 Network diagram

Prerequisites

Because the DHCP relay agent and server are on different subnets, configure static or dynamic routing to make them reachable to each other.

Configure the DHCP server to guarantee the client-server communication through the DHCP relay agent.

Procedure

# Specify IP addresses for the interfaces. (Details not shown.)

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Enable the DHCP relay agent on GigabitEthernet 1/0/12.

[RouterA] interface gigabitethernet 1/0/12

[RouterA-GigabitEthernet1/0/12] dhcp select relay

# Specify the IP address of the DHCP server on the relay agent.

[RouterA-GigabitEthernet1/0/12] dhcp relay server-address 10.1.1.1

Verifying the configuration

# Verify that DHCP clients can obtain IP addresses and all other network parameters from the DHCP server through the DHCP relay agent. (Details not shown.)

# Display the statistics of DHCP packets forwarded by the DHCP relay agent.

[RouterA] display dhcp relay statistics

# Display relay entries if you have enabled relay entry recording on the DHCP relay agent.

[RouterA] display dhcp relay client-information

Example: Configuring Option 82

Network configuration

As shown in Figure 10, the DHCP relay agent (Router A) replaces Option 82 in DHCP requests before forwarding them to the DHCP server (Router B).

·     The Circuit ID sub-option is company001.

·     The Remote ID sub-option is device001.

Prerequisites

To use Option 82, enable the DHCP server to handle Option 82.

Procedure

# Specify IP addresses for the interfaces. (Details not shown.)

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Enable the DHCP relay agent on GigabitEthernet 1/0/12.

[RouterA] interface gigabitethernet 1/0/12

[RouterA-GigabitEthernet1/0/12] dhcp select relay

# Specify the IP address of the DHCP server on the relay agent.

[RouterA-GigabitEthernet1/0/12] dhcp relay server-address 10.1.1.1

# Enable the DHCP relay agent to handle Option 82, and perform Option 82 related configuration.

[RouterA-GigabitEthernet1/0/12] dhcp relay information enable

[RouterA-GigabitEthernet1/0/12] dhcp relay information strategy replace

[RouterA-GigabitEthernet1/0/12] dhcp relay information circuit-id string company001

[RouterA-GigabitEthernet1/0/12] dhcp relay information remote-id string device001

Example: Configuring DHCP server selection

Network configuration

As shown in Figure 11, the DHCP client and the DHCP servers are in different subnets. DHCP server 1 and DHCP server 2 both have an IP pool that contains IP addresses in subnet 22.22.22.0/24, but neither has DHCP enabled.

Configure the DHCP relay agent for the DHCP client to obtain an IP address in subnet 22.22.22.0/24 and other configuration parameters from a DHCP server. The DHCP relay agent is connected to the DHCP client through GigabitEthernet 1/0/12, to DHCP server 1 through GigabitEthernet 1/0/13, and to DHCP server 2 through GigabitEthernet 1/0/14.

Figure 11 Network diagram

Procedure

1.     Assign IP addresses to interfaces on the routers. (Details not shown.)

2.     Configure Router B and Router C as DHCP servers. (Details not shown.)

3.     Configure the DHCP relay agent on Router A:

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Enable the DHCP relay agent on GigabitEthernet 1/0/12.

[RouterA] interface gigabitethernet 1/0/12

[RouterA-GigabitEthernet1/0/12] dhcp select relay

# Specify the IP addresses of the DHCP servers.

[RouterA-GigabitEthernet1/0/12] dhcp relay server-address 1.1.1.1

[RouterA-GigabitEthernet1/0/12] dhcp relay server-address 2.2.2.2

# Specify the DHCP server selection algorithm as master-backup.

[RouterA-GigabitEthernet1/0/12] dhcp relay server-address algorithm master-backup

# Configure the DHCP relay agent to switch back to the master DHCP server 3 minutes after it switches to the backup DHCP server.

[RouterA-GigabitEthernet1/0/12] dhcp relay master-server switch-delay 3

[RouterA-GigabitEthernet1/0/12] quit

Verifying the configuration

# Verify that the DHCP client cannot obtain an IP address and that the following log is output in about 30 seconds.

DHCPR/3/DHCPR_SERVERCHANGE:

 Switched to the server at 2.2.2.2 because the current server did not respond.

# Enable DHCP on the DHCP server at 1.1.1.1. (Details not shown.)

# Verify that the DHCP client cannot obtain an IP address and that the following log is output in about 3 minutes.

DHCPR/3/DHCPR_SWITCHMASTER:

 Switched to the master DHCP server at 1.1.1.1.

# Verify that the DHCP client obtains an IP address. (Details not shown.)

Troubleshooting DHCP relay agent configuration

Failure of DHCP clients to obtain configuration parameters through the DHCP relay agent

Symptom

DHCP clients cannot obtain configuration parameters through the DHCP relay agent.

Solution

Some problems might occur with the DHCP relay agent or server configuration.

To locate the problem, enable debugging and execute the display command on the DHCP relay agent to view the debugging information and interface state information.

Check that:

·     DHCP is enabled on the DHCP server and relay agent.

·     The DHCP server has an IP pool on the same subnet as the DHCP clients.

·     The DHCP server and DHCP relay agent can reach each other.

·     The DHCP server address specified on the DHCP relay interface connected to the DHCP clients is correct.


Configuring the DHCP client

About DHCP client

With DHCP client enabled, an interface uses DHCP to obtain configuration parameters from the DHCP server, for example, an IP address.

Restrictions and guidelines: DHCP client configuration

The DHCP client configuration is supported only on Layer 3 Ethernet interfaces (or subinterfaces) and Layer 3 aggregate interfaces..

DHCP client tasks at a glance

To configure a DHCP client, perform the following tasks:

1.     Enabling the DHCP client on an interface

2.     Configuring a DHCP client ID for an interface

Perform this task if the DHCP client uses the client ID to obtain IP addresses.

3.     (Optional.) Enabling duplicated address detection

4.     (Optional.) Setting the DSCP value for DHCP packets sent by the DHCP client

Enabling the DHCP client on an interface

Restrictions and guidelines

·     If the number of IP address request failures reaches the system-defined amount, the DHCP client-enabled interface uses a default IP address.

·     An interface can be configured to acquire an IP address in multiple ways. The new configuration overwrites the old.

·     Secondary IP addresses cannot be configured on an interface that is enabled with the DHCP client.

·     If the interface obtains an IP address on the same segment as another interface on the device, the interface does not use the assigned address. Instead, it requests a new IP address from the DHCP server.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Configure an interface to use DHCP for IP address acquisition.

ip address dhcp-alloc

By default, an interface does not use DHCP for IP address acquisition.

Configuring a DHCP client ID for an interface

About this task

A DHCP client ID is added to the DHCP option 61 to uniquely identify a DHCP client. A DHCP server can assign IP addresses to clients based on their DHCP client IDs.

DHCP client ID includes an ID type and a type value. Each ID type has a fixed type value. You can specify a DHCP client ID by using one of the following methods:

·     Use an ASCII string as the client ID. If an ASCII string is used, the type value is 00.

·     Use a hexadecimal number as the client ID. If a hexadecimal number is used, the type value is the first two characters in the number.

·     Use the MAC address of an interface to generate a client ID. If this method is used, the type value is 01.

The type value of a DHCP client ID can be displayed by the display dhcp server ip-in-use or display dhcp client command.

Restrictions and guidelines

Make sure the ID for each DHCP client is unique.

Procedure

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

3.     Configure a DHCP client ID for the interface.

dhcp client identifier { ascii ascii-string | hex hex-string | mac interface-type interface-number }

By default, an interface generates the DHCP client ID based on its MAC address. If the interface has no MAC address, it uses the MAC address of the first Ethernet interface to generate its client ID.

Enabling duplicated address detection

About this task

DHCP client detects IP address conflict through ARP packets. An attacker can act as the IP address owner to send an ARP reply. The spoofing attack makes the client unable to use the IP address assigned by the server. As a best practice, disable duplicate address detection when ARP attacks exist on the network.

Procedure

1.     Enter system view.

system-view

2.     Enable duplicate address detection.

dhcp client dad enable

By default, the duplicate address detection feature is enabled on an interface.

Setting the DSCP value for DHCP packets sent by the DHCP client

About this task

The DSCP value of a packet specifies the priority level of the packet and affects the transmission priority of the packet.

Procedure

1.     Enter system view.

system-view

2.     Set the DSCP value for DHCP packets sent by the DHCP client.

dhcp client dscp dscp-value

By default, the DSCP value in DHCP packets sent by the DHCP client is 56.

Display and maintenance commands for DHCP client

Execute display command in any view.

 

Task

Command

Display DHCP client information.

display dhcp client [ verbose ] [ interface interface-type interface-number ]

 

DHCP client configuration examples

Example: Configuring DHCP client

Network configuration

As shown in Figure 13, Router B contacts the DHCP server through GigabitEthernet 1/0/12 to obtain an IP address, a DNS server address, and static route information. The DHCP client's IP address resides on subnet 10.1.1.0/24. The DNS server address is 20.1.1.1. The next hop of the static route to subnet 20.1.1.0/24 is 10.1.1.2.

The DHCP server uses Option 121 to assign static route information to DHCP clients. Figure 12 shows the Option 121 format. The destination descriptor field contains the following parts: subnet mask length and destination network address, both in hexadecimal notation. In this example, the destination descriptor is 18 14 01 01 (the subnet mask length is 24 and the network address is 20.1.1.0 in dotted decimal notation). The next hop address is 0A 01 01 02 (10.1.1.2 in dotted decimal notation).

Figure 12 Option 121 format

 

Figure 13 Network diagram

Procedure

1.     Configure Router A:

# Specify an IP address for GigabitEthernet 1/0/12.

<RouterA> system-view

[RouterA] interface gigabitethernet 1/0/12

[RouterA-GigabitEthernet1/0/12] ip address 10.1.1.1 24

[RouterA-GigabitEthernet1/0/12] quit

# Exclude an IP address from dynamic allocation.

[RouterA] dhcp server forbidden-ip 10.1.1.2

# Configure IP pool 0. Specify the subnet, lease duration, DNS server address, and a static route to subnet 20.1.1.0/24.

[RouterA] ip pool 0

[RouterA-ip-pool-0] network 10.1.1.0 mask 255.255.255.0

[RouterA-ip-pool-0] expired day 10

[RouterA-ip-pool-0] dns-list 20.1.1.1

[RouterA-ip-pool-0] option 121 hex 181401010A010102

[RouterA-ip-pool-0] quit

# Enable DHCP.

[RouterA] dhcp enable

2.     Configure Router B:

# Configure GigabitEthernet 1/0/12 to use DHCP for IP address acquisition.

<RouterB> system-view

[RouterB] interface gigabitethernet 1/0/12

[RouterB-GigabitEthernet1/0/12] ip address dhcp-alloc

[RouterB-GigabitEthernet1/0/12] quit

Verifying the configuration

# Display the IP address and other network parameters assigned to Router B.

[RouterB] display dhcp client verbose

GigabitEthernet1/0/12 DHCP client information:

 Current state: BOUND

 Allocated IP: 10.1.1.3 255.255.255.0

 Allocated lease: 864000 seconds, T1: 331858 seconds, T2: 756000 seconds

 Lease from May 21 19:00:29 2012   to   May 31 19:00:29 2012

 DHCP server: 10.1.1.1

 Transaction ID: 0xcde72232

 Classless static routes:

   Destination: 20.1.1.0, Mask: 255.255.255.0, NextHop: 10.1.1.2

 DNS servers: 20.1.1.1

 Client ID type: acsii(type value=00)

 Client ID value: 000c.29d3.8659-GE1/0/12

 Client ID (with type) hex: 0030-3030-632e-3239-

                            6433-2e38-3635-392d-

                            4574-6830-2f30-2f32

 T1 will timeout in 3 days 19 hours 48 minutes 43 seconds

# Display the route information on Router B. The output shows that a static route to subnet 20.1.1.0/24 is added to the routing table.

[RouterB] display ip routing-table

Destinations : 11        Routes : 11

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

10.1.1.0/24         Direct 0    0            10.1.1.3        GE1/0/12

10.1.1.3/32         Direct 0    0            127.0.0.1       InLoop0

20.1.1.0/24         Static 70   0            10.1.1.2        GE1/0/12

10.1.1.255/32       Direct 0    0            10.1.1.3        GE1/0/12

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/32        Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

127.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

255.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

 


Configuring the BOOTP client

About BOOTP client

BOOTP client application

An interface that acts as a BOOTP client can use BOOTP to obtain information (such as IP address) from the BOOTP server.

To use BOOTP, an administrator must configure a BOOTP parameter file for each BOOTP client on the BOOTP server. The parameter file contains information such as MAC address and IP address of a BOOTP client. When a BOOTP client sends a request to the BOOTP server, the BOOTP server searches for the BOOTP parameter file and returns the corresponding configuration information.

BOOTP is usually used in relatively stable environments. In network environments that change frequently, DHCP is more suitable.

Because a DHCP server can interact with a BOOTP client, you can use the DHCP server to assign an IP address to the BOOTP client instead of using a BOOTP server. The DHCP server will assign an IP address to the BOOTP client based on the IP address allocation sequence.

Obtaining an IP address dynamically

A BOOTP client dynamically obtains an IP address from a BOOTP server as follows:

1.     The BOOTP client broadcasts a BOOTP request, which contains its own MAC address.

2.     Upon receiving the request, the BOOTP server searches the configuration file for the IP address and other information according to the BOOTP client's MAC address.

3.     The BOOTP server returns a BOOTP response to the BOOTP client.

4.     The BOOTP client obtains the IP address from the received response.

A DHCP server can take the place of the BOOTP server in the following dynamic IP address acquisition.

Protocols and standards

·     RFC 951, Bootstrap Protocol (BOOTP)

·     RFC 2132, DHCP Options and BOOTP Vendor Extensions

·     RFC 1542, Clarifications and Extensions for the Bootstrap Protocol

Configuring an interface to use BOOTP for IP address acquisition

1.     Enter system view.

system-view

2.     Enter interface view.

interface interface-type interface-number

BOOTP client configuration applies only to Layer 3 Ethernet interfaces (including subinterfaces), and Layer 3 aggregate interfaces.

3.     Configure an interface to use BOOTP for IP address acquisition.

ip address bootp-alloc

By default, an interface does not use BOOTP for IP address acquisition.

Display and maintenance commands for BOOTP client

Execute display command in any view.

 

Task

Command

Display BOOTP client information.

display bootp client [ interface interface-type interface-number ]

 

BOOTP client configuration examples

Example: Configuring BOOTP client

Network configuration

As shown in Figure 14, GigabitEthernet 1/0/12 of Router B connects to the LAN to obtain an IP address from the DHCP server by using BOOTP.

Figure 14 Network diagram

Procedure

The following describes the configuration on Router B, which acts as a client.

# Configure GigabitEthernet 1/0/12 to use BOOTP to obtain an IP address.

<RouterB> system-view

[RouterB] interface gigabitethernet 1/0/12

[RouterB-GigabitEthernet1/0/12] ip address bootp-alloc

Verifying the configuration

# Display the IP address assigned to the BOOTP client.

[RouterB] display bootp client

 

  • Cloud & AI
  • InterConnect
  • Intelligent Computing
  • Intelligent Storage
  • Security
  • SMB Products
  • Intelligent Terminal Products
  • Product Support Services
  • Technical Service Solutions
All Services
  • Resource Center
  • Policy
  • Online Help
  • Technical Blogs
All Support
  • Become A Partner
  • Partner Policy & Program
  • Global Learning
  • Partner Sales Resources
  • Partner Business Management
  • Service Business
All Partners
  • Profile
  • News & Events
  • Online Exhibition Center
  • Contact Us
All About Us
新华三官网