Documente Academic
Documente Profesional
Documente Cultură
3 DHCP Configuration
Definition
The Dynamic Host Configuration Protocol (DHCP) dynamically assigns IP addresses to users
and manages user configurations in a centralized manner.
Purpose
As the network expands and becomes complex, the number of hosts often exceeds the number
of available IP addresses. As portable computers and wireless networks are widely used, the
positions of computers often change, causing IP addresses of the computers to be changed
accordingly. As a result, network configurations become increasingly complex. To properly
and dynamically assign IP addresses to hosts, DHCP is used.
DHCP is developed based on the BOOTstrap Protocol (BOOTP). BOOTP runs on networks
where each host has a fixed network connection. The administrator configures a BOOTP
parameter file for each host, and the file remains unchanged for a long period of time. DHCP
has the following new features compared with BOOTP:
DHCP rapidly and dynamically allocates IP addresses, which improves IP address usage.
NOTE
The device supports DHCP snooping. For details about DHCP snooping, see the CloudEngine
8800&7800&6800&5800 Series Switches Configuration Guide -- Basic Configurations -- DHCP
Snooping Configurations.
3.2 Principles
This section describes the implementation of DHCP.
DHCP Architecture
Figure 3-1 shows the DHCP architecture.
IP Network
sname (64)
file (128)
options (variable)
In Figure 3-2, numbers in the round brackets indicate the field length, expressed in bytes.
op(op 1 byte Indicates the message type. The options are as follows:
code) l 1: DHCP Request message
l 2: DHCP Reply message
htype 1 byte Indicates the hardware address type. For Ethernet, the value of
(hardware this field is 1.
type)
hlen 1 byte Indicates the length of a hardware address, expressed in bytes. For
(hardware Ethernet, the value of this field is 6.
length)
hops 1 byte Indicates the number of DHCP relay agents that a DHCP Request
message passes through. This field is set to 0 by a DHCP client or
a DHCP server. The value increases by 1 each time a DHCP
Request message passes through a DHCP relay agent. This field
limits the number of DHCP relay agents that a DHCP message
can pass through.
NOTE
A maximum of 16 DHCP relay agents are allowed between a server and a
client. That is, the number of hops must be smaller than or equal to 16.
Otherwise, DHCP messages are discarded.
secs 2 bytes Indicates the time elapsed since the client obtained or renewed an
(seconds) IP address, in seconds.
flags 2 bytes Indicates the Flags field. Only the leftmost bit of the Flags field is
valid and other bits are set to 0. The leftmost bit determines
whether the DHCP server unicasts or broadcasts a DHCP Reply
message. The options are as follows:
l 0: The DHCP server unicasts a DHCP Reply message.
l 1: The DHCP server broadcasts a DHCP Reply message.
yiaddr 4 bytes Indicates the DHCP client IP address assigned by the DHCP
(your client server. The DHCP server fills this field into a DHCP Reply
ip address) message.
siaddr 4 bytes Server IP address from which a DHCP client obtains the startup
(server ip configuration file.
address)
giaddr 4 bytes Indicates the IP address of the first DHCP relay agent. If the
(gateway ip DHCP server and client are located on different network
address) segments, the first DHCP relay agent fills its IP address into this
field of the DHCP Request message sent by the client and
forwards the message to the DHCP server. The DHCP server
determines the network segment where the client resides based on
this field, and assigns an IP address on this network segment from
an address pool.
The DHCP server also returns a DHCP Reply message to the first
DHCP relay agent. The DHCP relay agent then forwards the
DHCP Reply message to the client.
NOTE
If the DHCP Request message passes through multiple DHCP Relay
agents before reaching the DHCP server, the value of this field is the IP
address of the first DHCP relay agent and remains unchanged. However,
the value of the Hops field increases by 1 each time a DHCP Request
message passes through a DHCP relay agent.
chaddr 16 Indicates the client MAC address. This field must be consistent
(client bytes with the hardware type and hardware length fields. When sending
hardware a DHCP Request message, the client fills its hardware address
address) into this field. For Ethernet, a 6-byte Ethernet MAC address must
be filled in this field when the hardware type and hardware length
fields are set to 1 and 6 respectively.
sname 64 Indicates the name of the server from which a client obtains
(server host bytes configuration parameters. This field is optional and is filled in by
name) the DHCP server. The field must be filled in with a character
string that ends with 0.
file (file 128 Indicates the Bootfile name specified by the DHCP server for a
name) bytes DHCP client. This field is filled in by the DHCP server and is
delivered to the client when the IP address is assigned to the
client. This field is optional. The field must be filled in with a
character string that ends with 0.
options Variabl Indicates the DHCP Options field, which has a maximum of 312
e bytes. This field contains the DHCP message type and
configuration parameters assigned by a server to a client,
including the gateway IP address, DNS server IP address, and IP
address lease.
For details about the Options field, see 3.2.3 DHCP Options.
DHCP OFFER A DHCP Offer message is sent by a DHCP server to respond to a DHCP
Discover message. A DHCP Offer message carries various configuration
information.
DHCP ACK A DHCP ACK message is sent by a DHCP server to acknowledge the
DHCP Request message from a DHCP client. After receiving a DHCP
ACK message, the DHCP client obtains the configuration parameters
including the IP address.
DHCP NAK A DHCP NAK message is sent by a DHCP server to reject the DHCP
Request message from a DHCP client. For example, after a DHCP server
receives a DHCP Request message, it cannot find matching lease records.
Then the DHCP server sends a DHCP NAK message, notifying that no IP
address is available for the DHCP client.
DHCP A DHCP Decline message is sent by a DHCP client to notify the DHCP
DECLINE server that the assigned IP address conflicts with another IP address.
Then the DHCP client applies to the DHCP server for another IP address.
NOTE
To obtain more information about DHCP options, use the DHCP Options Query Tool.
0 7 15
Type Length Value
The Options field consists of Type, Length, and Value. The following table provides the
details.
The value of the Options field ranges from 1 to 255. Table 3-4 lists common DHCP options.
The objects of this field vary with the functions of the Options field. For example, Option 77
is used on a DHCP client to identify user types of the DHCP client. The DHCP server selects
an address pool to allocate an IP address and configuration parameters to the DHCP client
based on the User Class in the Option field. Option 77 is manually configured only on the
DHCP client but not on the server.
For more information about common DHCP options, see RFC 2132.
DHCP DISCOVER
(broadcast)
Step1
DHCP OFFER
Step2
DHCP REQUEST
(broadcast)
Step3
As shown in Figure 3-4, when a DHCP client accesses the network for the first time, the
DHCP client sets up a connection with a DHCP server through the following four stages.
– Discovery stage: The DHCP client searches for the DHCP server.
In this stage, the DHCP client sends a DHCP Discover message to search for the
DHCP server. The DHCP server address is unknown to the client, so the DHCP
client broadcasts the DHCP Discover message. All the DHCP servers send Reply
messages after they receive the Discover message. In this way, the DHCP client
knows locations of the DHCP servers on the network.
– Offer stage: The DHCP server offers an IP address to the DHCP client.
The DHCP server receives the DHCP Discover message, selects an IP address from
the address pool, and sends a DHCP Offer message to the DHCP client. The Offer
message carries information such as the IP address, lease of the IP address, gateway
address, and DNS server address.
– Request stage: The DHCP client selects an IP address.
If multiple DHCP servers send DHCP Offer messages to the DHCP client, the
client receives the first DHCP Offer message. Then the client broadcasts a DHCP
Request message including the information about the DHCP server address (Option
54 field).
The client broadcasts a DHCP Request message to notify all the DHCP servers that
the client uses the IP address provided by the DHCP server in the Option 54 field
and that all the other servers can use the assigned IP addresses.
– Acknowledgment stage: The DHCP server acknowledges the IP address that is
offered.
When the DHCP server receives the DHCP Request message from the DHCP
client, the server searches the lease record based on the MAC address in the
Request message. If there is the IP address record, the server sends a DHCP ACK
message to the client, carrying the IP address and other configurations. After
receiving the DHCP ACK message, the DHCP client broadcasts gratuitous ARP
packets to detect whether any host is using the IP address assigned by the DHCP
server. If no response is received within the specified time, the DHCP client uses
the IP address.
If there is no IP address record or the server cannot assign IP addresses, the server
sends a DHCP NAK message to notify the DHCP client that the server cannot
assign IP addresses. The DHCP client needs to send a new DHCP Discover
message to request a new IP address.
After obtaining the IP address, the DHCP client checks the status of the gateway in
use before the client goes online. If the gateway address is incorrect or the gateway
device fails, the DHCP client requests a new IP address using the four modes for
interaction.
l The DHCP client uses the assigned IP address.
Figure 3-5 Procedure for the DHCP client to use the assigned IP address
Client Server
DHCP REQUEST
(broadcast)
Step1
Step2
DHCP ACK/DHCP NAK
As shown in Figure 3-5, when the DHCP client accesses a network for the second time,
it set ups a connection with the DHCP server in the following procedure.
– The client accesses a network for the second time with the IP address that does not
expire. The client does not need to send a DHCP Discover message again. It
directly sends a DHCP Request message carrying the IP address assigned in the first
time, namely, the Option 50 field in the message.
– After receiving the DHCP Request message, if the requested IP address is not
assigned to another DHCP client, the DHCP server sends a DHCP ACK message to
instruct the DHCP client to use the IP address again.
– If the IP address cannot be assigned to the DHCP client, for example, it has been
assigned to another DHCP client, the DHCP server sends a DHCP NAK message to
the DHCP client. After receiving the DHCP NAK message, the DHCP client sends
a DHCP Discover message to request a new IP address.
l The DHCP client renews the IP address lease.
An expected lease can be contained in the DHCP Request message sent to the server for
an IP address. The server compares the expected lease with the lease in the address pool
and assigns a shorter lease to the client.
The IP address dynamically assigned to the DHCP client usually has a validity period.
The DHCP server withdraws the IP address after the validity period expires. To keep
using the IP address, the DHCP client needs to renew the IP address lease.
When obtaining an IP address, the DHCP client enters the binding state. The client is
configured with three timers to control lease renewal, rebinding, and lease expiration
respectively. When assigning an IP address to the DHCP client, the DHCP server also
specifies values for the timers. If the server does not specify values for the timers, the
client uses the default values. Table 3-5 lists the default timer values.
Figure 3-6 Procedure for a DHCP client to renew the IP address lease
Client Server
DHCP REQUEST
(unicast)
T1
DHCP REQUEST
(broadcast)
T2
As shown in Figure 3-6, when the DHCP client renews the IP address lease, it set ups a
connection with the DHCP server in the following procedures:
– When 50% of the IP address lease (T1) has passed, the DHCP client unicasts a
DHCP Request message to the DHCP server to renew the lease. If the client
receives a DHCP ACK message, the address lease is successfully renewed. If the
client receives a DHCP NAK message, it sends a request again.
– When 87.5% of the IP address lease (T2) has passed and the client has not received
the Reply message, the DHCP client automatically sends a broadcast message to the
DHCP server to renew the IP address lease. If the client receives a DHCP ACK
message, the address lease is successfully renewed. If the client receives a DHCP
NAK message, it sends a request again.
– If the client has not received a Reply message from the server when the IP address
lease expires, the client must stop using the current IP address and send a DHCP
Discover message to request a new IP address.
Figure 3-7 shows the working process of a DHCP relay agent. The DHCP client sends a
Request message to the DHCP server. When receiving the message, the DHCP relay agent
processes and unicasts the message to the specified DHCP server on the other network
segment. The DHCP server sends requested configurations to the client through the DHCP
relay agent based on information in the Request message.
1. After receiving a DHCP Discover message or a Request message, the DHCP relay agent
performs the following operations:
– Discards DHCP Request messages whose number of hops is larger than the hop
limit to prevent loops. Or, increases the value of the hop by 1, indicating that the
message passes through a DHCP relay agent.
– Checks the giaddr field. If the value is 0, set the value of the giaddr field to the IP
address of the interface which receives the Request message. Selects one IP address
if the interface has multiple IP addresses. All the Request messages received by the
interface later use this IP address to fill the giaddr field. If the value is not 0, do not
change the value.
– Sets the TTL in the request packets to the default value 255 in the DHCP relay
device, not the value calculated by decreasing the original TTL by 1. You can
change the value of the hops field to prevent loops and limit hops.
– Changes the destination IP address of the DHCP Request message to the IP address
of the DHCP server or the IP address of the next DHCP relay agent. In this way, the
DHCP Request message can be forwarded to the DHCP server or the next DHCP
relay agent.
2. The DHCP server assigns IP addresses to the client based on the Relay Agent IP Address
field and sends the DHCP Reply message to the DHCP relay agent specified in the Relay
Agent IP Address field. After receiving the DHCP Reply message, the DHCP relay agent
performs the following operations:
– The DHCP relay agent assumes that all the Reply messages are sent to the directly-
connected DHCP clients. The Relay Agent IP Address field identifies the interface
directly connected to the client. If the value of the Relay Agent IP Address field is
not the IP address of a local interface, the DHCP relay agent discards the Reply
message.
– The DHCP relay agent checks the broadcast flag bit of the message. If the broadcast
flag bit is 1, the DHCP relay agent broadcasts the DHCP Reply message to the
DHCP client; otherwise, the DHCP relay agent unicasts the DHCP Reply message
to the DHCP client. The destination IP address is the value in the Your (Client) IP
Address field, and the MAC address is the value in the Client Hardware Address
field.
Figure 3-8 shows how a DHCP client extends the IP address lease through the DHCP relay
agent.
Figure 3-8 Extending the IP address lease through the DHCP relay agent
DHCP RESQUEST(Unicast)
Step1
1. After accessing the network for the first time, the DHCP client only needs to unicast a
DHCP Request message to the DHCP server that assigned its currently-used IP address.
2. The DHCP server then directly unicasts a DHCP ACK message or a DHCP NAK
message to the client.
DHCP Releasing
The DHCP relay agent, instead of the client, can send a Release message to the DHCP server
to release the IP addresses that assigned to the DHCP clients. You can configure a command
on the DHCP relay agent to release the IP addresses that the DHCP server assigns to the
DHCP client.
IP Address Reservation
DHCP supports IP address reservation for clients. The reserved IP addresses can be those in
the address pool or not. If an address in the address pool is reserved, it is no longer assignable.
Addresses are usually reserved for DNS servers.
must release the original IP addresses. If you want to renew the IP address lease, you do
not have to release the IP address.
Different commands are used in different operating systems. You can use either of the
following methods to apply for a new IP address:
– Run the ipconfig /renew command on the Windows 7 operating system of the PC
to apply for a new IP address.
– Run the winipcfg /renew command in the MS-DOS of Windows 98 to apply for a
new IP address.
The user PC needs to send a DHCP Discover message to the DHCP server.
3.3 Applications
This section describes the applicable scenario of DHCP.
As it is shown in Figure 3-9, a DHCP server and multiple DHCP clients (such as PCs and
portable computers) are deployed.
DHCP Clients
Generally, the DHCP server is used to assign IP addresses in the following scenarios:
l On a large network, manual configurations take a long time and bring difficulties to
centralized management over the entire network.
l Hosts on the network are more than available IP addresses. Thus, not every host has a
fixed IP address. Many hosts need to dynamically obtain IP addresses through the DHCP
server. In addition, network administrators hope that there is a limit to the number of
users of on-line at the same time.
l Only a few hosts on the network require fixed IP addresses.
Internet
DHCP Clients
The earlier DHCP protocol applies to only the scenario that the DHCP client and DHCP
server are on the same network segment. To dynamically assign IP addresses to hosts on
network segments, the network administrator needs to configure a DHCP server on each
network segment, which increases costs.
The DHCP relay function is introduced to solve this problem. A DHCP client can apply to the
DHCP server on another network segment to obtain a valid IP address. In this manner, DHCP
clients on multiple network segments can share one DHCP server. This reduces costs and
facilitates centralized management.
License Support
DHCP is a basic feature of a switch and is not under license control.
Version Support
CE7855EI V200R001C00
CE6810LI V100R006C0
CE6850-48S6Q-HI V100R005C00
CE6850-48T6Q-HI/ V100R005C10
CE6850U-HI/
CE6851HI
CE6870-48T6CQ-EI V200R002C50
CE6880-48T4Q2CQ V200R002C20
-EI
CE5850HI V100R003C00
Pre-configuration Tasks
Before configuring a DHCP server based on the global address pool, complete the following
tasks:
l Ensuring that the link between the DHCP client and the device works properly and the
DHCP client can communicate with the device
l (Optional) Configuring the DNS service for the DHCP client
l (Optional) Configuring the NetBIOS service for the DHCP client
l (Optional) Configuring routes from the device to the DNS server and the NetBIOS
server
l (Optional) Configuring the customized DHCP option
Context
The global address pool attributes include the IP address range, IP address lease, IP addresses
not to be automatically allocated, and IP addresses to be statically bound to MAC addresses.
IP addresses in the global address pool can be assigned dynamically or bound manually as
required.
Procedure
Step 1 Run:
system-view
DHCP is enabled.
By default, the DHCP function is disabled.
Step 3 Run:
ip pool ip-pool-name
A global address pool is created and the global address pool view is displayed.
By default, no global address pool exists on the switch.
Step 4 Run:
gateway-list ip-address &<1-8>
The egress gateway address is configured for the global address pool of a DHCP server.
By default, no egress gateway address is specified.
NOTE
When a DHCP client connects to the server or host outside the network segment, data must be forwarded
through the egress gateway.
To load balance traffic and improve network reliability, configure multiple gateways. An address pool can be
configured with a maximum of eight gateway addresses. Gateway addresses cannot be subnet broadcast
addresses.
Step 5 Run:
network ip-address [ mask { mask | mask-length } ]
The range of IP addresses that can be allocated dynamically in the global address pool is
specified.
By default, no network segment address for a global address pool is specified.
An address pool can contain only one address segment. The address range of the address pool
is set by the mask.
NOTE
When configuring the range of dynamically assignable IP addresses in the global address pool, ensure that the
range is the same as the network segment on which the DHCP server interface address or the DHCP relay
agent interface address resides. This avoids incorrect assignment of IP addresses.
The IP addresses that cannot be automatically allocated in the global address pool are
configured.
By default, all IP addresses in the address pool can be automatically assigned to clients.
Some IP addresses in the global address pool are reserved for other services, for example, the
IP address of the DNS server cannot be allocated to clients. If you run this command multiple
times, you can set multiple IP address ranges that cannot be automatically allocated in the
DHCP address pool.
Step 8 (Optional) Run:
static-bind ip-address ip-address mac-address mac-address
An IP address in the global address pool is statically bound to the MAC address of a DHCP
client.
By default, the IP address in a global address pool is not bound to any MAC address.
When a client requires a fixed IP address, bind an idle IP address in the address pool to the
client MAC address.
NOTE
When the IP address in the global address pool is statically bound to a MAC address, the IP address must be
in the range of IP addresses that can be allocated dynamically.
The DHCP server is enabled to use the destination IP address in the packet forwarded by the
DHCP relay as the server identifier.
By default, the DHCP server uses the inbound interface IP address in a DHCP request as the
server identifier.
This command is used when a DHCP client is connected to a DHCP relay (first PE) over a
VPN and the DHCP relay sends a DHCP request to the DHCP server (second PE). The DHCP
server assigns an IP address to the DHCP client over the VPN.
The server IP address specified by the DHCP server is generally the IP address of a non-
public interface on the DHCP server, but the DHCP request is received by a public interface
on the DHCP server. By default, the DHCP server uses the inbound interface IP address in the
DHCP request (public interface IP address) as the server identifier. As a result, the DHCP
client fails to extend the lease. To address this problem, run the dhcp server identifier dest-
ip command to enable the DHCP server to use the destination IP address in the packet
forwarded by the DHCP relay as the server identifier.
Step 14 (Optional) Run:
dhcp server bootp
----End
Context
To ensure normal operations of DHCP clients, you can specify the DNS server address and
the NetBIOS server address when the DHCP server assigns an IP address to the DHCP
client.NetBIOS:Network Basic Input Output System. When a DHCP client uses the NetBIOS
protocol for communication, host names must be mapped to IP addresses. Based on the modes
of obtaining mapping, NetBIOS nodes are classified into the following types:
l b-node: indicates a node in broadcast mode. This node obtains mappings in broadcast
mode.
l p-node: indicates a node in peer-to-peer mode. This node obtains mappings by
communicating with the NetBIOS server.
l m-node: indicates a node in mixed mode. An m-node is a p-node that has some broadcast
features.
l h-node: indicates a node in hybrid mode. An h-node is a b-type node enabled with the
end-to-end communication mechanism.
Procedure
Step 1 Run:
system-view
The IP address of the NetBIOS server used by the DHCP client is assigned.
Each address pool can be configured with a maximum of eight NetBIOS server address.
Step 6 Run:
netbios-type { b-node | h-node | m-node | p-node }
----End
Context
As DHCP develops, new options are emerging. To use these options, add them to the attribute
list of the DHCP server manually. If the DHCP server is configured with the options, the
DHCP client obtains the configuration of the options from the DHCP packet replied by the
DHCP server when the client requests an IP address from the server.
Procedure
Step 1 Run:
system-view
NOTE
l To ensure accuracy, read the Request For Comments (RFC) before configuring options.
l When the password is contained in option, the ascii or hex type is insecure. Set the option type to cipher.
A secure password should contain at least two types of the following: lowercase letters, uppercase letters,
number, and special characters. In addition, the password must consist of six or more than six characters.
Step 4 Run:
option121 ip-address { ip-address mask-length gateway-address } &<1-8>
A classless static route that a DHCP server assigns to a DHCP client is specified.
No classless static route is specified by default.
Step 5 Run:
option184 { as-ip ip-address | fail-over ip-address dialer-string | ncp-ip ip-
address | voice-vlan vlan-id }
----End
Context
Before assigning an address to a client, the switch used as the DHCP server needs to ping the
IP address to avoid address conflicts.
After the dhcp server ping command is executed, the DHCP server can prevent repeated IP
address allocation. The DHCP server pings an IP address to be allocated. If there is no
response to the ping packet within a certain period, the DHCP server continues to send ping
packets to this IP address until the number of ping packets reaches the maximum value. If
there is still no response, this IP address is not in use, and the DHCP server allocates the IP
address to a client.
Duplicate IP address detection on the DHCP server should not be too long. Otherwise, the
client cannot obtain an IP address. It is recommended that the configured total detection time
(Maximum number of send ping packets x Maximum response time) be smaller than 8s.
Procedure
Step 1 Run:
system-view
The period in which the switch waits for the response to a ping packet is set.
By default, the period in which the switch waits for the response to a ping packet is 500 ms.
Step 4 Run:
commit
----End
Procedure
Step 1 Run:
system-view
The function that saves DHCP data to the storage device is enabled.
By default, DHCP data is not saved to the storage device.
After this command is executed, the system generates the lease.txt and conflict.txt files and
saves them in the dhcp folder of the storage device. The two files save the address lease
information and address conflict information. Run the command display dhcp server
database to check the storage device for saving DHCP data.
Step 3 Run:
dhcp server database write-delay interval
----End
Procedure
Step 1 Run:
system-view
----End
Procedure
l Run the display ip pool [ name ip-pool-name [ start-ip-address [ end-ip-address ] | all |
conflict | expired | used ] ] command to check information about the specified global
address pool.
l Run the display dhcp server database command to check information about the DHCP
database.
----End
Pre-configuration Tasks
Before configuring a DHCP relay agent, complete the following tasks:
Configuration Process
Figure 3-11 shows the configuration process.
Configuring a Destination
DHCP Server Group
Binding an Interface to a
DHCP Server Group
Context
When the network where a DHCP client resides does not have a DHCP server, a DHCP relay
agent can be configured to forward DHCP messages of the client to a DHCP server.
NOTE
A DHCP message is forwarded between a DHCP client and a DHCP server at most 16 times, and then
the DHCP message is discarded.
Procedure
Step 1 Run:
system-view
DHCP is enabled.
Step 3 Run:
interface interface-type interface-number [.subinterface-number ]
If a CE6810LI functions as a standalone switch or a leaf switch in an SVF system consisting of fixed and
modular switches, the CE6810LI does not support sub-interfaces. If a CE6810LI functions as a leaf switch in
an SVF system consisting of fixed switches, the CE6810LI supports sub-interfaces.
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 5 Run:
ip address ip-address { mask | mask-length }
Step 7 Run:
commit
----End
Follow-up Procedure
When the DHCP relay function is enabled on an interface, specify the DHCP server IP
address on the interface in either of the following ways:
l Configure a destination DHCP server group and bind the group to the interface. For
details, see 3.7.2 Configuring a Destination DHCP Server Group and 3.7.4 Binding
an Interface to a DHCP Server .
l Run the dhcp relay binding server ip ip-address command in the interface view to
configure the destination DHCP server address.
Procedure
Step 1 Run:
system-view
A DHCP server group is created and the DHCP server group view is displayed.
You can configure a maximum of 256 DHCP server groups in the system, and a maximum of
20 DHCP servers in a DHCP server group.
Step 3 Run:
server ip-address [ ip-address-index ]
commit
----End
Context
When DHCP clients and the DHCP server are located in different VPNs, you can configure
DHCP relay on the DHCP relay interface to allow the communication between them.
Procedure
Step 1 Run:
system-view
The function of inserting the Option 82 field into packets is enabled on the DHCP relay
interface.
By default, a DHCP relay interface uses its primary IP address as the relay agent address.
If the DHCP relay agent fails to use the primary IP address to apply for IP addresses for
DHCP clients, this function allows the DHCP relay agent to use the secondary IP address as a
gateway address to apply for IP addresses for the DHCP clients.
The relay agent address is configured as the IP address of the outbound interface.
In inter-VPN scenarios, if the DHCP server supports the suboption link-selection of the
Option 82 field, you can run this command to address the issue that return routes fail to be
found based on the GiAddr address.
Step 12 Run:
commit
----End
Context
After the DHCP relay function is enabled on an interface, bind a DHCP server group to the
interface so that DHCP clients can access DHCP servers in the bound server group.
Procedure
Step 1 Run:
system-view
Step 2 Run:
interface interface-type interface-number [.subinterface-number ]
If you need to enter the sub-interface view, create a sub-interface. For detailed configurations,
see Configuring a Sub-interface in the CloudEngine 8800&7800&6800&5800 Seriesswitch
Configuration Guide - Interface Management.
NOTE
If a CE6810LI functions as a standalone switch or a leaf switch in an SVF system consisting of fixed and
modular switches, the CE6810LI does not support sub-interfaces. If a CE6810LI functions as a leaf switch in
an SVF system consisting of fixed switches, the CE6810LI supports sub-interfaces.
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 You can bind a DHCP relay interface to a DHCP server group or a DHCP server.
l Bind a DHCP relay interface to a DHCP server group.
Run:
dhcp relay binding server group group-name
The DHCP server IP address is specified on an interface enabled with DHCP relay.
b. Run:
dhcp relay gateway ip-address
Step 6 Run:
commit
----End
Context
If a user is forcibly disconnected, you can manually release the IP address assigned to the user
on the DHCP server. You can configure the DHCP relay agent to actively send DHCP Release
messages to the DHCP server. The DHCP server then releases the specified IP addresses.
Procedure
Step 1 Run:
system-view
If a CE6810LI functions as a standalone switch or a leaf switch in an SVF system consisting of fixed and
modular switches, the CE6810LI does not support sub-interfaces. If a CE6810LI functions as a leaf switch in
an SVF system consisting of fixed switches, the CE6810LI supports sub-interfaces.
If many Ethernet interfaces need to be switched to Layer 3 mode, run the undo portswitch batch
interface-type { interface-number1 [ to interface-number2 ] } &<1-10> command in the system view to
switch these interfaces to Layer 3 mode in batches.
Step 4 Run:
dhcp relay release client-ip-address mac-address [ server-ip-address ]
The DHCP relay agent is configured to send DHCP Release messages to the DHCP server.
l When you use the dhcp relay release command in the system view:
– If no DHCP server is specified, the DHCP relay agent will send DHCP Release
messages to the servers in all DHCP server groups bound to the DHCP relay
interfaces.
– If a DHCP server is specified, the DHCP relay agent sends DHCP Release
messages to only the specified DHCP server.
l When you use the dhcp relay release command in the interface view:
– If no DHCP server is specified, the DHCP relay agent will send DHCP Release
messages to all the servers in the DHCP server group bound to this VLANIF
interface.
– If a DHCP server is specified, the DHCP relay agent sends DHCP Release
messages to only the specified DHCP server.
----End
NOTICE
DHCP statistics cannot be restored after they are cleared. Exercise caution when running the
reset commands.
Procedure
l Run the reset dhcp server statistics command in the user view to clear DHCP server
statistics.
l Run the reset dhcp statistics command in the user view to clear the DHCP message
statistics.
l Run the reset dhcp relay statistics [ server-group group-name ] command in the user
view to clear DHCP relay agent statistics.
----End
Procedure
l Run the display dhcp statistics command to view DHCP message statistics.
l Run the display dhcp relay statistics [ server-group group-name ] command to view
statistics on the DHCP Relay Agent.
l Run the display dhcp server statistics command to view statistics on the DHCP Server.
----End
Networking Requirements
As shown in Figure 3-12, an enterprise has two offices on the same network segment. To
reduce network construction cost, the enterprise uses one DHCP server to assign IP addresses
for hosts in the two offices.
All the hosts in Office1 are on the network segment 10.1.1.0/25 and added to VLAN 10.
Hosts in Office1 only use the DNS service with a lease of ten days. All the hosts in Office2
are on the network segment 10.1.1.128/25 and added to VLAN 20. Hosts in Office2 use the
DNS service and NetBIOS service with a lease of two days.
You can configure a global address pool on SwitchB and enable the server to dynamically
assign IP addresses to hosts in the two offices.
Figure 3-12 Networking diagram for configuring a DHCP server based on the global address
pool
NetBIOS Server DHCP DHCP DHCP
10.1.1.4/25 Client Client Client
10GE1/0/1 10GE1/0/2
VLANIF10 VLANIF20
10.1.1.1/25 10.1.1.129/25
SwitchA SwitchC
SwitchB
DHCP Server
Configuration Roadmap
The configuration roadmap is as follows:
1. Create two global address pools on SwitchB and set attributes of the pools. Assign IP
addresses to Office1 and Office2 as required.
2. Configure VLANIF interfaces to use the global address pool to assign IP addresses to
clients.
Procedure
Step 1 Enable DHCP.
<Huawei> system-view
[~Huawei] sysname SwitchB
[*Huawei] commit
[~SwitchB] dhcp enable
[*SwitchB] commit
Step 2 Create address pools and set the attributes of the address pools.
# Set the attributes of IP address pool 1, including the address pool range, DNS server
address, gateway address, and address lease.
[~SwitchB] ip pool pool1
[*SwitchB-ip-pool-pool1] gateway-list 10.1.1.1
[*SwitchB-ip-pool-pool1] network 10.1.1.0 mask 255.255.255.128
[*SwitchB-ip-pool-pool1] dns-list 10.1.1.2
[*SwitchB-ip-pool-pool1] excluded-ip-address 10.1.1.2
[*SwitchB-ip-pool-pool1] excluded-ip-address 10.1.1.4
[*SwitchB-ip-pool-pool1] lease day 10
[*SwitchB-ip-pool-pool1] commit
[~SwitchB-ip-pool-pool1] quit
# Set the attributes of IP address pool 2, including the address pool range, DNS server
address, egress gateway address, NetBIOS server address, and address lease.
# Run the display ip pool command on SwitchB to view the IP address pool configuration.
[~SwitchB] display ip pool
-----------------------------------------------------------------------------
Pool name : pool1
Pool number : 0
Position : Local Status : Unlocked
Gateway : 10.1.1.1
Mask : 255.255.255.128
VPN instance : --
-----------------------------------------------------------------------------
Pool name : pool2
Pool number : 1
Position : Local Status : Unlocked
Gateway : 10.1.1.129
Mask : 255.255.255.128
VPN instance : --
IP address Statistic
Total :250
Used :6 Idle :242 Expired :0
Conflict :0 Disable :2
----End
Configuration Files
Configuration file of SwitchB
#
sysname SwitchB
#
vlan batch 10 20
#
dhcp enable
#
ip pool pool1
gateway-list 10.1.1.1
network 10.1.1.0 mask 255.255.255.128
lease day 10 hour 0 minute 0
dns-list 10.1.1.2
excluded-ip-address 10.1.1.2
excluded-ip-address 10.1.1.4
#
ip pool pool2
gateway-list 10.1.1.129
network 10.1.1.128 mask 255.255.255.128
lease day 2 hour 0 minute 0
dns-list 10.1.1.2
nbns-list 10.1.1.4
#
interface Vlanif10
ip address 10.1.1.1 255.255.255.128
#
interface Vlanif20
ip address 10.1.1.129 255.255.255.128
#
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 20
#
return
Networking Requirements
As shown in Figure 3-13, an enterprise uses a DHCP server to assign IP addresses to servers
in the data center. The server at 10.20.20.0/24 is used as an example to describe how to
configure a DHCP relay agent.
The enterprise client is on the network segment 10.20.20.0/24, and the DHCP server is on the
network segment 10.10.10.0/24. The DHCP clients can obtain IP addresses from the DHCP
server through SwitchA enabled with DHCP relay.
The uplink interface of SwitchA is 10GE1/0/2, the address of VLANIF 200 is 10.10.20.1/24,
and the interface address of SwitchA connected to the peer device is 10.10.20.2/24.
The public address of the DHCP server is 10.10.10.1/24 and the interface address of the
DHCP server connected to the peer device is 10.10.10.2/24.
10.10.10.1/24
VLANIF200
10GE1/0/2 10.10.20.1/24
DHCP Relay SwitchA
VLANIF100
10GE1/0/1
10.20.20.1/24
VLAN100
Configuration Roadmap
The configuration roadmap is as follows:
1. Configure DHCP relay on SwitchA to enable SwitchA to forward DHCP messages from
different network segments.
Procedure
Step 1 Add 10GE1/0/2 on SwitchA to VLAN 200.
<Huawei> system-view
[~Huawei] sysname SwitchA
[*Huawei] commit
[~SwitchA] vlan batch 200
[*SwitchA] interface 10ge 1/0/2
[*SwitchA-10GE1/0/2] port link-type trunk
[*SwitchA-10GE1/0/2] port trunk allow-pass vlan 200
[*SwitchA-10GE1/0/2] quit
[*SwitchA] interface vlanif 200
[*SwitchA-Vlanif200] ip address 10.10.20.1 24
[*SwitchA-Vlanif200] quit
[*SwitchA] commit
----End
Configuration Files
Configuration file of SwitchA
#
sysname SwitchA
#
vlan batch 100 200
#
dhcp enable
#
dhcp relay server group dhcpgroup1
server 10.10.10.1 0
#
interface Vlanif100
ip address 10.20.20.1 255.255.255.0
dhcp select relay
dhcp relay binding server group dhcpgroup1
#
interface Vlanif200
ip address 10.10.20.1 255.255.255.0
#
interface 10GE1/0/1
port default vlan 100
#
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 200
#
ip route-static 0.0.0.0 0.0.0.0 10.10.20.2
#
return
3.10 References
This section lists references of DHCP.
The following table lists the references of this document.