DHCP Management
Configuring the DHCP Server Function Based on an Interface Address Pool
Data Model
The data model files matching DHCP server are huawei-dhcp.yang and huawei-address-management.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-dhcp:dhcp-config/dhcpv4-config/enable |
Indicates whether DHCP is enabled. |
The value is of the Boolean type:
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/enable |
Indicates whether the DHCP server function is enabled. |
The value is of the Boolean type:
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option/option-code |
Indicates the value of a user-defined option. |
The value is an integer in the range from 1 to 254, except the values 1, 3, 6, 15, 44, 46, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 82, 120, 121, and 184. |
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option |
Indicates the type of a user-defined option:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/logging/type |
Enables the logging function during IP address allocation of the DHCP server. |
The value is an enumerated type. The value is renew-success, indicating that a log is generated when an address lease is successfully renewed. |
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/ip-range/ip-subnet |
Indicates the range of the IP addresses allocated by the DHCP server to DHCP clients. The object includes:
|
|
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/mask/mask/ip-prefix/ip-prefix |
Specifies the subnet mask of the IP address allocated to a DHCP client. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/mask/mask/length/length |
Specifies the subnet mask of the IP address allocated to a DHCP client. |
The value is an integer in the range from 0 to 32. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/conflict-recycle |
Enables automatic reclaim of conflicting IP addresses and sets the interval for automatic reclaim. The object includes:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/gateway |
Configures the default gateway address allocated by the DHCP server to DHCP clients. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/sip-server |
Configures the SIP server IP address allocated by the DHCP server to DHCP clients. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/boot-file |
Configures the name of the configuration file allocated by the DHCP server to DHCP clients. |
The value is a string of 1 to 127 case-sensitive characters without spaces. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/next-server |
Specifies the network server IP address that is allocated by the DHCP server to DHCP clients and to be used during startup. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/option121 |
Configures the Option 121 (classless static route) that the DHCP server allocates to DHCP clients. |
The value is in dotted decimal notation. |
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/global-configuration/ping |
Configures the maximum number of ping packets sent by the DHCP server and the maximum response time of a ping packet. The object includes:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/global-configuration/database |
Indicates whether the function of saving the current DHCP data to a storage device is enabled. The object includes:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/enable |
Indicates whether an interface is configured to use the global address pool. |
The value is of the Boolean type:
|
NA |
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/name |
Indicates the name of a global address pool. |
The value is a string of 1 to 64 characters without spaces. It can contain digits, letters, and special characters such as underscores (_), hyphens (-), and periods (.). It cannot be set to - or --. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/network |
Indicates the available network segment addresses in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/lease |
Configures the lease time of IP addresses in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/excluded-address/ip-subnet |
Indicates the IP addresses that cannot be allocated to DHCP clients from a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/static-binding/address-binding |
Configures statically bound IP addresses in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/gateway |
Configures the gateway address allocated to DHCP clients. |
The value is in dotted decimal notation. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/dns/dns-server/ip-address |
Configures the IP address of the DNS server to be allocated to a DHCP client. |
The value is in dotted decimal notation. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/user-defined-options |
Configures user-defined options. |
- |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/section |
Configures an IP address segment in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/conflict-recycle |
Enables automatic reclaim of conflicting IP addresses in a global address pool and sets the automatic reclaim interval. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/logging/log-type |
Enables the logging function during IP address allocation of the DHCP server. |
The value is an enumerated type:
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/boot-file |
Configures the name of the startup configuration file for DHCP clients. |
The value is a string of 1 to 127 case-sensitive characters without spaces. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/sip-server |
Configures the SIP server IP address or domain name allocated to DHCP clients. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/sname |
Configures the name of the server from which DHCP clients obtain the startup configuration file. |
The value is a string of 1 to 63 case-sensitive characters without spaces. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/next-server |
Configures a server IP address for a DHCP client after the client automatically obtains an IP address. |
The value is in dotted decimal notation. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/option121 |
Configures a classless static route for DHCP clients. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/option184 |
Configures the Option 184. The object includes:
|
|
NA |
/huawei-address-management:address-management-v4-statistics-table/ip-pool-statistics |
Displays statistics about IPv4 address pools. The object includes:
|
- |
NA |
/huawei-address-management:address-management-v4-bindings-table/dynamic-bindings |
Displays information about allocated addresses in an IPv4 address pool. The object includes:
|
- |
NA |
Enabling the DHCP Server Function
This section provides a sample of enabling the DHCP server function using the rpc method.
Operation |
XPATH |
---|---|
rpc |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server |
Data Requirements
Item |
Data |
Description |
---|---|---|
DHCP function |
true |
Enable the DHCP server function on VLANIF404. |
DHCP server function |
true |
|
Name and IP address of an interface |
|
Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <name>Vlanif404</name> <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type> <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"> <address ns0:operation="merge"> <ip>10.10.10.44</ip> <netmask>255.255.255.0</netmask> </address> </ipv4> </interface> </interfaces> <dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp"> <dhcpv4-config> <enable>true</enable> <dhcp-server-configuration> <dhcp-servers> <dhcp-server xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <interface-name>Vlanif404</interface-name> <enable>true</enable> <interface-pool/> </dhcp-server> </dhcp-servers> </dhcp-server-configuration> </dhcpv4-config> </dhcp-config> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <ok/> </rpc-reply>
Sample of failed response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message> Please enable DHCP in the global view first.</error-message> <error-info>Error on node /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server[interface-name="Vlanif404"]/enable</error-info> </rpc-error> </rpc-reply>
Configuring User-defined Options
This section provides a sample of configuring user-defined options using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data Requirements
Item |
Data |
Description |
---|---|---|
DHCP function |
true |
Enable the DHCP server function on VLANIF404 and set the format and value of the user-defined Option43 to the IP address format and 10.3.1.1, respectively. |
DHCP server function |
true |
|
Name and IP address of an interface |
|
|
Value and format of a user-defined option |
|
Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <name>Vlanif404</name> <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type> <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"> <address ns0:operation="merge"> <ip>10.10.10.44</ip> <netmask>255.255.255.0</netmask> </address> </ipv4> </interface> </interfaces> <dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp"> <dhcpv4-config> <enable>true</enable> <dhcp-server-configuration> <dhcp-servers> <dhcp-server xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <interface-name>Vlanif404</interface-name> <enable>true</enable> <interface-pool> <user-defined-options> <user-defined-option> <option-code>43</option-code> <ip-address>10.3.1.1</ip-address> </user-defined-option> </user-defined-options> </interface-pool> </dhcp-server> </dhcp-servers> </dhcp-server-configuration> </dhcpv4-config> </dhcp-config> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <ok/> </rpc-reply>
Sample of failed response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="11"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server[interface-name='Vlanif404']/interface-pool/user-defined-options/user-defined-option[option-code='43']/ip-address[.='1000.0.0.1']</error-path> <error-message>parse rpc config error.(Value "1000.0.0.1" does not satisfy the constraint "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?" (range, length, or pattern).).</error-message> </rpc-error> </rpc-reply>
Configuring the DHCP Server Function Based on a Global Address Pool
Data Model
The data model files matching DHCP server are huawei-dhcp.yang and huawei-address-management.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-dhcp:dhcp-config/dhcpv4-config/enable |
Indicates whether DHCP is enabled. |
The value is of the Boolean type:
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/enable |
Indicates whether the DHCP server function is enabled. |
The value is of the Boolean type:
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option/option-code |
Indicates the value of a user-defined option. |
The value is an integer in the range from 1 to 254, except the values 1, 3, 6, 15, 44, 46, 50, 51, 52, 53, 54, 55, 57, 58, 59, 61, 82, 120, 121, and 184. |
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/user-defined-options/user-defined-option |
Indicates the type of a user-defined option:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/logging/type |
Enables the logging function during IP address allocation of the DHCP server. |
The value is an enumerated type. The value is renew-success, indicating that a log is generated when an address lease is successfully renewed. |
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/ip-range/ip-subnet |
Indicates the range of the IP addresses allocated by the DHCP server to DHCP clients. The object includes:
|
|
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/mask/mask/ip-prefix/ip-prefix |
Specifies the subnet mask of the IP address allocated to a DHCP client. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/mask/mask/length/length |
Specifies the subnet mask of the IP address allocated to a DHCP client. |
The value is an integer in the range from 0 to 32. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/conflict-recycle |
Enables automatic reclaim of conflicting IP addresses and sets the interval for automatic reclaim. The object includes:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/gateway |
Configures the default gateway address allocated by the DHCP server to DHCP clients. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/sip-server |
Configures the SIP server IP address allocated by the DHCP server to DHCP clients. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/boot-file |
Configures the name of the configuration file allocated by the DHCP server to DHCP clients. |
The value is a string of 1 to 127 case-sensitive characters without spaces. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/next-server |
Specifies the network server IP address that is allocated by the DHCP server to DHCP clients and to be used during startup. |
The value is in dotted decimal notation. |
NA |
huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/pool-type/interface-pool/interface-pool/option121 |
Configures the Option 121 (classless static route) that the DHCP server allocates to DHCP clients. |
The value is in dotted decimal notation. |
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/global-configuration/ping |
Configures the maximum number of ping packets sent by the DHCP server and the maximum response time of a ping packet. The object includes:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/global-configuration/database |
Indicates whether the function of saving the current DHCP data to a storage device is enabled. The object includes:
|
|
NA |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/enable |
Indicates whether an interface is configured to use the global address pool. |
The value is of the Boolean type:
|
NA |
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/name |
Indicates the name of a global address pool. |
The value is a string of 1 to 64 characters without spaces. It can contain digits, letters, and special characters such as underscores (_), hyphens (-), and periods (.). It cannot be set to - or --. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/network |
Indicates the available network segment addresses in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/lease |
Configures the lease time of IP addresses in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/excluded-address/ip-subnet |
Indicates the IP addresses that cannot be allocated to DHCP clients from a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/static-binding/address-binding |
Configures statically bound IP addresses in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/gateway |
Configures the gateway address allocated to DHCP clients. |
The value is in dotted decimal notation. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/dns/dns-server/ip-address |
Configures the IP address of the DNS server to be allocated to a DHCP client. |
The value is in dotted decimal notation. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/user-defined-options |
Configures user-defined options. |
- |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/section |
Configures an IP address segment in a global address pool. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/conflict-recycle |
Enables automatic reclaim of conflicting IP addresses in a global address pool and sets the automatic reclaim interval. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/logging/log-type |
Enables the logging function during IP address allocation of the DHCP server. |
The value is an enumerated type:
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/boot-file |
Configures the name of the startup configuration file for DHCP clients. |
The value is a string of 1 to 127 case-sensitive characters without spaces. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/sip-server |
Configures the SIP server IP address or domain name allocated to DHCP clients. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/sname |
Configures the name of the server from which DHCP clients obtain the startup configuration file. |
The value is a string of 1 to 63 case-sensitive characters without spaces. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/next-server |
Configures a server IP address for a DHCP client after the client automatically obtains an IP address. |
The value is in dotted decimal notation. |
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/option121 |
Configures a classless static route for DHCP clients. The object includes:
|
|
NA |
/huawei-address-management:address-management/ipv4/ip-pools/ip-pool/option184 |
Configures the Option 184. The object includes:
|
|
NA |
/huawei-address-management:address-management-v4-statistics-table/ip-pool-statistics |
Displays statistics about IPv4 address pools. The object includes:
|
- |
NA |
/huawei-address-management:address-management-v4-bindings-table/dynamic-bindings |
Displays information about allocated addresses in an IPv4 address pool. The object includes:
|
- |
NA |
Creating and Configuring a Global Address Pool
This section provides a sample of creating and configuring a global address pool using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data Requirements
Item |
Data |
Description |
---|---|---|
Name of a global address pool |
pool1 |
Set the name of the global address pool to pool1. |
Range of IP addresses that can be dynamically assigned in a global address pool |
|
Set the range of IP addresses that can be dynamically assigned in the global address pool to 10.1.1.0/24. |
Lease time |
unlimited |
Set unlimited lease time. |
Conflicting address reclamation in a global address pool |
|
Set the interval for reclaiming conflicting IP addresses in a global address pool to one day. |
Log recording during IP address assignment from a global address pool |
log-type: allocation-fail |
Record logs when IP addresses fail to be assigned. |
Request Example
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <hw-address-management:address-management xmlns:hw-address-management="urn:huawei:params:xml:ns:yang:huawei-address-management"> <hw-address-management:ipv4> <hw-address-management:ip-pools> <hw-address-management:ip-pool> <hw-address-management:vsys>pub</hw-address-management:vsys> <hw-address-management:name>pool1</hw-address-management:name> <hw-address-management:network> <hw-address-management:ip-address>10.1.1.0</hw-address-management:ip-address> <hw-address-management:mask-length>24</hw-address-management:mask-length> </hw-address-management:network> <hw-address-management:lease><hw-address-management:unlimited></hw-address-management:unlimited></hw-address-management:lease> <hw-address-management:conflict-recycle> <hw-address-management:day>1</hw-address-management:day> <hw-address-management:hour>0</hw-address-management:hour> <hw-address-management:minute>0</hw-address-management:minute> </hw-address-management:conflict-recycle> <hw-address-management:logging> <hw-address-management:log-type>allocation-fail</hw-address-management:log-type> </hw-address-management:logging> </hw-address-management:ip-pool> </hw-address-management:ip-pools> </hw-address-management:ipv4> </hw-address-management:address-management> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-address-management:address-management/ipv4/ip-pools/ip-pool[vsys='pub'][name='pool1']/network/ip-address</error-path> <error-message>parse rpc config error.(Value "10.1.1.1111" does not satisfy the constraint "(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(%[\p{N}\p{L}]+)?" (range, length, or pattern).).</error-message> </rpc-error> </rpc-reply>
Configuring Network Configuration Parameters to Be Assigned to DHCP Clients
This section provides a sample of configuring network configuration parameters to be assigned to DHCP clients using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data Requirements
Item |
Data |
Description |
---|---|---|
Name of a global address pool |
pool1 |
Set the name of the global address pool to pool1. |
IP address of the SIP server |
10.1.20.33 |
Set the IP address of the SIP server to 10.1.20.33. |
IP address of the DNS server |
10.3.3.3 |
Set the IP address of the DNS server to 10.3.3.3. |
Name of the server from which the DHCP client obtains the startup configuration file |
ftpserver |
Set the name of the server from which the DHCP client obtains the startup configuration file to ftpserver. |
Request Example
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <address-management xmlns="urn:huawei:params:xml:ns:yang:huawei-address-management" xc:operation="merge"> <ipv4> <ip-pools> <ip-pool> <name>pool1</name> <vsys>pub</vsys> <sip-server> <ip-address>10.1.20.33</ip-address> </sip-server> <dns> <dns-server> <ip-address>10.3.3.3</ip-address> </dns-server> </dns> <sname>ftpserver</sname> </ip-pool> </ip-pools> </ipv4> </address-management> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
Sample of failed response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message>Wrong parameter.</error-message> <error-info>Error on node /huawei-address-management:address-management/ipv4/ip-pools/ip-pool[vsys="pub",name="pool1"]/sname</error-info> </rpc-error> </rpc-reply>
Configuring an Interface to Use the Global Address Pool to Provide the DHCP Server Function
This section provides a sample of configuring an interface to use the global address pool to provide the DHCP server function using the rpc method.
Operation |
XPATH |
---|---|
rpc |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-server-configuration/dhcp-servers/dhcp-server/enable |
Data Requirements
Item |
Data |
Description |
---|---|---|
Whether an interface is configured to use the global address pool to provide the DHCP server function |
true |
Configure the interface to use the global address pool to provide the DHCP server function. |
Request Example
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <if:interfaces xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip" xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <if:name>Vlanif9</if:name> <if:type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</if:type> <ip:ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"> <ip:address ns0:operation="merge"> <ip:ip>10.10.10.44</ip:ip> <ip:netmask>255.255.255.0</ip:netmask> </ip:address> </ip:ipv4> </if:interface> </if:interfaces> <hw-dhcp:dhcp-config xmlns:hw-dhcp="urn:huawei:params:xml:ns:yang:huawei-dhcp"> <hw-dhcp:dhcpv4-config> <hw-dhcp:enable>true</hw-dhcp:enable> <hw-dhcp:dhcp-server-configuration> <hw-dhcp:dhcp-servers> <hw-dhcp:dhcp-server> <hw-dhcp:interface-name>Vlanif9</hw-dhcp:interface-name> <hw-dhcp:enable>true</hw-dhcp:enable> <hw-dhcp:global-pool/> </hw-dhcp:dhcp-server> </hw-dhcp:dhcp-servers> </hw-dhcp:dhcp-server-configuration> </hw-dhcp:dhcpv4-config> </hw-dhcp:dhcp-config> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"> <ok/> </rpc-reply>
Configuring a DHCP Relay
Data Model
The data model file matching DHCP relay is huawei-dhcp.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-dhcp:dhcp-config/dhcpv4-config/enable |
Indicates whether to enable the DHCP function. |
The value is of the Boolean type:
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/enable |
Indicates whether to enable the DHCP relay function. |
The value is of the Boolean type:
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/server-ip |
Indicates the IP address of the DHCP server served by the DHCP relay agent. |
The value is in dotted decimal notation. |
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/global-configuration/server-cycle-enable |
Indicates whether the DHCP server polling function is enabled on the DHCP relay agent. |
The value is of the Boolean type:
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/relay-information/enable |
Indicates whether to enable the Option82 function on a DHCP relay agent. |
The value is of the Boolean type:
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/anycast-gw-reroute-enable |
Indicates whether the re-routing function for distributed gateways is enabled on the DHCP relay agent. |
The value is of the Boolean type:
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/option82-enable |
Indicates whether the function of adding the Option82 field to DHCP messages is enabled. The option insertion mode on an interface or an interface in a VLAN and in a VLAN or a BD can be set to the Insert mode (insert-enable) or Rebuild mode (rebuild-enable). |
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/sub-option-enable |
Indicates whether the function of adding a sub-option to the Option82 field is enabled. Sub-option 1 (circuit-id-enable), sub-option 2 (remote-id-enable), suboption 6 (subscriber-id-enable), and suboption 9 (vendor-specific-enable) can be added to the Option82 field globally, on an interface, or in a VLAN or BD. NOTE:
The four suboptions cannot be inserted simultaneously. |
The value is of the Boolean type:
|
N/A |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-option82-configuration/option82-format/vendor-specific-format/global/vendor-sub-option/option-format |
Indicates the format of suboption 9 in the Option82 field. The value can be:
|
|
N/A |
Enabling DHCP Relay
This section provides a sample of enabling DHCP relay using the rpc method.
Operation |
XPATH |
---|---|
rpc |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays |
Data Requirements
Item |
Data |
Description |
---|---|---|
Whether DHCP is enabled |
true |
Enable DHCP relay on VLANIF 3 and configure it to serve DHCP server with the IP address 10.1.1.2. |
Whether DHCP relay is enabled |
true |
|
Interface name |
VLANIF3 |
|
IP address of the DHCP server served by the DHCP relay agent |
10.1.1.2 |
Request example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <huawei-vlan:vlans xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan"> <huawei-vlan:vlan> <huawei-vlan:id>3</huawei-vlan:id> </huawei-vlan:vlan> </huawei-vlan:vlans> <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface> <if:name>Vlanif3</if:name> <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type> <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip"> <ip:address> <ip:ip>192.168.10.1</ip:ip> <ip:prefix-length>24</ip:prefix-length> </ip:address> </ip:ipv4> </if:interface> </if:interfaces> <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface> <if:name>GigabitEthernet1/0/1</if:name> <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type> <huawei-vlan:vlan xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan"> <huawei-vlan:port-link-type>trunk</huawei-vlan:port-link-type> <huawei-vlan:trunk> <huawei-vlan:trunk-vlan>3</huawei-vlan:trunk-vlan> </huawei-vlan:trunk> </huawei-vlan:vlan> </if:interface> </if:interfaces> <hw-dhcp:dhcp-config xmlns:hw-dhcp="urn:huawei:params:xml:ns:yang:huawei-dhcp"> <hw-dhcp:dhcpv4-config> <hw-dhcp:enable>true</hw-dhcp:enable> <hw-dhcp:dhcp-relay-configuration> <hw-dhcp:dhcp-relays> <hw-dhcp:dhcp-relay> <hw-dhcp:interface-name>Vlanif3</hw-dhcp:interface-name> <hw-dhcp:enable>true</hw-dhcp:enable> <hw-dhcp:server-ip>10.1.1.2</hw-dhcp:server-ip> </hw-dhcp:dhcp-relay> </hw-dhcp:dhcp-relays> </hw-dhcp:dhcp-relay-configuration> </hw-dhcp:dhcpv4-config> </hw-dhcp:dhcp-config> </config> </edit-config> </rpc>
Response example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <ok/> </rpc-reply>
Sample of failed response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message> Please enable DHCP in the global view first.</error-message> <error-info>Error on node /huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name="Vlanif3"]/enable</error-info> </rpc-error> </rpc-reply>
Configuring the Re-routing Function for Distributed Gateways on the DHCP Relay Agent
This section provides a sample of configuring the re-routing function for distributed gateways on the DHCP relay agent using the rpc method.
You need to configure the Option82 field to carry backhaul information of DHCP messages before configuring this function. For the Option82 field configuration, see Configuring the Option82 Function.
Operation |
XPATH |
---|---|
rpc |
/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay/anycast-gw-reroute-enable |
Data Requirements
Item |
Data |
Description |
---|---|---|
Whether to enable DHCP |
true |
Enable DHCP. |
Whether to enable the DHCP relay function |
true |
Enable the DHCP relay function. |
Interface name |
VBDIF26 |
Set the name of the interface enabled with the DHCP relay function to VLANIF3. |
Whether to enable the re-routing function for distributed gateways on the DHCP relay agent. |
true |
Enable the re-routing function for distributed gateways on the DHCP relay agent. |
Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <bd:bridge-domains xmlns:bd="urn:huawei:params:xml:ns:yang:huawei-bd" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge"> <bd:bridge-domain> <bd:id>26</bd:id> </bd:bridge-domain> </bd:bridge-domains> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <name>Vbdif26</name> <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type> </interface> </interfaces> <dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp"> <dhcpv4-config> <enable>true</enable> <dhcp-relay-configuration> <dhcp-relays> <dhcp-relay xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <interface-name>Vbdif26</interface-name> <enable>true</enable> <anycast-gw-reroute-enable>true</anycast-gw-reroute-enable> </dhcp-relay> </dhcp-relays> </dhcp-relay-configuration> </dhcpv4-config> </dhcp-config> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <ok/> </rpc-reply>
Sample of failed response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="11"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name='Vbdif26']/anycast-gw-reroute-enable</error-path> <error-message>parse rpc config error.(Invalid value in "anycast-gw-reroute-enable" element.).</error-message> </rpc-error> </rpc-reply>
Configuring the Option82 Function
This section provides a sample of configuring the Option82 function using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Data Requirements
Item |
Data |
Description |
---|---|---|
Whether to enable the Option82 function on a DHCP relay agent |
true |
Enable the Option82 function on the DHCP relay agent. |
Whether to enable the function of adding the Option82 field to DHCP messages |
true |
Enable the function of adding the Option82 field to DHCP messages. |
Whether to enable the function of adding sub-option 9 to the Option82 field |
true |
Enable the function of adding sub-option 9 to the Option82 field. |
Format of sub-option 9 in the Option82 field | ip-address |
Set the format of sub-option 9 in the Option82 field to the IP address format. |
Request Example
<rpc message-id="123" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <bd:bridge-domains xmlns:bd="urn:huawei:params:xml:ns:yang:huawei-bd" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge"> <bd:bridge-domain> <bd:id>26</bd:id> </bd:bridge-domain> </bd:bridge-domains> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <interface xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <name>Vbdif26</name> <type xmlns:x="urn:ietf:params:xml:ns:yang:iana-if-type">x:propVirtual</type> </interface> </interfaces> <dhcp-config xmlns="urn:huawei:params:xml:ns:yang:huawei-dhcp"> <dhcpv4-config> <enable>true</enable> <dhcp-relay-configuration> <dhcp-relays> <dhcp-relay xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge"> <interface-name>Vbdif26</interface-name> <enable>true</enable> <relay-information> <enable>true</enable> </relay-information> </dhcp-relay> </dhcp-relays> </dhcp-relay-configuration> <hw-dhcp:dhcp-option82-configuration> <hw-dhcp:option82-enable> <hw-dhcp:bd> <hw-dhcp:bd-id>26</hw-dhcp:bd-id> <hw-dhcp:insert-enable>true</hw-dhcp:insert-enable> </hw-dhcp:bd> </hw-dhcp:option82-enable> <hw-dhcp:option82-format> <hw-dhcp:vendor-specific-format> <hw-dhcp:global> <hw-dhcp:vsys>pub</hw-dhcp:vsys> <hw-dhcp:vendor-sub-option> <hw-dhcp:sub-option-code>23</hw-dhcp:sub-option-code> <hw-dhcp:ip-address>10.1.1.1</hw-dhcp:ip-address> </hw-dhcp:vendor-sub-option> </hw-dhcp:global> </hw-dhcp:vendor-specific-format> </hw-dhcp:option82-format> <hw-dhcp:sub-option-enable> <hw-dhcp:bd xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="merge"> <hw-dhcp:bd-id>26</hw-dhcp:bd-id> <hw-dhcp:vendor-specific-enable>true</hw-dhcp:vendor-specific-enable> </hw-dhcp:bd> </hw-dhcp:sub-option-enable> </hw-dhcp:dhcp-option82-configuration> </dhcpv4-config> </dhcp-config> </config> </edit-config> </rpc>
Response Example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="123"> <ok/> </rpc-reply>
Sample of failed response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="47"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/huawei-dhcp:dhcp-config/dhcpv4-config/dhcp-relay-configuration/dhcp-relays/dhcp-relay[interface-name='Vlanif4000']/relay-information/enable</error-path> <error-message>parse rpc config error.(Invalid value in "enable" element.).</error-message> </rpc-error> </rpc-reply>
Configuring a DHCP Client
Data Model
The data model file matching DHCP client is huawei-ip.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/huawei-ip:ip-address-extend-type |
Indicates whether to enable the DHCP client function on an interface. |
IdentityRef value. The values are as follows:
|
N/A |
Configuring a DHCP Client on an Interface
This section provides a sample of configuring a DHCP client on an interface using the config method.
Operation |
XPATH |
---|---|
config |
/ietf-interfaces:interfaces/interface/ietf-ip:ipv4/huawei-ip:ip-address-extend-type |
Data Requirements
Item |
Data |
Description |
---|---|---|
Interface name |
Vlanif2 |
Configure the DHCP client function on VLANIF 2, that is, the interface uses DHCP to obtain an IP address. |
Whether to enable the DHCP client function on an interface |
dhcp |
Request example
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"> <if:interface> <if:name>Vlanif2</if:name> <if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:propVirtual</if:type> <ip:ipv4 xmlns:ip="urn:ietf:params:xml:ns:yang:ietf-ip"> <hw-ip:ip-address-extend-type xmlns:hw-ip="urn:huawei:params:xml:ns:yang:hw-ip">dhcp</hw-ip:ip-address-extend-type> </ip:ipv4> </if:interface> </if:interfaces> </config> </edit-config> </rpc>
Response example
Sample of successful response
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <ok/> </rpc-reply>
Sample of failed response
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"> <rpc-error> <error-type>application</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-path>/ietf-interfaces:interfaces/interface[name='Vlanif2']/ietf-ip:ipv4/huawei-ip:ip-address-extend-type</error-path> <error-message>parse rpc config error.(Failed to resolve identityref "huawei-ip:dhc".).</error-message> </rpc-error> </rpc-reply>