- Table of Contents
-
- 03-Layer 3 Configuration Guide
- 00-Preface
- 01-ARP Configuration
- 02-IP Addressing Configuration
- 03-DHCP Configuration
- 04-DNS Configuration
- 05-IP Performance Optimization Configuration
- 06-UDP Helper Configuration
- 07-IPv6 Basics Configuration
- 08-IP Routing Basics Configuration
- 09-Static Routing Configuration
- 10-IPv6 Static Routing Configuration
- 11-RIP Configuration
- 12-RIPng Configuration
- Related Documents
-
Title | Size | Download |
---|---|---|
03-DHCP Configuration | 581.40 KB |
Contents
Dynamic IP address allocation process
IP address allocation sequence
DHCP server configuration task list
Configuring an address pool for the DHCP server
Configuring address allocation mode for a common address pool
Configuring dynamic address allocation for an extended address pool
Configuring a domain name suffix for the client
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
Enabling the DHCP server on an interface
Applying an extended address pool on an interface
Configuring the DHCP server security functions
Enabling unauthorized DHCP server detection
Configuring IP address conflict detection
Enabling handling of Option 82
Specifying the threshold for sending trap messages
Displaying and maintaining the DHCP server
DHCP server configuration examples
Static IP address assignment configuration example
Dynamic IP address assignment configuration example
Self-defined option configuration example
Troubleshooting DHCP server configuration
DHCP relay agent configuration
Introduction to DHCP relay agent
DHCP relay agent support for Option 82
DHCP relay agent configuration task list
Enabling the DHCP relay agent on an interface
Correlating a DHCP server group with a relay agent interface
Configuring the DHCP relay agent security functions
Configuring periodic refresh of dynamic client entries
Enabling unauthorized DHCP server detection
Enabling DHCP starvation attack protection
Configuring the DHCP relay agent to release an IP address
Configuring the DHCP relay agent to support Option 82
Displaying and maintaining the DHCP relay agent
DHCP relay agent configuration examples
DHCP relay agent configuration example
DHCP relay agent Option 82 support configuration example
Troubleshooting DHCP relay agent configuration
Enabling the DHCP client on an interface
Displaying and maintaining the DHCP client
DHCP client configuration example
Application environment of trusted ports
DHCP snooping support for Option 82
Configuring DHCP snooping basic functions
Configuring DHCP snooping to support Option 82
Configuring DHCP snooping entries backup
Enabling DHCP starvation attack protection
Enabling DHCP-REQUEST message attack protection
Displaying and maintaining DHCP snooping
DHCP snooping configuration examples
DHCP snooping configuration example
DHCP snooping Option 82 support configuration example
Obtaining an IP address dynamically
Configuring an interface to dynamically obtain an IP address through BOOTP
Displaying and maintaining BOOTP client configuration
BOOTP client configuration example
This chapter includes these sections:
|
NOTE: · The term "switch" or "device" in this chapter refers to the switching engine on a WX3000E wireless switch. · The WX3000E series comprises WX3024E and WX3010E wireless switches. · The port numbers in this chapter are for illustration only. |
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 the chapter “DHCP relay agent configuration.” |
DHCP address allocation
Allocation mechanisms
DHCP supports the following mechanisms for IP address allocation.
· Static allocation: The network administrator assigns an IP address to a client like 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.
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 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.
· op: Message type defined in option field. 1 = REQUEST, 2 = REPLY
· htype, hlen: Hardware address type and length of a 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. Currently 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.
· yiaddr: 'your' (client) IP address, assigned by the server.
· siaddr: Server IP address, from which the client obtained configuration parameters.
· giaddr: IP address of the first relay agent a request message traveled.
· chaddr: Client hardware address.
· sname: Server host name, from which the client obtained configuration parameters.
· file: Bootfile name and path information, defined by the server to the client.
· options: Optional 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 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.
Introduction to DHCP options
Common DHCP options:
· Option 3: Router option. It specifies the gateway address.
· Option 6: DNS server option. It specifies the DNS server’s IP address.
· 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 to 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 contains values that correspond to the parameters requested by the client.
· Option 66: TFTP server name option. It specifies a TFTP server to be assigned to the client.
· Option 67: Bootfile name option. It specifies the bootfile 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 the requesting client should add to 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 client.
For more information about DHCP options, see RFC 2132.
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. Upon receiving a DHCP message requesting Option 43 (in Option 55), the DHCP server replies a message containing Option 43 to assign 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.
· Preboot Execution Environment (PXE) server address, which is used to obtain the bootfile or other control information from the PXE server.
1. 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 type: Type 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 length: Length of a sub-option excluding the sub-option type and sub-option length fields.
· Sub-option value: Value 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. 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
· Sub-option 1: Padded 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 2: Padded 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 1: Padded with the user-specified access node identifier (ID of the device 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 2: Padded 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 device supports Option 184 carrying 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 1: IP address of the primary network calling processor, which serves as the network calling control source and provides program downloads.
· Sub-option 2: IP address of the backup network calling processor that DHCP clients will contact when the primary one is unreachable.
· Sub-option 3: Voice VLAN ID and the result whether DHCP clients take this ID as the voice VLAN or not.
· Sub-option 4: Failover 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: For Option 184, you must define sub-option 1 to make other sub-options take effect. |
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
This chapter includes these sections:
· DHCP server configuration task list
· Displaying and maintaining the DHCP server
· DHCP server configuration examples
· Troubleshooting DHCP server configuration
|
NOTE: · The term "switch" or "device" in this chapter refers to the switching engine on a WX3000E wireless switch. · The WX3000E series comprises WX3024E and WX3010E wireless switches. · The port numbers in this chapter are for illustration only. · The DHCP server configuration is supported only on VLAN interfaces and loopback interfaces. The secondary IP address pool configuration is not supported on 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.
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 subnet parameters. Therefore, common parameters, for example a DNS server address, should be configured at the highest (network or subnet) level of the tree.
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 do not use the structure of a tree. · 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.
DHCP server configuration task list
Complete the following tasks to configure the DHCP server:
Remarks |
|
Required |
|
Required |
|
Required |
|
Required by the extended address pool configuration When configuring a common address pool, ignore this task. |
|
Optional |
|
Optional |
|
Optional |
Configuring an address pool for the DHCP server
Configuration task list
Complete the following tasks to configure an address pool:
Task |
Remarks |
|
Required |
||
Configuring address allocation mode for a common address pool |
Required to configure either of the two for the common address pool configuration |
|
Configuring dynamic address allocation for an extended address pool |
Required for the extended address pool configuration |
|
Optional |
||
Configuring WINS servers and NetBIOS node type for the client |
||
Configuring Option 184 parameters for the client with voice service |
||
Configuring the TFTP server and bootfile name for the client |
||
Creating a DHCP address pool
When creating a DHCP address pool, specify it as a common address pool or an extended address pool.
Follow these steps to create a DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Create a DHCP address pool and enter its view |
dhcp server ip-pool pool-name [ extended ] |
Required 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 address allocation mode for a common address pool
|
CAUTION: You can configure either a static binding or dynamic address allocation for a common address pool, but not both. |
You need to specify a subnet for 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 address 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.
Follow these steps to configure a static binding in a common address pool:
To do… |
Use the command… |
Remarks |
|
Enter system view |
system-view |
— |
|
Enter common address pool view |
dhcp server ip-pool pool-name |
— |
|
Specify the IP address |
static-bind ip-address ip-address [ mask-length | mask mask ] |
Required No IP addresses are statically bound by default. |
|
Specify the MAC address or client ID |
Specify the MAC address |
static-bind mac-address mac-address |
Required to configure either of the two Neither is bound statically by default. |
Specify the client ID |
static-bind client-identifier client-identifier |
||
Specify the lease duration for the IP address |
expired { day day [ hour hour [ minute minute ] ] | 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. · The ID of the static binding must be identical to the ID displayed by using the display dhcp client verbose command on the client. Otherwise, the client cannot obtain an IP address. · When the device serves as a DHCP client or BOOTP client, you must bind the DHCP client’s ID to an IP address, or bind the BOOTP client's MAC address to an IP address on the DHCP server; otherwise, the DHCP or BOOTP client cannot obtain a static IP address. · 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.
Follow these steps to configure dynamic address allocation for a common address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter common address pool view |
dhcp server ip-pool pool-name |
— |
Specify a subnet |
network network-address [ mask-length | mask mask ] |
Required Not specified by default. |
Specify the address lease duration |
expired { day day [ hour hour [ minute minute ] ] | unlimited } |
Optional One day by default. |
Return to system view |
quit |
— |
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 configuring 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.
Follow these steps to configure dynamic address allocation for an extended address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter extended address pool view |
dhcp server ip-pool pool-name extended |
— |
Specify the IP address range |
network ip range min-address max-address |
Required Not specified by default. |
Specify the IP address mask |
network mask mask |
Required Not specified by default. |
Specify the address lease duration |
expired { day day [ hour hour [ minute minute ] ] | unlimited } |
Optional One day by default. |
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.”
Follow these steps to configure a domain name suffix in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify a domain name suffix |
domain-name domain-name |
Required 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.
Follow these steps to configure DNS servers in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify DNS servers |
dns-list ip-address&<1-8> |
Required 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)-node: The 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)-node: The 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)-node: A combination of broadcast first and peer-to-peer second. The m-node client broadcasts the destination name. If no response is received, it unicasts the destination name to the WINS server to get the destination IP address.
· h (hybrid)-node: A combination of peer-to-peer first and broadcast second. The h-node client unicasts the destination name to the WINS server. If no response is received, it broadcasts it to get the destination IP address.
Follow these steps to configure WINS servers and NetBIOS node type in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify WINS server IP addresses |
nbns-list ip-address&<1-8> |
Required (optional for b-node) No address is specified by default. |
Specify the NetBIOS node type |
netbios-type { b-node | h-node | m-node | p-node } |
Required 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.
Follow these steps to configure the BIMS server IP address, port number, and shared key in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify the BIMS server IP address, port number, and shared key |
bims-server ip ip-address [ port port-number ] sharekey key |
Required Not specified by default. |
Configuring gateways for the client
You can specify up to eight gateways in a DHCP address pool.
Follow these steps to configure the gateways in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify gateways |
gateway-list ip-address&<1-8> |
Required 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 the chapter “DHCP overview.”
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.
Follow these steps to configure option 184 parameters in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify the IP address of the primary network calling processor |
voice-config ncp-ip ip-address |
Required Not specified by default. |
Specify the IP address of the backup network calling processor |
voice-config as-ip ip-address |
Optional Not specified by default. |
Configure the voice VLAN |
voice-config voice-vlan vlan-id { disable | enable } |
Optional Not configured by default. |
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) 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.
Follow these steps to configure the IP address and name of the TFTP server and the bootfile name in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Specify the TFTP server |
tftp-server ip-address ip-address |
Required to use either command Not specified by default. |
Specify the name of the TFTP server |
tftp-server domain-name domain-name |
|
Specify the bootfile name |
bootfile-name bootfile-name |
Required Not specified by default. |
Configuring self-defined DHCP options
|
CAUTION: Be cautious when configuring self-defined DHCP options because such configuration may affect the operation of DHCP. |
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.
Follow these steps to configure a self-defined DHCP option in the DHCP address pool:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter DHCP address pool view |
dhcp server ip-pool pool-name [ extended ] |
— |
Configure a self-defined DHCP option |
option code { ascii ascii-string | hex hex-string&<1-16> | ip-address ip-address&<1-8> } |
Required 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 |
— |
hex |
Enabling DHCP
Enable DHCP before performing other configurations.
Follow these steps to enable DHCP:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable DHCP |
dhcp enable |
Required 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.
Follow these steps to enable the DHCP server on an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
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.
|
NOTE: Only an extended address pool can be applied on the interface. The address pool to be referenced must already exist. |
Follow these steps to apply an extended address pool on an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
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. |
Configuring the DHCP server security functions
Configuration prerequisites
Before performing this configuration, complete the following configurations on the DHCP server:
1. Enable DHCP.
2. 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.
Follow these steps to enable unauthorized DHCP server detection:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable unauthorized DHCP server detection |
dhcp server detect |
Required Disabled by default. |
|
NOTE: With the unauthorized DHCP server detection enabled, the device 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 by using ICMP. If the server receives a response within the specified period, it selects and pings another IP address. If it receives no response, the server continues to ping the IP address 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).
Follow these steps to configure IP address conflict detection:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
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. |
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. |
Enabling handling of Option 82
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:
1. Enable DHCP.
2. Configure the DHCP address pool.
Enable Option 82 handling
Follow these steps to enable the DHCP server to handle Option 82:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable the server to handle Option 82 |
dhcp server relay information enable |
Optional Enabled by default. |
|
NOTE: To support Option 82 requires configuring both the DHCP server and relay agent (or the device enabled with DHCP snooping). For more information, see the chapters “DHCP relay agent configuration” and “DHCP snooping 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 the 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.
Follow these steps to specify the threshold for sending trap messages:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
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
|
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. |
To do… |
Use the 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 |
DHCP server configuration examples
DHCP networking involves two types:
· The DHCP server and client are on the same subnet and exchange messages directly.
· The DHCP server and client are not on the same subnet and they 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, Switch B (DHCP client) and Switch C (BOOTP client) obtain the static IP address, DNS server address, and gateway address from Switch A (DHCP server).
The client ID of VLAN-interface 2 on Switch B is 3030-3066-2e65-3234-392e-3830-3530-2d56-6c61-6e2d-696e-7465-7266-6163-6532. The MAC address of VLAN-interface 2 on Switch C is 000f-e249-8050.
Figure 11 Network diagram for static IP address assignment
Configuration procedure
1. Configure the IP address of VLAN-interface 2 on Switch A.
<SwitchA> system-view
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 25
[SwitchA-Vlan-interface2] quit
2. Configure the DHCP server
# Enable DHCP.
[SwitchA] dhcp enable
# Create DHCP address pool 0, configure a static binding, DNS server and gateway in it.
[SwitchA] dhcp server ip-pool 0
[SwitchA-dhcp-pool-0] static-bind ip-address 10.1.1.5 25
[SwitchA-dhcp-pool-0] static-bind client-identifier 3030-3066-2e65-3234-392e-3830-3530-2d56-6c61-6e2d-696e-7465-7266-6163-6532
[SwitchA-dhcp-pool-0] dns-list 10.1.1.2
[SwitchA-dhcp-pool-0] gateway-list 10.1.1.126
[SwitchA-dhcp-pool-0] quit
# Create DHCP address pool 1, configure a static binding, DNS server and gateway in it.
[SwitchA] dhcp server ip-pool 1
[SwitchA-dhcp-pool-1] static-bind ip-address 10.1.1.6 25
[SwitchA-dhcp-pool-1] static-bind mac-address 000f-e249-8050
[SwitchA-dhcp-pool-1] dns-list 10.1.1.2
[SwitchA-dhcp-pool-1] gateway-list 10.1.1.126
3. Verification
After the preceding configuration is complete, Switch B can obtain IP address 10.1.1.5 and other network parameters, and Switch C can obtain IP address 10.1.1.6 and other network parameters from Switch 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.
Dynamic IP address assignment configuration example
Network requirements
· As shown in Figure 12, the DHCP server (Switch A) assigns IP addresses to clients in 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 VLAN-interfaces 1 and 2 on Switch A are 10.1.1.1/25 and 10.1.1.129/25 respectively.
· In address pool 10.1.1.0/25, configure the address lease duration as ten days and twelve hours, domain name suffix aabbcc.com, DNS server address 10.1.1.2/25, gateway 10.1.1.126/25, and WINS server 10.1.1.4/25.
· In address pool 10.1.1.128/25, configure the address lease duration as 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 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 can 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, H3C recommends that the number of DHCP clients that apply for IP addresses through VLAN-interface 1 should be no more than 122, and that through VLAN-interface 2 should be no more than 124. |
Figure 12 DHCP network diagram
Configuration procedure
1. Specify IP addresses for VLAN interfaces (omitted).
2. Configure the DHCP server
# Enable DHCP.
<SwitchA> system-view
[SwitchA] dhcp enable
# Exclude IP addresses (addresses of the DNS server, WINS server and gateways).
[SwitchA] dhcp server forbidden-ip 10.1.1.2
[SwitchA] dhcp server forbidden-ip 10.1.1.4
[SwitchA] dhcp server forbidden-ip 10.1.1.126
[SwitchA] dhcp server forbidden-ip 10.1.1.254
# Configure DHCP address pool 0 (subnet, client domain name suffix, and DNS server address).
[SwitchA] dhcp server ip-pool 0
[SwitchA-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0
[SwitchA-dhcp-pool-0] domain-name aabbcc.com
[SwitchA-dhcp-pool-0] dns-list 10.1.1.2
[SwitchA-dhcp-pool-0] quit
# Configure DHCP address pool 1 (subnet, gateway, lease duration, and WINS server).
[SwitchA] dhcp server ip-pool 1
[SwitchA-dhcp-pool-1] network 10.1.1.0 mask 255.255.255.128
[SwitchA-dhcp-pool-1] gateway-list 10.1.1.126
[SwitchA-dhcp-pool-1] expired day 10 hour 12
[SwitchA-dhcp-pool-1] nbns-list 10.1.1.4
[SwitchA-dhcp-pool-1] quit
# Configure DHCP address pool 2 (subnet, gateway, and lease duration).
[SwitchA] dhcp server ip-pool 2
[SwitchA-dhcp-pool-2] network 10.1.1.128 mask 255.255.255.128
[SwitchA-dhcp-pool-2] expired day 5
[SwitchA-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 Switch 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 (Switch B) obtains an IP address and PXE server addresses from the DHCP server (Switch 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 for self-defined option configuration
Configuration procedure
1. Specify IP addresses for the interfaces (omitted).
2. Configure the DHCP server
# Enable DHCP.
<SwitchA> system-view
[SwitchA] dhcp enable
# Configure DHCP address pool 0.
[SwitchA] dhcp server ip-pool 0
[SwitchA-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0
[SwitchA-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, Switch B can obtain its IP address on 10.1.1.0/24 and PXE server addresses from the Switch 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.
This chapter includes these sections:
· Introduction to DHCP relay agent
· DHCP relay agent configuration task list
· Displaying and maintaining the DHCP relay agent
· DHCP relay agent configuration examples
· Troubleshooting DHCP relay agent configuration
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. DHCP clients on different subnets can contact the same DHCP server rather than having a DHCP server on each subnet. This centralizes management and reduces cost reduction.
Fundamentals
Figure 14 shows a typical application of the DHCP relay agent.
Figure 14 DHCP relay agent application
The DHCP server and client interact with each other in the same way with or without a relay agent (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 location information of the DHCP client, letting the administrator locate the DHCP client for security control and accounting purposes. For more information, see the chapter “DHCP overview.”
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 |
— |
normal |
Forward the message after adding the Option 82 padded in normal format. |
— |
verbose |
Forward the message after adding the Option 82 padded in verbose format. |
|
— |
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 |
Required |
|
Required |
|
Correlating a DHCP server group with a relay agent interface |
Required |
Optional |
|
Optional |
|
Optional |
|
Optional |
Enabling DHCP
Enable DHCP before performing other configurations related to the DHCP relay agent.
Follow these steps to enable DHCP:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable DHCP |
dhcp enable |
Required 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.
Follow these steps to enable the DHCP relay agent on an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable the DHCP relay agent on the current interface |
dhcp select relay |
Required 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.
Follow these steps to correlate a DHCP server group with a relay agent interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Create a DHCP server group and add a server into the group |
dhcp relay server-group group-id ip ip-address |
Required Not created by default. |
Enter interface view |
interface interface-type interface-number |
— |
Correlate the DHCP server group with the current interface |
dhcp relay server-select group-id |
Required 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. · 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 using 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.
Follow these steps to create a static binding and enable address check:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
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. |
Enter interface view |
interface interface-type interface-number |
— |
Enable or disable address check |
dhcp relay address-check { disable | enable } |
Required Disabled by default. |
|
NOTE: · The dhcp relay address-check command can be executed only on 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 to release its IP address. The DHCP relay agent simply 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 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 entry.
· If the server returns a DHCP-NAK message, the relay agent keeps the entry.
Follow these steps to configure periodic refresh of dynamic client entries:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable periodic refresh of dynamic client entries |
dhcp relay security refresh enable |
Optional Enabled by default. |
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.) |
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.
Follow these steps to enable unauthorized DHCP server detection:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable unauthorized DHCP server detection |
dhcp relay server-detect |
Required Disabled by default. |
|
NOTE: The relay agent logs a DHCP server only once. After the information of recorded DHCP servers is cleared, the relay agent will re-record server information by using this mechanism. |
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, it discards the DHCP request.
Follow these steps to enable MAC address check:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable MAC address check |
dhcp relay check mac-address |
Required 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.
Follow these steps to enable offline detection:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable offline detection |
dhcp relay client-detect enable |
Required 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.
Follow these steps to configure the DHCP relay agent to send DHCP-RELEASE messages:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Configure the DHCP relay agent to release an IP address |
dhcp relay release ip client-ip |
Required |
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
|
NOTE: · To support Option 82, perform related configuration on both the DHCP server and relay agent. See the chapter “DHCP server configuration” for DHCP server configuration of this kind. · 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. |
Configuration procedure
Follow these steps to configure the DHCP relay agent to support Option 82:
To do… |
Use the command… |
Remarks |
|
Enter system view |
system-view |
— |
|
Enter interface view |
interface interface-type interface-number |
— |
|
Enable the relay agent to support Option 82 |
dhcp relay information enable |
Required Disabled by default. |
|
Configure the handling strategy for requesting messages containing Option 82 |
dhcp relay information strategy { drop | keep | replace } |
Optional replace by default. |
|
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 } ] } |
Optional normal by default. |
Configure the code type for the circuit ID sub-option |
dhcp relay information circuit-id format-type { ascii | hex } |
Optional By default, the code type depends on the padding format of Option 82. Each field has its own code type. The code type configuration applies to non-user-defined Option 82 only. |
|
Configure the code type for the remote ID sub-option |
dhcp relay information remote-id format-type { ascii | hex } |
Optional By default, the code type is hex. This code type configuration applies to non-user-defined Option 82 only. |
|
Configure user-defined Option 82 |
Configure the padding content for the circuit ID sub-option |
dhcp relay information circuit-id string circuit-id |
Optional By default, the padding content depends on the padding format of Option 82. |
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. |
Displaying and maintaining the DHCP relay agent
To do… |
Use the 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 examples
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. VLAN-interface 1 on the DHCP relay agent (Switch A) connects to the network where DHCP clients reside. The IP address of VLAN-interface 1 is 10.10.1.1/24 and the IP address of VLAN-interface 2 is 10.1.1.2/24.
Figure 16 Network diagram for DHCP relay agent
Configuration procedure
# Specify IP addresses for the interfaces (omitted).
# Enable DHCP.
<SwitchA> system-view
[SwitchA] dhcp enable
# Add DHCP server 10.1.1.1 into DHCP server group 1.
[SwitchA] dhcp relay server-group 1 ip 10.1.1.1
# Enable the DHCP relay agent on VLAN-interface 1.
[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] dhcp select relay
# Correlate VLAN-interface 1 to DHCP server group 1.
[SwitchA-Vlan-interface1] 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 statistics command to view statistics of DHCP packets forwarded by DHCP relay agents. After you enable address check of the DHCP relay agents with the dhcp relay address-check enable command, use the display dhcp relay security command to view bindings of DHCP relay agents
|
NOTE: · Because the DHCP relay agent and server are on different subnets, you need to configure a static route or dynamic routing protocol to make them reachable to each other. · You need to perform the configuration on the DHCP server to guarantee the client-server communication. 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 (Switch 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.
· Switch A forwards DHCP requests to the DHCP server (Switch B) after replacing Option 82 in the requests, so that the DHCP clients can obtain IP addresses.
Configuration procedure
# Specify IP addresses for the interfaces (omitted).
# Enable DHCP.
<SwitchA> system-view
[SwitchA] dhcp enable
# Add DHCP server 10.1.1.1 into DHCP server group 1.
[SwitchA] dhcp relay server-group 1 ip 10.1.1.1
# Enable the DHCP relay agent on VLAN-interface 1.
[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] dhcp select relay
# Correlate VLAN-interface 1 to DHCP server group 1.
[SwitchA-Vlan-interface1] dhcp relay server-select 1
# Enable the DHCP relay agent to support Option 82, and perform Option 82-related configurations.
[SwitchA-Vlan-interface1] dhcp relay information enable
[SwitchA-Vlan-interface1] dhcp relay information strategy replace
[SwitchA-Vlan-interface1] dhcp relay information circuit-id string company001
[SwitchA-Vlan-interface1] 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.
This chapter includes these sections:
· Enabling the DHCP client on an interface
· Displaying and maintaining the DHCP client
· DHCP client configuration example
|
NOTE: · The term "switch" or "device" in this document refers to the switching engine on a WX3000E wireless switch. · The WX3000E series comprises WX3024E and WX3010E wireless switches. · The port numbers in this document are for illustration only. · The DHCP client configuration is supported only on VLAN interfaces. · When multiple VLAN interfaces with the same MAC address use DHCP for IP address acquisition via a relay agent, the DHCP server cannot be a Windows 2000 Server or Windows 2003 Server. |
Introduction to DHCP client
With the DHCP client enabled, an interface uses DHCP to obtain configuration parameters such as an IP address from the DHCP server.
Enabling the DHCP client on an interface
Follow these steps to enable the DHCP client on an interface:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable the DHCP client on the interface |
ip address dhcp-alloc [ client-identifier mac interface-type interface-number ] |
Required Disabled by default. |
|
NOTE: · An interface can be configured to acquire an IP address in multiple ways. The latest configuration overwrites the previous one. · Secondary IP addresses cannot be configured on an interface that is enabled with the DHCP client. · If the IP address that interface A obtains from the DHCP server is on the same network segment as the IP address of interface B, interface A neither uses the IP address nor requests any IP address from the DHCP server, unless the IP address of interface B is manually deleted and interface A is brought up again by first executing the shutdown command and then the undo shutdown command or the DHCP client is re-enabled on interface A by executing the undo ip address dhcp-alloc command and then the ip address dhcp-alloc command. |
Displaying and maintaining the DHCP client
To do… |
Use the command… |
Remarks |
Display specified configuration information |
display dhcp client [ verbose ] [ interface interface-type interface-number ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
DHCP client configuration example
Network requirements
As shown in Figure 18, on a LAN, Switch B contacts the DHCP server via VLAN-interface 2 to obtain an IP address, DNS server address, and static route information. The IP address resides on network 10.1.1.0/24. The DNS server address is 20.1.1.1. The next hop of the static route to network 20.1.1.0/24 is 10.1.1.2.
The DHCP server uses Option 121 to assign static route information to DHCP clients. The destination descriptor field comprises two parts, subnet mask length and destination network address. In this example, the value of the destination descriptor field takes 18 14 01 01, a hexadecimal number indicating that the subnet mask length is 24 and destination network address is 20.1.1.0, and the value of the next hop address field takes 0A 01 01 02, a hexadecimal number indicating that the next hop is 10.1.1.2.
Figure 17 Format of Option 121
Figure 18 Network diagram for DHCP client configuration example
Configuration procedure
1. Configure Switch A
# Specify the IP address of VLAN-interface 2.
<SwitchA> system-view
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 10.1.1.1 24
[SwitchA-Vlan-interface2] quit
# Enable the DHCP service.
[SwitchA] dhcp enable
# Exclude an IP address from automatic allocation.
[SwitchA] dhcp server forbidden-ip 10.1.1.2
# Configure DHCP address pool 0 and specify the subnet, lease duration, DNS server address, and a static route to subnet 20.1.1.0/24.
[SwitchA] dhcp server ip-pool 0
[SwitchA-dhcp-pool-0] network 10.1.1.0 mask 255.255.255.0
[SwitchA-dhcp-pool-0] expired day 10
[SwitchA-dhcp-pool-0] dns-list 20.1.1.1
[SwitchA-dhcp-pool-0] option 121 hex 18 14 01 01 0A 01 01 02
2. Configure Switch B
# Enable the DHCP client on VLAN-interface 2.
<SwitchB> system-view
[SwitchB] interface vlan-interface 2
[SwitchB-Vlan-interface2] ip address dhcp-alloc
3. Verification
# Use the display dhcp client command to view the IP address and other network parameters assigned to Switch B.
[SwitchB-Vlan-interface2] display dhcp client verbose
Vlan-interface2 DHCP client information:
Current machine state: BOUND
Allocated IP: 10.1.1.3 255.255.255.0
Allocated lease: 864000 seconds, T1: 432000 seconds, T2: 756000 seconds
Lease from 2009.02.20 11:06:35 to 2009.03.02 11:06:35
DHCP server: 10.1.1.1
Transaction ID: 0x410090f0
Classless static route:
Destination: 20.1.1.0, Mask: 255.255.255.0, NextHop: 10.1.1.2
DNS server: 20.1.1.1
Client ID: 3030-3066-2e65-3230-
302e-3030-3032-2d45-
7468-6572-6e65-7430-
2f30
T1 will timeout in 4 days 23 hours 59 minutes 50 seconds.
# Use the display ip routing-table command to view the route information on Switch B. A static route to network 20.1.1.0/24 is added to the routing table.
[SwitchB-Vlan-interface2] display ip routing-table
Routing Tables: Public
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost NextHop Interface
10.1.1.0/24 Direct 0 0 10.1.1.3 Vlan2
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 Vlan2
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoop0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoop0
This chapter includes these sections:
· Displaying and maintaining DHCP snooping
· DHCP snooping configuration examples
DHCP snooping overview
Functions of DHCP snooping
DHCP snooping can:
1. Ensure DHCP clients to obtain IP addresses from authorized DHCP servers
2. Record IP-to-MAC mappings of DHCP clients
Ensuring DHCP clients to obtain IP addresses from authorized DHCP servers
With DHCP snooping, the ports of a switch can be configured as trusted or untrusted to ensure that clients obtain IP addresses only from authorized DHCP servers.
· Trusted: A trusted port forwards DHCP messages normally to ensure the clients get IP addresses from an authorized DHCP server.
· Untrusted: An untrusted port discards received DHCP-ACK and DHCP-OFFER messages to avoid IP address allocation from any unauthorized server.
Configure ports that connect to authorized DHCP servers or other DHCP snooping devices as trusted, and configure other ports as untrusted.
Recording IP-to-MAC mappings of DHCP clients
DHCP snooping reads DHCP-REQUEST messages and DHCP-ACK messages from trusted ports to record DHCP snooping entries. A DHCP snooping entry includes the MAC and IP addresses of the client, the port that connects to the DHCP client, and the VLAN of the port. With DHCP snooping entries, DHCP snooping can implement the following functions:
· ARP detection: Whether ARP packets are sent from an authorized client is determined based on DHCP snooping entries. This feature prevents ARP attacks from unauthorized clients. For more information, see the Security Configuration Guide.
· IP source guard: IP source guard uses dynamic binding entries generated by DHCP snooping to filter packets on a per-port basis, and thus prevents unauthorized packets from traveling through. For more information, see the Security Configuration Guide.
Application environment of trusted ports
Configuring a trusted port connected to a DHCP server
Figure 19 Configure trusted and untrusted ports
As shown in Figure 19, the DHCP snooping device port that is connected to an authorized DHCP server should be configured as a trusted port. The trusted port forwards reply messages from the authorized DHCP server to the client, but the untrusted port does not forward reply messages from the unauthorized DHCP server. This ensures that the DHCP client obtains an IP address from the authorized DHCP server.
Configuring trusted ports in a cascaded network
In a cascaded network involving multiple DHCP snooping devices, the ports connected to other DHCP snooping devices should be configured as trusted ports.
To save system resources, you can disable the trusted ports, which are indirectly connected to DHCP clients, from recording client IP-to-MAC bindings upon receiving DHCP requests.
Figure 20 Configure trusted ports in a cascaded network
Table 3 describes the roles of the ports shown in Figure 20.
Device |
Untrusted port |
Trusted port disabled from recording binding entries |
Trusted port enabled to record binding entries |
Switch A |
GigabitEthernet 1/0/1 |
GigabitEthernet 1/0/3 |
GigabitEthernet 1/0/2 |
Switch B |
GigabitEthernet 1/0/3 and GigabitEthernet 1/0/4 |
GigabitEthernet 1/0/1 |
GigabitEthernet 1/0/2 |
Switch C |
GigabitEthernet 1/0/1 |
GigabitEthernet 1/0/3 and GigabitEthernet 1/0/4 |
GigabitEthernet 1/0/2 |
DHCP snooping support for Option 82
Option 82 records the location information of the DHCP client so the administrator can locate the DHCP client for security control and accounting purposes. For more information, see the chapter “DHCP relay agent configuration.”
If DHCP snooping supports Option 82, it will handle a client’s request according to the contents defined in Option 82, if any. The handling strategies are described in Table 4.
If a reply returned by the DHCP server contains Option 82, the DHCP snooping device will remove the Option 82 before forwarding the reply to the client. If the reply contains no Option 82, the DHCP snooping device forwards it directly.
Table 4 Handling strategies of DHCP snooping
If a client’s requesting message has… |
Handling strategy |
Padding format |
The DHCP snooping device will… |
Option 82 |
Drop |
— |
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 |
— |
normal |
Forward the message after adding the Option 82 padded in normal format. |
— |
verbose |
Forward the message after adding the Option 82 padded in verbose format. |
|
— |
user-defined |
Forward the message after adding the user-defined Option 82. |
|
NOTE: The handling strategy and padding format for Option 82 on the DHCP snooping device are the same as those on the relay agent. |
Configuring DHCP snooping basic functions
Follow these steps to configure DHCP snooping basic functions:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enable DHCP snooping |
dhcp-snooping |
Required Disabled by default. |
Enter Ethernet interface view |
interface interface-type interface-number |
— |
Specify the port as a trusted port that records the IP-to-MAC bindings of clients |
dhcp-snooping trust [ no-user-binding ] |
Required After DHCP snooping is enabled, a port is an untrusted port by default |
Configuring DHCP snooping to support Option 82
Follow these steps to configure DHCP snooping to support Option 82:
To do… |
Use the command… |
Remarks |
|
Enter system view |
system-view |
— |
|
Enter interface view |
interface interface-type interface-number |
— |
|
Enable DHCP snooping to support Option 82 |
dhcp-snooping information enable |
Required Disabled by default. |
|
Configure the handling strategy for requests containing Option 82 |
dhcp-snooping information strategy { append | drop | keep | replace } |
Optional replace by default. |
|
Configure non-user-defined Option 82 |
Configure the padding format for Option 82 |
dhcp-snooping information format { normal | private private | standard | verbose [ node-identifier { mac | sysname | user-defined node-identifier } ] } |
Optional normal by default. |
Configure the code type for the circuit ID sub-option |
dhcp-snooping information circuit-id format-type { ascii | hex } |
Optional By default, the code type depends on the padding format of Option 82. Each field has its own code type. This code type configuration applies to non-user-defined Option 82 only. |
|
Configure the code type for the remote ID sub-option |
dhcp-snooping information remote-id format-type { ascii | hex } |
Optional hex by default. The code type configuration applies to non-user-defined Option 82 only. |
|
Configure user-defined Option 82 |
Configure the padding content for the circuit ID sub-option |
dhcp-snooping information [ vlan vlan-id ] circuit-id string circuit-id |
Optional By default, the padding content depends on the padding format of Option 82. |
Configure the padding content for the remote ID sub-option |
dhcp-snooping information [ vlan vlan-id ] remote-id string { remote-id | sysname } |
Optional By default, the padding content depends on the padding format of Option 82. |
|
NOTE: · You can only enable DHCP snooping to support Option 82 on Ethernet interfaces or aggregate interfaces. · If an Ethernet interface is added to an aggregation group, enabling DHCP snooping to support Option 82 on the interface will not take effect. After the interface quits the aggregation group, the configuration will be effective. · Option 82 support requires configuration on both the DHCP server and the device enabled with DHCP snooping. See the chapter “DHCP server configuration” for DHCP server configuration of this kind. · If the handling strategy of the DHCP-snooping-enabled device 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 the Option 82 is padded with the device name, the device name must contain no spaces. Otherwise, the DHCP-snooping device will drop the message. You can use the sysname command to specify the device name. For more information about this command, see the Fundamentals Command Reference. |
Configuring DHCP snooping entries backup
DHCP snooping entries cannot survive a reboot. If the DHCP snooping device is rebooted, security modules (such as IP source guard) that use DHCP snooping entries to authenticate users will reject requests from clients until new entries are learned.
The DHCP snooping entries backup feature enables you to store DHCP snooping entries in a file. When the DHCP snooping device reboots, it reads DHCP snooping entries from this file.
Follow these steps to configure DHCP snooping entries backup
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Specify the name of the file for storing DHCP snooping entries |
dhcp-snooping binding database filename filename |
Required Not specified by default. DHCP snooping entries are stored immediately after this command is used and then updated at the interval set by the dhcp-snooping binding database update interval command. |
Back up DHCP snooping entries to the file |
dhcp-snooping binding database update now |
Optional DHCP snooping entries will be stored to the file each time this command is used. |
Set the interval at which the DHCP snooping entry file is refreshed |
dhcp-snooping binding database update interval minutes |
Optional By default, the file is not refreshed periodically. |
|
NOTE: After DHCP snooping is disabled with the undo dhcp-snooping command, the device will delete all DHCP snooping entries, including those stored in the file. |
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 MAC addresses that a Layer 2 port can learn.
· To prevent a DHCP starvation attack that uses DHCP requests encapsulated with the same source MAC address, enable MAC address check on the DHCP snooping device. With this function enabled, the DHCP snooping device compares the chaddr field of a received DHCP request with the source MAC address field of the frame. If they are the same, the request is considered valid and forwarded to the DHCP server; if not, the request is discarded.
Follow these steps to enable MAC address check:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable MAC address check |
dhcp-snooping check mac-address |
Required Disabled by default. |
|
NOTE: You can enable MAC address check only on Layer 2 Ethernet interfaces, Layer 2 aggregate interfaces, WLAN-ESS interfaces, and WLAN-BSS interfaces. |
Enabling DHCP-REQUEST message attack protection
Attackers may forge DHCP-REQUEST messages to renew the IP address leases for legitimate DHCP clients that no longer need the IP addresses. These forged messages keep a victim DHCP server renewing the leases of IP addresses instead of releasing the IP addresses. This wastes IP address resources.
To prevent such attacks, you can enable DHCP-REQUEST message check on DHCP snooping devices. With this feature enabled, upon receiving a DHCP-REQUEST message, a DHCP snooping device looks up local DHCP snooping entries for the corresponding entry of the message. If an entry is found, the DHCP snooping device compares the entry with the message information. If they are consistent, the DHCP-REQUEST message is considered as a valid lease renewal request and forwarded to the DHCP server. If they are not consistent, the message is considered as a forged lease renewal request and discarded. If no corresponding entry is found, the message is considered valid and forwarded to the DHCP server.
Follow these steps to enable DHCP-REQUEST message check:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Enable DHCP-REQUEST message check |
dhcp-snooping check request-message |
Required Disabled by default. |
Displaying and maintaining DHCP snooping
To do… |
Use the command… |
Remarks |
Display DHCP snooping entries |
display dhcp-snooping [ ip ip-address ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display Option 82 configuration information on the DHCP snooping device |
display dhcp-snooping information { all | interface interface-type interface-number } [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display DHCP packet statistics on the DHCP snooping device |
display dhcp-snooping packet statistics [ slot slot-number ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display information about trusted ports |
display dhcp-snooping trust [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Display the DHCP snooping entry file information |
display dhcp-snooping binding database [ | { begin | exclude | include } regular-expression ] |
Available in any view |
Clear DHCP snooping entries |
reset dhcp-snooping { all | ip ip-address } |
Available in user view |
Clear DHCP packet statistics on the DHCP snooping device |
reset dhcp-snooping packet statistics [ slot slot-number ] |
Available in user view |
DHCP snooping configuration examples
DHCP snooping configuration example
Network requirements
As shown in Figure 21, Switch B is connected to a DHCP server through GigabitEthernet 1/0/1, and to two DHCP clients through GigabitEthernet 1/0/2 and GigabitEthernet 1/0/3. GigabitEthernet 1/0/1 forwards DHCP server responses while the other two do not.
Switch B records clients’ IP-to-MAC address bindings in DHCP-REQUEST messages and DHCP-ACK messages received from trusted ports.
Figure 21 Network diagram for DHCP snooping configuration
Configuration procedure
# Enable DHCP snooping.
<SwitchB> system-view
[SwitchB] dhcp-snooping
# Specify GigabitEthernet 1/0/1 as trusted.
[SwitchB] interface GigabitEthernet 1/0/1
[SwitchB-GigabitEthernet1/0/1] dhcp-snooping trust
[SwitchB-GigabitEthernet1/0/1] quit
DHCP snooping Option 82 support configuration example
Network requirements
· As shown in Figure 21, enable DHCP snooping and Option 82 support on Switch B.
· Configure the handling strategy for DHCP requests containing Option 82 as replace.
· On GigabitEthernet 1/0/2, configure the padding content for the circuit ID sub-option as company001 and for the remote ID sub-option as device001.
· On GigabitEthernet 1/0/3, configure the padding format as verbose, access node identifier as sysname, and code type as ascii for Option 82.
· Switch B forwards DHCP requests to the DHCP server (Switch A) after replacing Option 82 in the requests, so that the DHCP clients can obtain IP addresses.
Configuration procedure
# Enable DHCP snooping.
<SwitchB> system-view
[SwitchB] dhcp-snooping
# Specify GigabitEthernet 1/0/1 as trusted.
[SwitchB] interface GigabitEthernet 1/0/1
[SwitchB-GigabitEthernet1/0/1] dhcp-snooping trust
[SwitchB-GigabitEthernet1/0/1] quit
# Configure GigabitEthernet 1/0/2 to support Option 82.
[SwitchB] interface GigabitEthernet 1/0/2
[SwitchB-GigabitEthernet1/0/2] dhcp-snooping information enable
[SwitchB-GigabitEthernet1/0/2] dhcp-snooping information strategy replace
[SwitchB-GigabitEthernet1/0/2] dhcp-snooping information circuit-id string company001
[SwitchB-GigabitEthernet1/0/2] dhcp-snooping information remote-id string device001
[SwitchB-GigabitEthernet1/0/2] quit
# Configure GigabitEthernet 1/0/3 to support Option 82.
[SwitchB] interface GigabitEthernet 1/0/3
[SwitchB-GigabitEthernet1/0/3] dhcp-snooping information enable
[SwitchB-GigabitEthernet1/0/3] dhcp-snooping information strategy replace
[SwitchB-GigabitEthernet1/0/3] dhcp-snooping information format verbose node-identifier sysname
[SwitchB-GigabitEthernet1/0/3] dhcp-snooping information circuit-id format-type ascii
[SwitchB-GigabitEthernet1/0/3] dhcp-snooping information remote-id format-type ascii
This chapter includes these sections:
· Introduction to BOOTP client
· Configuring an interface to dynamically obtain an IP address through BOOTP
· Displaying and maintaining BOOTP client configuration
· BOOTP client configuration example
|
NOTE: · The term "switch" or "device" in this document refers to the switching engine on a WX3000E wireless switch. · The WX3000E series comprises WX3024E and WX3010E wireless switches. · The port numbers in this document are for illustration only. · BOOTP client configuration only applies to VLAN interfaces. · If several VLAN interfaces sharing the same MAC address obtain IP addresses through a BOOTP relay agent, the BOOTP server cannot be a Windows 2000 Server or Windows 2003 Server. |
Introduction to BOOTP client
This section covers these topics:
· Obtaining an IP address dynamically
BOOTP application
After you specify an interface of a device as a BOOTP client, the interface can use BOOTP to get 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.
|
NOTE: Because a DHCP server can interact with a BOOTP client, you can use the DHCP server to configure an IP address for the BOOTP client, without any BOOTP server. |
Obtaining an IP address dynamically
|
NOTE: A DHCP server can take the place of the BOOTP server in the following dynamic IP address acquisition. |
A BOOTP client dynamically obtains an IP address from a BOOTP server in the following steps:
1. The BOOTP client broadcasts a BOOTP request, which contains its own MAC address.
2. The BOOTP server receives the request and searches the configuration file for the corresponding IP address and other information according to the MAC address of the BOOTP client. The BOOTP server then returns a BOOTP response to the BOOTP client.
3. The BOOTP client obtains the IP address from the received response.
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 dynamically obtain an IP address through BOOTP
Follow these steps to configure an interface to dynamically obtain an IP address:
To do… |
Use the command… |
Remarks |
Enter system view |
system-view |
— |
Enter interface view |
interface interface-type interface-number |
— |
Configure an interface to dynamically obtain an IP address through BOOTP |
ip address bootp-alloc |
Required By default, an interface does not use BOOTP to obtain an IP address. |
Displaying and maintaining BOOTP client configuration
To do… |
Use the command… |
Remarks |
Display BOOTP client information |
display bootp client [ interface interface-type interface-number ] [ | { begin | exclude | include } regular-expression ] |
Available in any view |
BOOTP client configuration example
Network requirements
As shown in Figure 12, Switch B’s port belonging to VLAN 1 is connected to the LAN. VLAN-interface 1 obtains an IP address from the DHCP server by using BOOTP.
Configuration procedure
The following describes only the configuration on Switch B serving as a client.
# Configure VLAN-interface 1 to dynamically obtain an IP address from the DHCP server.
<SwitchB> system-view
[SwitchB] interface vlan-interface 1
[SwitchB-Vlan-interface1] ip address bootp-alloc
# Use the display bootp client command to view the IP address assigned to the BOOTP client.
|
NOTE: To make the BOOTP client obtain an IP address from the DHCP server, you must perform additional configurations on the DHCP server. For more information, see the chapter “DHCP server configuration.” |