05-Layer 3 - IP Services Configuration Guide

HomeSupportResource CenterRoutersH3C SR8800 Router SeriesH3C SR8800 Router SeriesTechnical DocumentsConfigure & DeployConfiguration GuidesH3C SR8800 Configuration Guide-Release3347-6W10305-Layer 3 - IP Services Configuration Guide
03-DHCP Configuration
Title Size Download
03-DHCP Configuration 473.76 KB

Contents

DHCP overview·· 1

Introduction to DHCP· 1

DHCP address allocation· 1

Allocation mechanisms 1

Dynamic IP address allocation process 2

IP address lease extension· 2

DHCP message format 3

DHCP options 4

Overview·· 4

Introduction to DHCP options 4

Custom options 4

Protocols and standards 7

Configuring DHCP server 9

Introduction to DHCP server 9

Application environment 9

DHCP address pool 9

IP address allocation sequence· 10

DHCP server configuration task list 11

Configuring an address pool for the DHCP server 11

Configuration task list 11

Creating a DHCP address pool 12

Configuring an address allocation mode for a common address pool 12

Configuring dynamic address allocation for an extended address pool 14

Configuring a domain name suffix for the client 15

Configuring DNS servers for the client 15

Configuring WINS servers and NetBIOS node type for the client 15

Configuring BIMS server information for the client 16

Configuring gateways for the client 16

Configuring Option 184 parameters for the client with voice service· 17

Configuring the TFTP server and bootfile name for the client 17

Configuring self-defined DHCP options 18

Enabling DHCP· 19

Enabling the DHCP server on an interface· 19

Applying an extended address pool on an interface· 20

Configuring the DHCP server security functions 20

Configuration prerequisites 20

Enabling unauthorized DHCP server detection· 21

Configuring IP address conflict detection· 21

Configuring the DHCP server to work with authorized ARP· 22

Enabling Option 82 handling· 22

Specifying the threshold for sending trap messages 23

Configuration prerequisites 23

Configuration procedure· 23

Displaying and maintaining the DHCP server 24

DHCP server configuration examples 24

Static IP address assignment configuration example· 25

Dynamic IP address assignment configuration example· 26

Self-defined option configuration example· 28

Troubleshooting DHCP server configuration· 28

Configuring DHCP relay agent 30

Introduction to DHCP relay agent 30

Application environment 30

Fundamentals 30

DHCP relay agent support for Option 82· 31

DHCP relay agent configuration task list 32

Enabling DHCP· 32

Enabling the DHCP relay agent on an interface· 32

Correlating a DHCP server group with a relay agent interface· 33

Configuring the DHCP relay agent security functions 34

Configure address check· 34

Configuring periodic refresh of dynamic client entries 34

Configuring the DHCP relay agent to work with authorized ARP· 35

Enabling unauthorized DHCP server detection· 36

Enabling DHCP starvation attack protection· 36

Enabling offline detection· 37

Configuring the DHCP relay agent to release an IP address 37

Configuring the DHCP relay agent to support Option 82· 38

Displaying and maintaining the DHCP relay agent 39

DHCP relay agent configuration example· 40

DHCP relay agent Option 82 support configuration example· 41

Troubleshooting DHCP relay agent configuration· 42

 


DHCP overview

Introduction to DHCP

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

DHCP uses the client/server model. Figure 1 shows a typical DHCP application.

Figure 1 A typical DHCP application

 

 

NOTE:

A DHCP client can obtain an IP address and other configuration parameters from a DHCP server on another subnet via a DHCP relay agent. For more information about the DHCP relay agent, see Introduction to DHCP relay agent.”

 

DHCP address allocation

Allocation mechanisms

DHCP supports the following mechanisms for IP address allocation.

·           Static allocationThe network administrator assigns an IP address to a client like a WWW server, and DHCP conveys the assigned address to the client.

·           Automatic allocationDHCP assigns a permanent IP address to a client.

·           Dynamic allocationDHCP 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.

Dynamic IP address allocation process

Figure 2 Dynamic IP address allocation process

 

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

2.      A 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 related information, see DHCP message format.”

3.      If several DHCP servers send offers to the client, the client accepts the first received offer, and broadcasts it in a DHCP-REQUEST message to formally request the IP address.

4.      All DHCP servers receive the DHCP-REQUEST message, but only the server from which the client accepts the offered IP address returns a DHCP-ACK message to the client, confirming that the IP address has been allocated to the client, or returns a DHCP-NAK message, denying the IP address allocation.

 

 

NOTE:

·       After the client receives the DHCP-ACK message, it broadcasts a gratuitous ARP packet to verify whether the IP address assigned by the server is already in use. If the client receives no response within the specified time, the client uses the assigned IP address. Otherwise, the client sends a DHCP-DECLINE message to the server to request an IP address again.

·       IP addresses offered by other DHCP servers are still assignable to other clients.

 

IP address lease extension

The IP address dynamically allocated by a DHCP server to a client 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.

After half the lease duration, the DHCP client sends a DHCP-REQUEST unicast to the DHCP server to extend the lease. Depending on availability of the IP address, the DHCP server returns a DHCP-ACK unicast confirming that the client’s lease duration has been extended, or a DHCP-NAK unicast denying the request.

If the client receives no reply, it broadcasts another DHCP-REQUEST message for lease extension after 7/8 lease duration elapses.

DHCP message format

Figure 3 shows the DHCP message format, which is based on the BOOTP message format although 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

 

·           opMessage type defined in option field. 1 = REQUEST, 2 = REPLY

·           htype, hlenHardware address type and length of a DHCP client.

·           hopsNumber of relay agents a request message traveled.

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

·           secsFilled in by the client, the number of seconds elapsed since the client began address acquisition or renewal process. Currently this field is reserved and set to 0.

·           flagsThe 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.

·           ciaddrClient IP address.

·           yiaddr'your' (client) IP address, assigned by the server.

·           siaddrServer IP address, from which the client obtained configuration parameters.

·           giaddrIP address of the first relay agent a request message traveled.

·           chaddrClient hardware address.

·           snameServer host name, from which the client obtained configuration parameters.

·           fileBootfile name and path information, defined by the server to the client.

·           optionsOptional parameters field that is variable in length, which includes the message type, lease, domain name server IP address, and WINS IP address.

DHCP options

Overview

DHCP uses the same message format as Bootstrap Protocol (BOOTP), but DHCP uses the Option field to carry information for dynamic address allocation and to provide additional configuration information to clients.

Figure 4 shows the DHCP option format.

Figure 4 DHCP option format

 

Introduction to DHCP options

Common DHCP options:

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

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

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

·           Option 51IP address lease option.

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

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

·           Option 60Vendor class identifier option. It is used by a DHCP client to identify its vendor, and by a DHCP server to distinguish DHCP clients by vendor class and assign specific IP addresses for the DHCP clients.

·           Option 66TFTP server name option. It specifies a TFTP server to be assigned to the client.

·           Option 67Bootfile name option. It specifies the bootfile name to be assigned to the client.

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

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

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

Custom options

Some options, such as Option 43, have no unified definitions in RFC 2132.

Vendor-specific option (Option 43)

DHCP servers and clients use Option 43 to exchange vendor-specific configuration information. The client sends a request with Option 43, including a vendor string that identifies a vendor. Upon receiving the request, the DHCP server refers to the vendor-specific options table, and returns a response message with Option 43 to assign the appropriate vendor-specific information to the DHCP client.

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

·           Auto-Configuration Server (ACS) parameters, including the ACS URL, username, and password.

·           Service provider identifier, which is acquired by the customer premises equipment (CPE) from the DHCP server and sent to the ACS for selecting vender-specific configurations and parameters. For more information about CPE and ACS, see Network Management and Monitoring Configuration Guide.

·           Preboot Execution Environment (PXE) server address, which is used to obtain the bootfile or other control information from the PXE server.

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

1.      Format of Option 43

Figure 5 Format of Option 43

 

Network configuration parameters are carried in different sub-options of Option 43 as shown in Figure 5. The sub-option fields are described as follows:

¡  Sub-option typeType of a sub-option. The field value can be 0x01, 0x02, or 0x80. 0x01 indicates an ACS parameter sub-option. 0x02 indicates a service provider identifier sub-option. 0x80 indicates a PXE server address sub-option.

¡  Sub-option lengthLength of a sub-option excluding the sub-option type and sub-option length fields.

¡  Sub-option valueValue of a sub-option.

2.      Format of the sub-option value field of Option 43

¡  As shown in Figure 6, the value field of the ACS parameter sub-option contains variable ACS URL, username, and password separated by spaces (0x20).

Figure 6 Format of the value field of the ACS parameter sub-option

 

¡  The value field of the service provider identifier sub-option contains the service provider identifier.

¡  Figure 7 shows the format of the value field of the PXE server address sub-option. Currently, the value of the PXE server type can only be 0. The server number field indicates the number of PXE servers contained in the sub-option. The server IP addresses field contains the IP addresses of the PXE servers.

Figure 7 Format of the value field of the PXE server address sub-option

 

Relay agent option (Option 82)

Option 82 is the relay agent option in the option field of the DHCP message. It records the location information of the DHCP client. When a DHCP relay agent or DHCP snooping device receives a client’s request, it adds Option 82 to the request message and sends it to the server.

The administrator can locate the DHCP client to further implement security control and accounting. The Option 82 supporting server can also use such information to define individual assignment policies of IP address and other parameters for the clients.

Option 82 involves at most 255 sub-options. At least one sub-option must be defined. The DHCP relay agent supports two sub-options: sub-option 1 (Circuit ID) and sub-option 2 (Remote ID).

Option 82 has no unified definition. Its padding formats vary with vendors.

There are two methods for configuring Option 82:

·           User-defined method—Manually specify the content of Option 82.

·           Non-user-defined method—Pad Option 82 in the default normal or verbose format.

If you choose the second method, you can specify the code type for the sub-options as ASCII or HEX.

1.      Normal padding format

The padding contents for sub-options in the normal padding format are as follows:

¡  Sub-option 1Padded with the VLAN ID and interface number of the interface that received the client’s request. The value of the sub-option type is 1, and that of the circuit ID type is 0.

Figure 8 Sub-option 1 in normal padding format

 

¡  Sub-option 2Padded with the MAC address of the DHCP relay agent interface or the MAC address of the DHCP snooping device that received the client’s request. The value of the sub-option type is 2, and that of the remote ID type is 0.

Figure 9 Sub-option 2 in normal padding format

 

2.      Verbose padding format

¡  Sub-option 1Padded with the user-specified access node identifier (ID of the router that adds Option 82 in DHCP messages), and the type, number, and VLAN ID of the interface that received the client’s request.

Figure 10 Sub-option 1 in verbose padding format

 

 

NOTE:

The VLAN ID field has a fixed length of 2 bytes. All the other padding contents of sub-option 1 are length variable. See Figure 10.

 

¡  Sub-option 2Padded with the MAC address of the DHCP relay agent interface or the MAC address of the DHCP snooping device that received the client’s request. It has the same format as that in normal padding format. See Figure 9.

Option 184

Option 184 is a reserved option, and parameters in the option can be defined as needed. The router supports Option 184 carrying the voice related parameters, so a DHCP client with voice functions can get an IP address along with specified voice parameters from the DHCP server.

Option 184 involves the following sub-options:

·           Sub-option 1IP address of the primary network calling processor, which serves as the network calling control source and provides program downloads.

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

·           Sub-option 3Voice VLAN ID and the result whether DHCP clients take this ID as the voice VLAN or not.

·           Sub-option 4Failover route that specifies the destination IP address and the called number that a Session Initiation Protocol (SIP) user uses to reach another SIP user when both the primary and backup calling processors are unreachable.

 

 

NOTE:

You must define the sub-option 1 to make other sub-options effective.

 

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

 


Configuring DHCP server

 

 

NOTE:

Unless otherwise specified, the DHCP server configuration is supported only on Layer 3 Ethernet interfaces (or subinterfaces), virtual Ethernet interfaces (or subinterfaces), VLAN interfaces, Layer 3 aggregate interfaces, serial interfaces, ATM interfaces, MP-group interfaces, and loopback interfaces. The secondary IP address pool configuration is not supported on serial, MP-group or loopback interfaces.

 

Introduction to DHCP server

Application environment

The DHCP server is well suited to networks where:

·           Manual configuration and centralized management are difficult to implement.

·           Many hosts need to acquire IP addresses dynamically. This may be because the number of hosts exceeds the number of assignable IP addresses, so it is impossible to assign a fixed IP address to each host. For example, an ISP has a limited number of host addresses.

·           A few hosts need fixed IP addresses.

 

 

NOTE:

In addition to assigning IP addresses to DHCP clients on public networks, a MCE serving as the DHCP server can also assign IP addresses to DHCP clients on private networks. The IP address ranges of public and private networks or those of private networks on the DHCP server cannot overlap each other. For more information about MCE, see MPLS Configuration Guide.

 

DHCP address pool

Address pool types

DHCP address pools include common and extended address pools.

·           Common address pool—Supports both static binding and dynamic allocation.

·           Extended address pool—Supports only dynamic allocation.

Common address pool structure

The common address pool database is organized as a tree. The root of the tree is the address pool for natural networks, branches are address pools for subnets, and leaves are addresses statically bound to clients. For the same level address pools, a previously configured pool has a higher selection priority than a new one.

At the very beginning, subnets inherit network parameters and clients inherit subnetwork parameters. Therefore, common parameters, for example a DNS server address, should be configured at the highest (network or subnet) level of the tree.

After establishment of the inheritance relationship, the new configuration at the higher level (parent) of the tree will be:

·           Inherited if the lower level (child) has no such configuration, or

·           Overridden if the lower level (child) has such configuration.

 

 

NOTE:

·       The extended address pools on a DHCP server are independent of each other and no inheritance relationship exists among them.

·       IP address lease durations are not inherited.

 

Principles for selecting an address pool

The DHCP server observes the following principles to select an address pool when assigning an IP address to a client:

1.      If there is an address pool where an IP address is statically bound to the MAC address or ID of the client, the DHCP server will select this address pool and assign the statically bound IP address to the client. For the configuration of this address pool, see Configuring static address allocation.

2.      If the receiving interface has an extended address pool referenced, the DHCP server will assign an IP address from this address pool. If no IP address is available in the address pool, the DHCP server will fail to assign an address to the client. For the configuration of such an address pool, see Configuring dynamic address allocation for an extended address pool.

3.      Otherwise, the DHCP server will select the smallest common address pool that contains the IP address of the receiving interface (if the client and the server reside on the same subnet), or the smallest common address pool that contains the IP address specified in the giaddr field of the client’s request (if a DHCP relay agent is in-between). If no IP address is available in the address pool, the DHCP server will fail to assign an address to the client because it cannot assign an IP address from the parent address pool to the client. For the configuration of such an address pool, see Configuring dynamic address allocation.

For example, two common address pools, 1.1.1.0/24 and 1.1.1.0/25, are configured on the DHCP server. If the IP address of the interface receiving DHCP requests is 1.1.1.1/25, the DHCP server will select IP addresses for clients from address pool 1.1.1.0/25. If no IP address is available in the address pool, the DHCP server will fail to assign addresses to clients. If the IP address of the interface receiving DHCP requests is 1.1.1.130/25, the DHCP server will select IP addresses for clients from the 1.1.1.0/24 address pool.

 

 

NOTE:

Keep the IP addresses for dynamic allocation within the subnet where the interface of the DHCP server or DHCP relay agent resides to avoid wrong IP address allocation.

 

IP address allocation sequence

A DHCP server assigns an IP address to a client according to the following sequence:

1.      The IP address statically bound to the client’s MAC address or ID

2.      The IP address that was ever assigned to the client

3.      The IP address designated by the Option 50 field in a DHCP-DISCOVER message

4.      The first assignable IP address found in an extended or common address pool

5.      The IP address that was a conflict or passed its lease duration

If no IP address is assignable, the server will not respond.

 

 

NOTE:

Option 50 is the requested IP address field in DHCP-DISCOVER messages. It is padded by the client to specify the IP address that the client wants to obtain. The contents to be padded depend on the client.

 

DHCP server configuration task list

Complete the following tasks to configure the DHCP server:

 

Task

Remarks

Configuring an address pool for the DHCP server

Required

Enabling DHCP

Required

Enabling the DHCP server on an interface

Required

Applying an extended address pool on an interface

Required by the extended address pool configuration

When you configure a common address pool, ignore this task.

Configuring the DHCP server security functions

Optional

Enabling Option 82 handling

Optional

Specifying the threshold for sending trap messages

Optional

 

Configuring an address pool for the DHCP server

Configuration task list

Complete the following tasks to configure an address pool:

 

Task

Remarks

Creating a DHCP address pool

Required

Configuring an address allocation mode for a common address pool

Configuring static address allocation

Required to configure either of the two for the common address pool configuration

Configuring dynamic address allocation

Configuring dynamic address allocation for an extended address pool

Required for the extended address pool configuration

Configuring a domain name suffix for the client

Optional

Configuring DNS servers for the client

Configuring WINS servers and NetBIOS node type for the client

Configuring BIMS server information for the client

Configuring gateways for the client

Configuring Option 184 parameters for the client with voice service

Configuring the TFTP server and bootfile name for the client

Configuring self-defined DHCP options

 

Creating a DHCP address pool

When creating a DHCP address pool, specify it as a common address pool or an extended address pool.

To create a DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Create a DHCP address pool and enter its view.

dhcp server ip-pool pool-name [ extended ]

No DHCP address pool is created by default.

 

 

NOTE:

A common address pool and an extended address pool are different in address allocation mode configuration. Configurations of other parameters (such as the domain name suffix and DNS server address) for them are the same.

 

Configuring an address allocation mode for a common address pool

 

CAUTION

CAUTION:

You can configure either a static binding or dynamic address allocation for a common address pool, but not both.

 

You need to specify an address range for the dynamic address allocation. A static binding is a special address pool containing only one IP address.

Configuring static address allocation

Some DHCP clients such as a WWW server need fixed IP addresses. To provide a fixed IP address, you can create a static binding of a client’s MAC or ID to an IP address in the DHCP address pool. A static binding is a special address pool containing only one IP address.

When the client with that MAC address or ID requests an IP address, the DHCP server will assign the IP address from the binding to the client.

To configure a static binding in a common address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter common address pool view.

dhcp server ip-pool pool-name

N/A

3.     Specify the IP address.

static-bind ip-address ip-address [ mask-length | mask mask ]

No IP addresses are statically bound by default.

4.     Specify the MAC address or client ID.

·       Specify the MAC address:
static-bind mac-address
mac-address

·       Specify the client ID:
static-bind client-identifier client-identifier

Configure either of the two.

Neither is bound statically by default.

5.     Specify the lease duration for the IP address.

expired { day day [ hour hour [ minute minute [ second second ] ] ] | unlimited }

Optional.

By default, the lease duration of the IP address is unlimited.

 

 

NOTE:

·       Use the static-bind ip-address command together with static-bind mac-address or static-bind client-identifier to accomplish a static binding configuration.

·       In a DHCP address pool, if you execute the static-bind mac-address command before the static-bind client-identifier command, the latter will overwrite the former and vice versa.

·       If you use the static-bind ip-address, static-bind mac-address, or static-bind client-identifier command repeatedly in the DHCP address pool, the new configuration will overwrite the previous one.

·       The IP address of the static binding cannot be an interface address of the DHCP server. Otherwise, an IP address conflict may occur and the bound client cannot obtain an IP address correctly.

·       If the interfaces on a DHCP client share the same MAC address, you need to specify the client ID, rather than MAC address, in a static binding to identify the requesting interface; otherwise, the client may fail to obtain an IP address.

 

Configuring dynamic address allocation

For dynamic address allocation, you must configure a DHCP address pool, specify one and only one address range for the pool, and specify the lease duration. A DHCP address pool can have only one lease duration.

To avoid address conflicts, configure the DHCP server to exclude IP addresses used by the gateway or FTP server from dynamic allocation.

To configure dynamic address allocation for a common address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter common address pool view.

dhcp server ip-pool pool-name

N/A

3.     Specify an IP address range.

network network-address [ mask-length | mask mask ]

Not specified by default.

4.     Specify the address lease duration.

expired { day day [ hour hour [ minute minute ] [ second second ] ] | unlimited }

Optional.

One day by default.

5.     Return to system view.

quit

N/A

6.     Exclude IP addresses from automatic allocation.

dhcp server forbidden-ip low-ip-address [ high-ip-address ]

Optional.

Except IP addresses of the DHCP server interfaces, all addresses in the DHCP address pool are assignable by default.

 

 

NOTE:

·       In common address pool view, using the network command repeatedly overwrites the previous configuration.

·       After you exclude IP addresses from automatic allocation by using the dhcp server forbidden-ip command, neither a common address pool nor an extended address pool can assign these IP addresses through dynamic address allocation.

·       Using the dhcp server forbidden-ip command repeatedly can exclude multiple IP address ranges from allocation.

 

Configuring dynamic address allocation for an extended address pool

Extended address pools support dynamic address allocation only.

When you configure an extended address pool, you need to specify:

·           Assignable IP address range

·           Mask

After the assignable IP address range and the mask are specified, the address pool becomes valid.

To configure dynamic address allocation for an extended address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter extended address pool view.

dhcp server ip-pool pool-name extended

N/A

3.     Specify the IP address range.

network ip range min-address max-address

Not specified by default.

4.     Specify the IP address mask.

network mask mask

Not specified by default.

5.     Specify the IP address range for the DHCP clients of a specified vendor.

vendor-class-identifier hex-string&<1-255> ip range min-address max-address

Optional.

Not configured by default.

6.     Specify the address lease duration.

expired { day day [ hour hour [ minute minute [ second second ] ] ] | unlimited }

Optional.

One day by default.

7.     Exclude IP addresses from dynamic allocation.

forbidden-ip ip-address&<1-8>

Optional.

Except IP addresses of the DHCP server interfaces, all addresses in the DHCP address pool are assignable by default.

 

 

NOTE:

Excluded IP addresses specified with the forbidden-ip command in DHCP address pool view are not assignable in the current extended address pool, but are assignable in other address pools.

 

Configuring a domain name suffix for the client

You can specify a domain name suffix in each DHCP address pool on the DHCP server to provide the clients with the domain name suffix. With this suffix assigned, the client only needs to input part of a domain name, and the system will add the domain name suffix for name resolution. For more information about DNS, see the chapter “IPv4 DNS configuration.”

To configure a domain name suffix in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify a domain name suffix.

domain-name domain-name

Not specified by default

 

Configuring DNS servers for the client

A DHCP client contacts a Domain Name System (DNS) server to resolve names. You can specify up to eight DNS servers in the DHCP address pool.

To configure DNS servers in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify DNS servers.

dns-list ip-address&<1-8>

Not specified by default

 

Configuring WINS servers and NetBIOS node type for the client

A Microsoft DHCP client using NetBIOS protocol contacts a Windows Internet Naming Service (WINS) server for name resolution. Therefore, the DHCP server should assign a WINS server address when assigning an IP address to the client.

You can specify up to eight WINS servers in a DHCP address pool.

You need to specify in a DHCP address pool a NetBIOS node type for the client to approach name resolution. There are four NetBIOS node types:

·           b (broadcast)-nodeThe b-node client sends the destination name in a broadcast message. The destination returns its IP address to the client after receiving the message.

·           p (peer-to-peer)-nodeThe p-node client sends the destination name in a unicast message to the WINS server, and the WINS server returns the destination IP address.

·           m (mixed)-nodeA combination of broadcast first and peer-to-peer second. The m-node client broadcasts the destination name, if no response is received, then unicasts the destination name to the WINS server to get the destination IP address.

·           h (hybrid)-nodeA combination of peer-to-peer first and broadcast second. The h-node client unicasts the destination name to the WINS server, and if no response is received, broadcasts it to get the destination IP address.

To configure WINS servers and NetBIOS node type in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify WINS server IP addresses.

nbns-list ip-address&<1-8>

Optional for b-node.

No address is specified by default.

4.     Specify the NetBIOS node type.

netbios-type { b-node | h-node | m-node | p-node }

Not specified by default.

 

 

NOTE:

If b-node is specified for the client, you do not need to specify any WINS server address.

 

Configuring BIMS server information for the client

Some DHCP clients perform regular software update and backup by using configuration files obtained from a branch intelligent management system (BIMS) server. Therefore, the DHCP server needs to offer these DHCP clients the BIMS server IP address, port number, shared key from the DHCP address pool.

To configure the BIMS server IP address, port number, and shared key in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify the BIMS server IP address, port number, and shared key.

bims-server ip ip-address [ port port-number ] sharekey key

Not specified by default

 

Configuring gateways for the client

You can specify up to eight gateways in a DHCP address pool.

To configure the gateways in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify gateways.

gateway-list ip-address&<1-8>

No gateway is specified by default.

 

Configuring Option 184 parameters for the client with voice service

To assign voice calling parameters along with an IP address to DHCP clients with voice service, you need to configure Option 184 on the DHCP server. For more information about Option 184, see “Option 184.

If Option 55 in the request from a DHCP client contains Option 184, the DHCP server will return parameters specified in Option 184 to the client. The client then can initiate a call using parameters in Option 184.

To configure option 184 parameters in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify the IP address of the primary network calling processor.

voice-config ncp-ip ip-address

Not specified by default.

4.     Specify the IP address of the backup network calling processor.

voice-config as-ip ip-address

Optional.

Not specified by default.

5.     Configure the voice VLAN.

voice-config voice-vlan vlan-id { disable | enable }

Optional.

Not configured by default.

6.     Specify the failover IP address and dialer string.

voice-config fail-over ip-address dialer-string

Optional.

No failover IP address or dialer string is specified by default.

 

 

NOTE:

Specify an IP address for the network calling processor before performing other configurations.

 

Configuring the TFTP server and bootfile name for the client

For the DHCP server to support client auto-configuration, you must specify the IP address or name of a TFTP server and the bootfile name in the DHCP address pool. You do not need to perform any configuration on the DHCP client.

The DHCP client uses these parameters to contact the TFTP server and request the configuration file used for system initialization.

1.      When a router starts up without loading any configuration file, the system sets an active interface (such as the interface of the default VLAN or a Layer 3 Ethernet interface) as the DHCP client to request from the DHCP server for parameters, such as an IP address and name of a TFTP server, and the bootfile name.

2.      After getting related parameters, the DHCP client will send a TFTP request to obtain the configuration file from the specified TFTP server for system initialization. If the client cannot get such parameters, it will perform system initialization without loading any configuration file.

When Option 55 in the client’s request contains parameters of Option 66, Option 67, or Option 150, the DHCP server will return the IP address or name of the specified TFTP server, and bootfile name to the client.

To configure the IP address and name of the TFTP server and the bootfile name in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Specify the IP address or the name of the TFTP server

·       Specify the IP address of the TFTP server:
tftp-server ip-address
ip-address

·       Specify the name of the TFTP server:
tftp-server domain-name
domain-name

Use either command

Not specified by default

4.     Specify the bootfile name.

bootfile-name bootfile-name

Not specified by default

 

Configuring self-defined DHCP options

By configuring self-defined DHCP options, you can

·           Define new DHCP options. New configuration options will come out with DHCP development. To support these new options, you can add them into the attribute list of the DHCP server.

·           Define existing DHCP options. Vendors use Option 43 to define options that have no unified definitions in RFC 2132. The self-defined DHCP option enables DHCP clients to obtain vendor-specific information.

·           Extend existing DHCP options. When the current DHCP options cannot meet the customers’ requirements (for example, you cannot use the dns-list command to configure more than eight DNS server addresses), you can configure a self-defined option for extension.

To configure a self-defined DHCP option in the DHCP address pool:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter DHCP address pool view.

dhcp server ip-pool pool-name [ extended ]

N/A

3.     Configure a self-defined DHCP option.

option code { ascii ascii-string | hex hex-string&<1-16> | ip-address ip-address&<1-8> }

No DHCP option is configured by default.

 

Table 1 Description of common options

Option

Option name

Corresponding command

Command parameter

3

Router Option

gateway-list

ip-address

6

Domain Name Server Option

dns-list

ip-address

15

Domain Name

domain-name

ascii

44

NetBIOS over TCP/IP Name Server Option

nbns-list

ip-address

46

NetBIOS over TCP/IP Node Type Option

netbios-type

hex

66

TFTP server name

tftp-server

ascii

67

Bootfile name

bootfile-name

ascii

43

Vendor Specific Information

N/A

hex

 

CAUTION

CAUTION:

Be cautious When you configure self-defined DHCP options because such configuration may affect the operation of DHCP.

 

Enabling DHCP

Enable DHCP before performing other configurations.

To enable DHCP:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable DHCP.

dhcp enable

Disabled by default

 

Enabling the DHCP server on an interface

With the DHCP server enabled on an interface, upon receiving a client’s request, the DHCP server will assign an IP address from its address pool to the DHCP client.

To enable the DHCP server on an interface:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable the DHCP server on an interface.

dhcp select server global-pool [ subaddress ]

Optional

Enabled by default

 

 

NOTE:

If a DHCP relay agent exists between the DHCP server and client, the DHCP server, regardless of whether the subaddress keyword is used, will select an IP address from the address pool containing the primary IP address of the DHCP relay agent’s interface (connected to the client) for a requesting client.

 

 

NOTE:

When the DHCP server and client are on the same subnet:

·       With the keyword subaddress specified, the DHCP server will preferably assign an IP address from an address pool that resides on the same subnet as the primary IP address of the server interface (connecting to the client). If the address pool contains no assignable IP address, the server assigns an IP address from an address pool that resides on the same subnet as the secondary IP addresses of the server interface. If the interface has multiple secondary IP addresses, each address pool is tried in turn for address allocation.

·       Without the keyword subaddress specified, the DHCP server can only assign an IP address from the address pool that resides on the same subnet as the primary IP address of the server interface.

 

Applying an extended address pool on an interface

After you create an extended address pool and apply it on an interface, the DHCP server, upon receiving a client's request on the interface, attempts to assign the client the statically bound IP address first and then an IP address from the specified address pool. If no IP address is available, address allocation fails, and the DHCP server will not assign the client any IP address from other address pools.

To apply an extended address pool on an interface:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Apply an extended address pool on the interface.

dhcp server apply ip-pool pool-name

Optional.

By default, the DHCP server has no extended address pool applied on its interface, and assigns an IP address from a common address pool to a requesting client.

 

 

NOTE:

·       This function is available only on a Layer 3 Ethernet interface (or subinterface), or a VLAN interface.

·       Only an extended address pool can be applied on the interface. The address pool to be referenced must already exist.

 

Configuring the DHCP server security functions

Configuration prerequisites

Before performing this configuration, complete the following configurations on the DHCP server:

·           Enable DHCP

·           Configure the DHCP address pool

Enabling unauthorized DHCP server detection

Unauthorized DHCP servers on a network may assign wrong IP addresses to DHCP clients.

With unauthorized DHCP server detection enabled, the DHCP server checks whether a DHCP request contains Option 54 (Server Identifier Option). If yes, the DHCP server records the IP address in the option, which is the IP address of the DHCP server that assigned an IP address to the DHCP client and records the receiving interface. The administrator can use this information to check for unauthorized DHCP servers.

To enable unauthorized DHCP server detection:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable unauthorized DHCP server detection.

dhcp server detect

Disabled by default

 

 

NOTE:

With the unauthorized DHCP server detection enabled, the router logs each detected DHCP server once. The administrator can use the log information to find unauthorized DHCP servers.

 

Configuring IP address conflict detection

With IP address conflict detection enabled, the DHCP server pings each IP address to be assigned using ICMP. If the server receives a response within the specified period, the server selects and pings another IP address. If not, the server pings the IP addresses once again until the specified number of ping packets are sent. If still no response is received, the server assigns the IP address to the requesting client (The DHCP client probes the IP address by sending gratuitous ARP packets).

To configure IP address conflict detection:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Specify the number of ping packets.

dhcp server ping packets number

Optional.

One ping packet by default.

The value 0 indicates that no ping operation is performed.

3.     Configure a timeout waiting for ping responses.

dhcp server ping timeout milliseconds

Optional.

500 ms by default.

The value 0 indicates that no ping operation is performed.

 

Configuring the DHCP server to work with authorized ARP

Only the clients that obtain an IP address from the DHCP server are considered as authorized clients. If the DHCP server also serves as the gateway, it can work with authorized ARP to block unauthorized clients and prevent ARP spoofing attacks.

To enable the DHCP server to work with authorized ARP, perform the following:

·           Configure the DHCP server to support authorized ARPThe DHCP server notifies authorized ARP to add/delete/change authorized ARP entries when adding/deleting/changing IP address leases.

·           Enable authorized ARPThe ARP automatic learning function is disabled after you enable authorized ARP. ARP entries are added according to the IP address leases specified by the DHCP server, to avoid learning incorrect ARP entries.

The DHCP server works with authorized ARP for the following purposes:

·           Only the clients that have obtained IP addresses from the DHCP server and have their ARP entries recorded on the DHCP server are authorized clients and can access the network normally.

·           The clients that have not obtained IP addresses from the DHCP server are considered unauthorized clients and are unable to access the network.

·           Disabling ARP automatic learning prevents network attacks such as IP/MAC address spoofing attacks, and only authorized users can access the network.

To configure the DHCP server to work with authorized ARP:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable the DHCP server to work with authorized ARP.

dhcp update arp

Not enabled by default

4.     Enable authorized ARP.

arp authorized enable

Disabled by default

 

 

NOTE:

·       Authorized ARP can only be configured on Layer 3 interfaces.

·       When the working mode of the interface is changed from DHCP server to DHCP relay agent, neither the IP address leases nor the authorized ARP entries will be deleted. However, these ARP entries may conflict with new ARP entries generated on the DHCP relay agent. Therefore, H3C recommends you delete the existing IP address leases by using the reset dhcp server ip-in-use command when you change the interface working mode to DHCP relay agent.

·       Disabling the DHCP server to support authorized ARP will not delete the IP address leases, but will delete the corresponding authorized ARP entries.

·       For more information about authorized ARP, see Security Configuration Guide. For more information about the arp authorized enable command, see Security Command Reference.

 

Enabling Option 82 handling

With Option 82 handling enabled, when the DHCP server receives a request with Option 82, it adds Option 82 into the response.

If the server is configured to ignore Option 82, it will assign an IP address to the client without adding Option 82 in the response message.

Configuration prerequisites

Before performing this configuration, complete the following configuration on the DHCP server:

·           Enable DHCP

·           Configure the DHCP address pool

Enable Option 82 handling

To enable the DHCP server to handle Option 82:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable the server to handle Option 82.

dhcp server relay information enable

Optional

Enabled by default

 

 

NOTE:

Supporting Option 82 requires configuring both the DHCP server and relay agent (or the router enabled with DHCP snooping). For more information, see the chapter “DHCP relay agent configuration.”

 

Specifying the threshold for sending trap messages

Configuration prerequisites

Before performing the configuration, use the snmp-agent target-host command to specify the destination address of the trap messages. For more information about the command, see Network Management and Monitoring Command Reference.

Configuration procedure

A DHCP server sends trap messages to the network management server when one of the following items reaches the specified threshold:

·           The ratio of successfully allocated IP addresses to received DHCP requests

·           The average IP address utilization of the address pool

·           The maximum IP address utilization of the address pool

Trap messages help network administrators know the latest usage information of the DHCP server.

To specify the threshold for sending trap messages:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Specify the threshold for sending trap messages to the network management server.

dhcp server threshold { allocated-ip threshold-value | average-ip-use threshold-value | max-ip-use threshold-value }

Optional

Disabled by default

 

Displaying and maintaining the DHCP server

 

Task

Command

Remarks

Display information about IP address conflicts.

display dhcp server conflict { all | ip ip-address } [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about lease expiration.

display dhcp server expired { all | ip ip-address | pool [ pool-name ] } [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about assignable IP addresses.

display dhcp server free-ip [ | { begin | exclude | include } regular-expression ]

Available in any view

Display IP addresses excluded from automatic allocation in the DHCP address pool.

display dhcp server forbidden-ip [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about bindings.

display dhcp server ip-in-use { all | ip ip-address | pool [ pool-name ] } [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about DHCP server statistics.

display dhcp server statistics [ | { begin | exclude | include } regular-expression ]

Available in any view

Display tree organization information of address pool(s).

display dhcp server tree { all | pool [ pool-name ] } [ | { begin | exclude | include } regular-expression ]

Available in any view

Clear information about IP address conflicts.

reset dhcp server conflict { all | ip ip-address }

Available in user view

Clear information about dynamic bindings.

reset dhcp server ip-in-use { all | ip ip-address | pool [ pool-name ] }

Available in user view

Clear information about DHCP server statistics.

reset dhcp server statistics

Available in user view

 

 

NOTE:

Using the save command does not save DHCP server lease information. Therefore, when the system boots up or the reset dhcp server ip-in-use command is executed, no lease information will be available in the configuration file. The server will deny the request for lease extension from a client and the client needs to request an IP address again.

 

DHCP server configuration examples

DHCP networking involves two types:

·           The DHCP server and client are on the same subnet and perform direct message delivery.

·           The DHCP server and client are not on the same subnet and communicate with each other via a DHCP relay agent.

The DHCP server configuration for the two types is the same.

Static IP address assignment configuration example

Network requirements

As shown in Figure 11, Router A (DHCP client) and Router B (BOOTP client) obtain a static IP address, DNS server address, and gateway address from Device (DHCP server) respectively.

The MAC address of interface GigabitEthernet 3/1/1 on Router B:

000f-e200-01c0.

The client ID of interface GigabitEthernet 3/1/1 on Router A:

3030-3066-2e65-3230-302e-3030-3032-2d45-7468-6572-6e65-7430-2f30.

Figure 11 Network diagram

 

Configuration procedure

1.      Configure the IP address of GigabitEthernet 3/1/1 on Device.

<Device> system-view

[Device] interface GigabitEthernet 3/1/1

[Device-GigabitEthernet3/1/1] ip address 10.1.1.1 25

[Device-GigabitEthernet3/1/1] quit

2.      Configure the DHCP server:

# Enable DHCP.

[Device] dhcp enable

# Enable the DHCP server on interface GigabitEthernet 3/1/1.

[Device] interface Gigabitethernet 3/1/1

[Device-Gigabitethernet3/1/1] dhcp select server global-pool

[Device-Gigabitethernet3/1/1] quit

# Create DHCP address pool 0, and configure a static binding, DNS server and gateway in it.

[Device] dhcp server ip-pool 0

[Device-dhcp-pool-0] static-bind ip-address 10.1.1.5

[Device-dhcp-pool-0] static-bind client-identifier 3030-3066-2e65-3230-302e-3030-3032-2d45-7468-6572-6e65-7430-2f30

[Device-dhcp-pool-0] dns-list 10.1.1.2

[Device-dhcp-pool-0] gateway-list 10.1.1.126

[Device-dhcp-pool-0] quit

# Create DHCP address pool 1, and configure a static binding, DNS server and gateway in it.

[Device] dhcp server ip-pool 1

[Device-dhcp-pool-1] static-bind ip-address 10.1.1.6

[Device-dhcp-pool-1] static-bind mac-address 000f-e200-01c0

[Device-dhcp-pool-1] dns-list 10.1.1.2

[Device-dhcp-pool-1] gateway-list 10.1.1.126

3.      Verification

After the preceding configuration is complete, Router A can obtain IP address 10.1.1.5 and other network parameters, and Router B can obtain IP address 10.1.1.6 and other network parameters from Device. You can use the display dhcp server ip-in-use command on the DHCP server to view the IP addresses assigned to the clients.

Dynamic IP address assignment configuration example

Network requirements

·           As shown in Figure 12, the DHCP server (Router A) assigns IP address to clients on subnet 10.1.1.0/24, which is subnetted into 10.1.1.0/25 and 10.1.1.128/25.

·           The IP addresses of GigabitEthernet 3/1/1 and GigabitEthernet 3/1/2 on Router A are 10.1.1.1/25 and 10.1.1.129/25 respectively.

·           In subnet 10.1.1.0/25, the address lease duration is ten days and twelve hours, domain name suffix aabbcc.com, DNS server address 10.1.1.2/25, WINS server address 10.1.1.4/25, and gateway address 10.1.1.126/25.

·           In the subnet 10.1.1.128/25, the address lease duration is five days, domain name suffix aabbcc.com, DNS server address 10.1.1.2/25, and gateway address 10.1.1.254/25 and there is no WINS server address.

·           The domain name suffix and DNS server address on subnets 10.1.1.0/25 and 10.1.1.128/25 are the same. Therefore, the domain name suffix and DNS server address need to be configured only for subnet 10.1.1.0/24. Subnet 10.1.1.128/25 can inherit the configuration of subnet 10.1.1.0/24.

 

 

NOTE:

In this example, the number of requesting clients connected to GigabitEthernet 3/1/1 should be less than 122, and that of clients connected to GigabitEthernet 3/1/2 less than 124.

 

Figure 12 DHCP network

 

Configuration procedure

1.      Specify IP addresses for interfaces. (Details not shown)

2.      Configure the DHCP server:

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Enable the DHCP server on GigabitEthernet 3/1/1 and GigabitEthernet3/1/2.

[RouterA] interface GigabitEthernet 3/1/1

[RouterA-GigabitEthernet3/1/1] dhcp select server global-pool

[RouterA-GigabitEthernet3/1/1] quit

[RouterA] interface GigabitEthernet 3/1/2

[RouterA-GigabitEthernet3/1/2] dhcp select server global-pool

[RouterA-GigabitEthernet3/1/2] quit

# Exclude IP addresses from dynamic allocation (addresses of the DNS server, WINS server, and gateways).

[RouterA] dhcp server forbidden-ip 10.1.1.2

[RouterA] dhcp server forbidden-ip 10.1.1.4

[RouterA] dhcp server forbidden-ip 10.1.1.126

[RouterA] dhcp server forbidden-ip 10.1.1.254

# Configure DHCP address pool 0 (address range, client domain name suffix and DNS server address).

[RouterA] dhcp server ip-pool 0

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

[RouterA-dhcp-pool-0] domain-name aabbcc.com

[RouterA-dhcp-pool-0] dns-list 10.1.1.2

[RouterA-dhcp-pool-0] quit

# Configure DHCP address pool 1 (address range, gateway, WINS server, and lease duration).

[RouterA] dhcp server ip-pool 1

[RouterA-dhcp-pool-1] network 10.1.1.0 mask 255.255.255.128

[RouterA-dhcp-pool-1] gateway-list 10.1.1.126

[RouterA-dhcp-pool-1] expired day 10 hour 12

[RouterA-dhcp-pool-1] nbns-list 10.1.1.4

[RouterA-dhcp-pool-1] quit

# Configure DHCP address pool 2 (address range, gateway and lease duration).

[RouterA] dhcp server ip-pool 2

[RouterA-dhcp-pool-2] network 10.1.1.128 mask 255.255.255.128

[RouterA-dhcp-pool-2] expired day 5

[RouterA-dhcp-pool-2] gateway-list 10.1.1.254

3.      Verification

After the preceding configuration is complete, clients on networks 10.1.1.0/25 and 10.1.1.128/25 can obtain IP addresses on the corresponding network and other network parameters from Router A. You can use the display dhcp server ip-in-use command on the DHCP server to view the IP addresses assigned to the clients.

Self-defined option configuration example

Network requirements

As shown in Figure 13, the DHCP client (Router B) obtains its IP address and PXE server addresses from the DHCP server (Router A). The IP address belongs to subnet 10.1.1.0/24. The PXE server addresses are 1.2.3.4 and 2.2.2.2.

The DHCP server assigns PXE server addresses to DHCP clients through Option 43, a self-defined option. The format of Option 43 and that of the PXE server address sub-option are shown in Figure 5 and Figure 7, respectively. The value of Option 43 configured on the DHCP server in this example is 80 0B 00 00 02 01 02 03 04 02 02 02 02. The number 80 is the value of the sub-option type. The number 0B is the value of the sub-option length. The numbers 00 00 are the value of the PXE server type. The number 02 indicates the number of servers. The numbers 01 02 03 04 02 02 02 02 indicate that the PXE server addresses are 1.2.3.4 and 2.2.2.2.

Figure 13 Network diagram

 

Configuration procedure

1.      Specify IP address for interface GigabitEthernet 3/1/1. (Details not shown)

2.      Configure the DHCP server:

# Enable DHCP.

<Device> system-view

[Device] dhcp enable

# Enable the DHCP server on GigabitEthernet 3/1/1.

[RouterA] interface GigabitEthernet 3/1/1

[RouterA-GigabitEthernet3/1/1] dhcp select server global-pool

[RouterA-GigabitEthernet3/1/1] quit

# Configure DHCP address pool 0.

[Device] dhcp server ip-pool 0

[Device-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0

[Device-dhcp-pool-0] option 43 hex 80 0B 00 00 02 01 02 03 04 02 02 02 02

3.      Verification

After the preceding configuration is complete, Router B can obtain its IP address on 10.1.1.0/24 and PXE server addresses from Router A. You can use the display dhcp server ip-in-use command on the DHCP server to view the IP addresses assigned to the clients.

Troubleshooting DHCP server configuration

Symptom

A client’s IP address obtained from the DHCP server conflicts with another IP address.

Analysis

A host on the subnet may have the same IP address.

Solution

1.      Disable the client’s network adapter or disconnect the client’s network cable. Ping the IP address of the client from another host to check whether there is a host using the same IP address.

2.      If a ping response is received, the IP address has been manually configured on a host. Execute the dhcp server forbidden-ip command on the DHCP server to exclude the IP address from dynamic allocation.

3.      Enable the network adapter or connect the network cable. Release the IP address and obtain another one on the client. Take WINDOW XP as an example, run cmd to enter DOS window. Type ipconfig/release to relinquish the IP address and then ipconfig/renew to obtain another IP address.

 


Configuring DHCP relay agent

 

 

NOTE:

The DHCP relay agent configuration is supported only on Layer 3 Ethernet interfaces (or subinterfaces), virtual Ethernet interfaces (or subinterfaces), VLAN interfaces, Layer 3 aggregate interfaces, and serial interfaces.

 

Introduction to DHCP relay agent

Application environment

Via a relay agent, DHCP clients communicate with a DHCP server on another subnet to obtain configuration parameters. Thus, DHCP clients on different subnets can contact the same DHCP server rather than having a DHCP server on each subnet.

 

 

NOTE:

An MCE device serving as the DHCP relay agent can forward DHCP packets not only between a DHCP server and clients on a private network, but also between a DHCP server and clients on a public network. Note that the IP address ranges of the public and private networks or those of private networks cannot overlap each other. For more information about MCE, see MPLS Configuration Guide.

 

Fundamentals

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

Figure 14 DHCP relay agent application

 

No matter whether a relay agent exists or not, the DHCP server and client interact with each other in a similar way (see the chapter “DHCP overview”).

Figure 15 DHCP relay agent work process

 

1.      After receiving a DHCP-DISCOVER or DHCP-REQUEST broadcast message from a DHCP client, the DHCP relay agent fills the giaddr field of the message with its IP address and forwards the message to the designated DHCP server in unicast mode.

2.      Based on the giaddr field, the DHCP server returns an IP address and other configuration parameters to the relay agent, and the relay agent conveys them to the client.

DHCP relay agent support for Option 82

Option 82 records the location information of the DHCP client, letting the administrator locate the DHCP client for security control and accounting purposes. For more information, see “Relay agent option (Option 82).”

If the DHCP relay agent supports Option 82, it handles a client’s request according to the contents defined in Option 82, if any. The handling strategies are described in Table 2.

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

Table 2 Handling strategies of the DHCP relay agent

If a client’s requesting message has…

Handling strategy

Padding format

The DHCP relay agent will…

Option 82

Drop

Random

Drop the message.

Keep

Random

Forward the message without changing Option 82.

Replace

normal

Forward the message after replacing the original Option 82 with the Option 82 padded in normal format.

verbose

Forward the message after replacing the original Option 82 with the Option 82 padded in verbose format.

user-defined

Forward the message after replacing the original Option 82 with the user-defined Option 82.

no Option 82

N/A

normal

Forward the message after adding the Option 82 padded in normal format.

N/A

verbose

Forward the message after adding the Option 82 padded in verbose format.

N/A

user-defined

Forward the message after adding the user-defined Option 82.

 

DHCP relay agent configuration task list

Complete the following tasks to configure the DHCP relay agent:

 

Task

Remarks

Enabling DHCP

Required

Enabling the DHCP relay agent on an interface

Required

Correlating a DHCP server group with a relay agent interface

Required

Configuring the DHCP relay agent security functions

Optional

Enabling offline detection

Optional

Configuring the DHCP relay agent to release an IP address

Optional

Configuring the DHCP relay agent to support Option 82

Optional

 

Enabling DHCP

Enable DHCP before performing other configurations related to the DHCP relay agent.

To enable DHCP:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable DHCP.

dhcp enable

Disabled by default

 

Enabling the DHCP relay agent on an interface

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

To enable the DHCP relay agent on an interface:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable the DHCP relay agent on the current interface.

dhcp select relay

With DHCP enabled, interfaces work in the DHCP server mode.

 

 

NOTE:

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

 

Correlating a DHCP server group with a relay agent interface

To improve reliability, you can specify several DHCP servers as a group on the DHCP relay agent and correlate a relay agent interface with the server group. When the interface receives request messages from clients, the relay agent will forward them to all the DHCP servers of the group.

To correlate a DHCP server group with a relay agent interface:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Create a DHCP server group and add a server into the group.

dhcp relay server-group group-id ip ip-address

Not created by default.

3.     Enter interface view.

interface interface-type interface-number

N/A

4.     Correlate the DHCP server group with the current interface.

dhcp relay server-select group-id

By default, no interface is correlated with any DHCP server group.

 

 

NOTE:

·       You can specify up to twenty DHCP server groups on the relay agent.

·       By executing the dhcp relay server-group command repeatedly, you can specify up to eight DHCP server addresses for each DHCP server group.

·       The IP addresses of DHCP servers and those of relay agent’s interfaces that connect DHCP clients cannot be on the same subnet. Otherwise, the client cannot obtain an IP address.

·       A DHCP server group can correlate with one or multiple DHCP relay agent interfaces, while a relay agent interface can only correlate with one DHCP server group. Using the dhcp relay server-select command repeatedly overwrites the previous configuration. However, if the specified DHCP server group does not exist, the interface still uses the previous correlation.

·       The group-id argument in the dhcp relay server-select command is configured by the dhcp relay server-group command.

 

Configuring the DHCP relay agent security functions

Configure address check

Address check can block illegal hosts from accessing external networks.

With this feature enabled, the DHCP relay agent can dynamically record clients’ IP-to-MAC bindings after they obtain IP addresses through DHCP. You can also configure static IP-to-MAC bindings on the DHCP relay agent so that users can access external networks using fixed IP addresses.

Upon receiving a packet from a host, the DHCP relay agent checks the source IP and MAC addresses in the packet against the recorded dynamic and static bindings. If no match is found, the DHCP relay agent does not learn the ARP entry of the host, and will not forward any reply to the host, which thus cannot access external networks via the DHCP relay agent.

To create a static binding and enable address check:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Create a static binding.

dhcp relay security static ip-address mac-address [ interface interface-type interface-number ]

Optional.

No static binding is created by default.

3.     Enter interface view.

interface interface-type interface-number

N/A

4.     Enable address check.

dhcp relay address-check enable

Disabled by default.

 

 

NOTE:

·       The dhcp relay address-check enable command can be executed only on Layer 3 Ethernet interfaces (including sub-interfaces) and VLAN interfaces.

·       Before enabling address check on an interface, you must enable the DHCP service, and enable the DHCP relay agent on the interface; otherwise, the address check configuration is ineffective.

·       The dhcp relay address-check enable command only checks IP and MAC addresses but not interfaces.

·       When using the dhcp relay security static command to bind an interface to a static binding entry, make sure that the interface is configured as a DHCP relay agent; otherwise, address entry conflicts may occur.

 

Configuring periodic refresh of dynamic client entries

A DHCP client unicasts a DHCP-RELEASE message to the DHCP server when releasing its dynamically obtained IP address. The DHCP relay agent simply conveys the message to the DHCP server and does not remove the IP-to-MAC binding. To solve this problem, the periodic refresh of dynamic client entries feature is introduced.

With this feature, the DHCP relay agent uses the IP address of a client and the MAC address of the DHCP relay interface to periodically send a DHCP-REQUEST message to the DHCP server.

·           If the server returns a DHCP-ACK message or does not return any message within a specified interval, the DHCP relay agent ages out the client entry.

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

To configure periodic refresh of dynamic client entries:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable periodic refresh of dynamic client entries.

dhcp relay security refresh enable

Optional.

Enabled by default.

3.     Configure the refresh interval.

dhcp relay security tracker { interval | auto }

Optional.

auto by default. (auto interval is calculated by the relay agent according to the number of client entries.)

 

Configuring the DHCP relay agent to work with authorized ARP

Only the clients that obtain an IP address from the DHCP server are considered as authorized clients. If the DHCP relay agent serves as the gateway, it can work with authorized ARP to block unauthorized clients and prevent ARP spoofing attacks.

To enable the DHCP relay agent to work with authorized ARP, perform the following:

·           Configure the DHCP relay agent to support authorized ARP: With this function enabled, the DHCP relay agent automatically records DHCP clients’ IP-to-MAC bindings (called client entries), and notifies authorized ARP to add/delete/change authorized ARP entries when adding/deleting/changing client entries.

·           Enable authorized ARP: The ARP automatic learning function is disabled after you enable authorized ARP. ARP entries are added according to the client entries recorded by the DHCP relay agent to avoid learning incorrect ARP entries.

The DHCP relay agent works with authorized ARP for the following purposes:

·           Only the clients that have obtained IP addresses from the DHCP server and have their IP-to-MAC bindings recorded on the DHCP relay agent are authorized clients and can access the network.

·           The clients that have not obtained IP addresses from the DHCP server are considered unauthorized clients and are unable to access the network.

·           Disabling ARP automatic learning prevents network attacks such as IP/MAC address spoofing attacks, and only authorized users can access the network, enhancing network security.

To configure the DHCP relay agent to work with authorized ARP:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable the DHCP relay agent to work with authorized ARP.

dhcp update arp

Not enabled by default

4.     Enable authorized ARP.

arp authorized enable

Not enabled by default

 

 

NOTE:

·       Authorized ARP can only be configured on Layer 3 Ethernet interfaces.

·       Disabling the DHCP relay agent to support authorized ARP will delete the corresponding authorized ARP entries.

·       Since the DHCP relay agent does not notify the authorized ARP module of the static bindings, you need to configure the corresponding static ARP entries for authorized users that have IP addresses statically specified.

·       For more information about authorized ARP, see Security Configuration Guide. For more information about the arp authorized enable command, see Security Command Reference.

 

Enabling unauthorized DHCP server detection

Unauthorized DHCP servers may assign wrong IP addresses to DHCP clients.

With unauthorized DHCP servers detection enabled, the DHCP relay agent checks whether a request contains Option 54 (Server Identifier Option). If yes, the DHCP relay agent records the IP address in the option, which is the IP address of the DHCP server that assigned an IP address to the DHCP client, and records the receiving interface. The administrator can use this information to check for unauthorized DHCP servers.

To enable unauthorized DHCP server detection:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enable unauthorized DHCP server detection.

dhcp relay server-detect

Disabled by default

 

 

NOTE:

With unauthorized DHCP server detection enabled, the relay agent logs each detected DHCP server once. The administrator can use the log information to find unauthorized DHCP servers.

 

Enabling DHCP starvation attack protection

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 may also fail to work because of exhaustion of system resources.

·           To relieve a DHCP starvation attack that uses DHCP packets encapsulated with different source MAC addresses, you can limit the number of ARP entries that a Layer 3 interface can learn or MAC addresses that a Layer 2 port can learn. You can also configure an interface that has learned the maximum MAC addresses to discard packets whose source MAC addresses are not in the MAC address table.

·           To prevent a DHCP starvation attack that uses DHCP requests encapsulated with the same source MAC address, enable MAC address check on the DHCP relay agent. With this function enabled, the DHCP relay agent compares the chaddr field of a received DHCP request with the source MAC address field of the frame. If they are the same, the DHCP relay agent decides this request as valid and forwards it to the DHCP server; if not, the DHCP request is discarded.

To enable MAC address check:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable MAC address check.

dhcp relay check mac-address

Disabled by default

 

 

NOTE:

DHCP relay agents change the source MAC addresses when forwarding DHCP packets. Therefore, you can enable MAC address check only on a DHCP relay agent directly connected to DHCP clients. Otherwise, valid DHCP packets may be discarded and clients cannot obtain IP addresses.

 

Enabling offline detection

The DHCP relay agent checks whether a use is online by learning the ARP entry. When an ARP entry is aged out, the corresponding client is considered to be offline.

With this function enabled on an interface, the DHCP relay agent removes a client’s IP-to-MAC entry when it is aged out, and sends a DHCP-RELEASE message to the DHCP server to release the IP address of the client.

To enable offline detection:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable offline detection.

dhcp relay client-detect enable

Disabled by default

 

 

NOTE:

Removing an ARP entry manually does not remove the corresponding client’s IP-to-MAC binding. When the client goes offline, use the undo dhcp relay security command to remove the IP-to-MAC binding manually.

 

Configuring the DHCP relay agent to release an IP address

You can configure the relay agent to release a client’s IP address. The relay agent sends a DHCP-RELEASE message that contains the specified IP address. Upon receiving the DHCP-RELEASE message, the DHCP server releases the IP address; meanwhile, the client entry is removed from the DHCP relay agent.

To configure the DHCP relay agent to send DHCP-RELEASE messages:

 

Step

Command

1.     Enter system view.

system-view

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

dhcp relay release ip client-ip

 

 

NOTE:

·       The IP address to be released must be available in a dynamic client entry.

·       Dynamic client entries can be generated only after you enable address check, authorized ARP, or IP source guard on the DHCP relay agent. For more information about IP source guard, see Security Configuration Guide.

 

Configuring the DHCP relay agent to support Option 82

Configuration prerequisites

Before performing this configuration, complete the following tasks:

·           Enabling DHCP

·           Enabling the DHCP relay agent on the specified interface

·           Correlating a DHCP server group with relay agent interfaces

Configuration procedure

To configure the DHCP relay agent to support Option 82:

 

Step

Command

Remarks

1.     Enter system view.

system-view

N/A

2.     Enter interface view.

interface interface-type interface-number

N/A

3.     Enable the relay agent to support Option 82.

dhcp relay information enable

Disabled by default.

4.     Configure the handling strategy for requesting messages containing Option 82.

dhcp relay information strategy { drop | keep | replace }

Optional.

replace by default.

5.     Configure non-user-defined Option 82.

·       Configure the padding format for Option 82:
dhcp relay information format
{ normal | verbose [ node-identifier { mac | sysname | user-defined node-identifier } ] }

·       Configure the code type for the circuit ID sub-option:
dhcp relay information circuit-id format-type { ascii | hex }

·       Configure the code type for the remote ID sub-option:
dhcp relay information remote-id format-type { ascii | hex }

Optional.

By default,

·       The padding format for Option 82 is normal.

·       The code type for the circuit ID sub-option depends on the padding format of Option 82. Each field has its own code type.

·       The code type for the remote ID sub-option is hex.

The code type configuration for the circuit ID sub-option and for the remote ID sub-option apply to non-user-defined Option 82 only.

6.     Configure user-defined Option 82.

·       Configure the padding content for the circuit ID sub-option:
dhcp relay information circuit-id string
circuit-id

·       Configure the padding content for the remote ID sub-option:
dhcp relay information remote-id string { remote-id | sysname }

Optional.

By default, the padding content depends on the padding format of Option 82.

 

 

NOTE:

·       To support Option 82, perform related configuration on both the DHCP server and relay agent. For DHCP server configuration of this kind, see Enabling Option 82 handling.

·       If the handling strategy of the DHCP relay agent is configured as replace, you need to configure a padding format for Option 82. If the handling strategy is keep or drop, you need not configure any padding format.

·       If sub-option 1 (node identifier) of Option 82 is padded with the device name (sysname) of a node, the device name must contain no spaces. Otherwise, the DHCP relay agent will drop the message.

 

Displaying and maintaining the DHCP relay agent

 

Task

Command

Remarks

Display information about DHCP server groups correlated to a specified or all interfaces.

display dhcp relay { all | interface interface-type interface-number } [ | { begin | exclude | include } regular-expression ]

Available in any view

Display Option 82 configuration information on the DHCP relay agent.

display dhcp relay information { all | interface interface-type interface-number } [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about bindings of DHCP relay agents.

display dhcp relay security [ ip-address | dynamic | static ] [ | { begin | exclude | include } regular-expression ]

Available in any view

Display statistics information about bindings of DHCP relay agents.

display dhcp relay security statistics [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about the refreshing interval for entries of dynamic IP-to-MAC bindings.

display dhcp relay security tracker [ | { begin | exclude | include } regular-expression ]

Available in any view

Display information about the configuration of a specified or all DHCP server groups.

display dhcp relay server-group { group-id | all } [ | { begin | exclude | include } regular-expression ]

Available in any view

Display packet statistics on relay agent.

display dhcp relay statistics [ server-group { group-id | all } ] [ | { begin | exclude | include } regular-expression ]

Available in any view

Clear packet statistics from relay agent.

reset dhcp relay statistics [ server-group group-id ]

Available in user view

 

DHCP relay agent configuration example

Network requirements

As shown in Figure 16, DHCP clients reside on network 10.10.1.0/24. The IP address of the DHCP server is 10.1.1.1/24. Because the DHCP clients reside on a different network with the DHCP server, a DHCP relay agent is deployed to forward messages between DHCP clients and the DHCP server. GigabitEthernet 3/1/1 of the DHCP relay agent (Router A) connects to the subnet where DHCP clients reside. The IP address of GigabitEthernet 3/1/1 is 10.10.1.1/24, and the IP address of GigabitEthernet 3/1/2 is 10.1.1.2/24.

Figure 16 Network diagram

 

Configuration procedure

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Add DHCP server 10.1.1.1 into DHCP server group 1

[RouterA] dhcp relay server-group 1 ip 10.1.1.1

# Enable the DHCP relay agent on GigabitEthernet 3/1/1.

[RouterA] interface GigabitEthernet 3/1/1

[RouterA-GigabitEthernet3/1/1] dhcp select relay

# Correlate DHCP server group 1 with GigabitEthernet 3/1/1.

[RouterA] interface GigabitEthernet 3/1/1

[RouterA-GigabitEthernet3/1/1] dhcp relay server-select 1

After the preceding configuration is complete, DHCP clients can obtain IP addresses and other network parameters through the DHCP relay agent from the DHCP server. You can use the display dhcp relay security command to view clients’ address bindings on the DHCP relay agent, and use the display dhcp relay statistics command to view statistics of DHCP packets forwarded by the DHCP relay agent.

 

 

NOTE:

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

·       Configurations on the DHCP server are also required to guarantee the client-server communication via the DHCP relay agent. For DHCP server configuration information, see the chapter “DHCP server configuration.”

 

DHCP relay agent Option 82 support configuration example

Network requirements

·           As shown in Figure 16, enable Option 82 on the DHCP relay agent (Router A).

·           Configure the handling strategy for DHCP requests containing Option 82 as replace.

·           Configure the padding content for the circuit ID sub-option as company001 and for the remote ID sub-option as device001.

·           Router A forwards DHCP requests to the DHCP server (Router B) after replacing Option 82 in the requests, so that the DHCP clients can obtain IP addresses.

Configuration procedure

# Enable DHCP.

<RouterA> system-view

[RouterA] dhcp enable

# Add DHCP server 10.1.1.1 into DHCP server group 1.

[RouterA] dhcp relay server-group 1 ip 10.1.1.1

# Enable the DHCP relay agent on GigabitEthernet 2/1/1.

[RouterA] interface GigabitEthernet 2/1/1

[RouterA-GigabitEthernet2/1/1] dhcp select relay

# Correlate GigabitEthernet 2/1/1 to DHCP server group 1.

[RouterA-GigabitEthernet2/1/1] dhcp relay server-select 1

# Enable the DHCP relay agent to support Option 82, and perform Option 82-related configurations.

[RouterA-GigabitEthernet2/1/1] dhcp relay information enable

[RouterA-GigabitEthernet2/1/1] dhcp relay information strategy replace

[RouterA-GigabitEthernet2/1/1] dhcp relay information circuit-id string company001

[RouterA-GigabitEthernet2/1/1] dhcp relay information remote-id string device001

 

 

NOTE:

Configurations on the DHCP server are also required to make the Option 82 configurations function normally.

 

Troubleshooting DHCP relay agent configuration

Symptom

DHCP clients cannot obtain any configuration parameters via the DHCP relay agent.

Analysis

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

Solution

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:

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

·           The address pool on the same subnet where DHCP clients reside is available on the DHCP server.

·           The DHCP server and DHCP relay agent are reachable to each other.

·           The relay agent interface connected to DHCP clients is correlated with a correct DHCP server group and the IP addresses of the group members are correct.