跳转到内容

DHCP‑Server

此内容尚不支持你的语言。

This chapter provides examples on how to use Netconf to manage DHCP Server configurations on AsterNOS devices.

Request example to get all DHCP Server configurations via get-config with subtree filter.

<filter type="subtree">
<top>
<dhcp-server/>
</top>
</filter>

Response example

<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<top>
<dhcp-server xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-server">
<failover>
<max-response-delay-time>600</max-response-delay-time>
<local-address>Loopback0</local-address>
<peer-address>11.1.1.1</peer-address>
<role>primary</role>
</failover>
<class>
<name>class1</name>
<rule>
<id>2</id>
<option>pxe-system-type</option>
<option-value>0x12ab</option-value>
</rule>
</class>
<class>
<name>class2</name>
<rule>
<id>2</id>
<option>circuit-id</option>
<option-value>abc123</option-value>
</rule>
<rule>
<id>3</id>
<option>remote-id</option>
<option-value>abc123</option-value>
</rule>
</class>
<option-group>
<id>3</id>
<bootfile-name>filename111</bootfile-name>
<capwap-ac-address>5.6.6.6</capwap-ac-address>
<vendor-specific-information>01020304</vendor-specific-information>
<default-gateway>9.9.9.9</default-gateway>
<tftp-server>www.111.com</tftp-server>
</option-group>
<v4-pool>
<name>pool1</name>
<network>10.5.8.0/24</network>
<start-ip>10.5.8.10</start-ip>
<end-ip>10.5.8.20</end-ip>
<domain-name-server>1.1.1.1</domain-name-server>
<bootfile-name>file.test</bootfile-name>
<capwap-ac-address>1.1.1.2</capwap-ac-address>
<vendor-specific-information>01020304</vendor-specific-information>
<default-gateway>10.5.8.1</default-gateway>
<tftp-server>1.1.1.5</tftp-server>
<default-lease-time>3600</default-lease-time>
<max-lease-time>7200</max-lease-time>
<vlan>Vlan100</vlan>
<next-server>1.1.1.4</next-server>
</v4-pool>
<v6-pool>
<name>pool2</name>
<network>2001:db8::/64</network>
<start-ip>2001:db8::100</start-ip>
<end-ip>2001:db8::200</end-ip>
<domain-name-server>2001:4860:4860::8888</domain-name-server>
<default-lease-time>3600</default-lease-time>
<max-lease-time>7200</max-lease-time>
<vlan>Vlan100</vlan>
</v6-pool>
<interfaces>
<name>Ethernet1</name>
<enabled>true</enabled>
</interfaces>
<interfaces>
<name>PortChannel0001</name>
<enabled>true</enabled>
</interfaces>
<interfaces>
<name>Vlan200</name>
<enabled>true</enabled>
</interfaces>
</dhcp-server>
</top>
</data>

Request example to set a DHCP Option Group configuration via edit-config.

<config>
<top>
<dhcp-server>
<option-group>
<id>3</id>
<bootfile-name>filename111</bootfile-name>
<capwap-ac-address>5.6.6.6</capwap-ac-address>
<vendor-specific-information>0X01020304</vendor-specific-information>
<default-gateway>9.9.9.9</default-gateway>
<tftp-server>www.111.com</tftp-server>
</option-group>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815">
<ok/>
</rpc-reply>

Request example to set a DHCP Class configuration via edit-config.

<config>
<top>
<dhcp-server>
<class>
<name>class1</name>
<rule>
<id>2</id>
<option>pxe-system-type</option>
<option-value>0x12ab</option-value>
</rule>
</class>
<class>
<name>class2</name>
<rule>
<id>2</id>
<option>circuit-id</option>
<option-value>abc123</option-value>
</rule>
<rule>
<id>3</id>
<option>remote-id</option>
<option-value>abc123</option-value>
</rule>
</class>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815">
<ok/>
</rpc-reply>

Request example to set a DHCP failover configuration via edit-config.

<config>
<top>
<dhcp-server>
<failover>
<max-response-delay-time>600</max-response-delay-time>
<local-address>Loopback0</local-address>
<peer-address>11.1.1.1</peer-address>
<role>primary</role>
</failover>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815">
<ok/>
</rpc-reply>

Request example to set a DHCP Pool configuration via edit-config.

<config>
<top>
<dhcp-server>
<v4-pool>
<name>pool1</name>
<network>10.5.8.0/24</network>
<start-ip>10.5.8.10</start-ip>
<end-ip>10.5.8.20</end-ip>
<domain-name-server>1.1.1.1</domain-name-server>
<default-gateway>10.5.8.1</default-gateway>
<default-lease-time>3600</default-lease-time>
<max-lease-time>7200</max-lease-time>
<bootfile-name>file.test</bootfile-name>
<capwap-ac-address>1.1.1.2</capwap-ac-address>
<vendor-specific-information>01020304</vendor-specific-information>
<next-server>1.1.1.4</next-server>
<tftp-server>1.1.1.5</tftp-server>
<vlan>Vlan100</vlan>
</v4-pool>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815">
<ok/>
</rpc-reply>

Request example to set a DHCPv6 Pool configuration via edit-config.

<config>
<top>
<dhcp-server>
<v6-pool>
<name>pool2</name>
<network>2001:db8::1/64</network>
<start-ip>2001:db8::100</start-ip>
<end-ip>2001:db8::200</end-ip>
<domain-name-server>2001:4860:4860::8888</domain-name-server>
<default-lease-time>3600</default-lease-time>
<max-lease-time>7200</max-lease-time>
<vlan>Vlan100</vlan>
</v6-pool>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815">
<ok/>
</rpc-reply>

Request example to set interface binding in DHCP Pool configuration via edit-config.

<config>
<top>
<dhcp-server>
<interfaces operation="merge">
<name>Ethernet1</name>
<enabled>true</enabled>
</interfaces>
<interfaces operation="merge">
<name>PortChannel0001</name>
<enabled>true</enabled>
</interfaces>
<interfaces operation="merge">
<name>Vlan200</name>
<enabled>true</enabled>
</interfaces>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:487ac1eb-4a86-4f44-bd6f-87a16ad92815">
<ok/>
</rpc-reply>

Request example to delete DHCP Option Group configurations via edit-config.

<config>
<top>
<dhcp-server>
<option-group operation="delete">
<id>3</id>
</option-group>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:81c62129-0eed-4041-93a9-dd748f2c9dcf">
<ok/>
</rpc-reply>

Request example to delete DHCP Class configurations via edit-config.

<config>
<top>
<dhcp-server>
<class operation="delete">
<name>class2</name>
</class>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:81c62129-0eed-4041-93a9-dd748f2c9dcf">
<ok/>
</rpc-reply>

Request example to delete DHCP Pool configurations via edit-config.

<config>
<top>
<dhcp-server>
<v4-pool operation="delete">
<name>pool1</name>
</v4-pool>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:81c62129-0eed-4041-93a9-dd748f2c9dcf">
<ok/>
</rpc-reply>

Request example to delete DHCPv6 Pool configurations via edit-config.

<config>
<top>
<dhcp-server>
<v6-pool operation="delete">
<name>pool2</name>
</v6-pool>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:81c62129-0eed-4041-93a9-dd748f2c9dcf">
<ok/>
</rpc-reply>

Request example to unbinding the interface of DHCP Pool via edit-config.

<config>
<top>
<dhcp-server>
<interfaces operation="merge">
<name>Ethernet1</name>
<enabled>false</enabled>
</interfaces>
</dhcp-server>
</top>
</config>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:81c62129-0eed-4041-93a9-dd748f2c9dcf">
<ok/>
</rpc-reply>

Request example to show DHCP Pool info via rpc show-dhcp-pool-info.

<show-dhcp-pool-info>
<version>v4</version>
</show-dhcp-pool-info>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ba1ff87c-59dd-4a3f-a7eb-193373a293a7">
<data xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-snooping"/>
--------------------------------------------------
Pool-name : pool1
Subnet : 10.5.8.0/24
Lease : 10.5.8.10 - 10.5.8.20
Lease_default_time : 3600
Lease_max_time : 7200
DNS : 1.1.1.1
Routers : 10.5.8.1
Capwap-ac : 1.1.1.2
Bootfile-name : file.test
Option43 : 01020304
Next-server : 1.1.1.4
Tftp-server : 1.1.1.5
Vlan : Vlan100
</data>
</rpc-reply>

Request example to show DHCPv6 Pool info via rpc show-dhcp-pool-info.

<show-dhcp-pool-info>
<version>v6</version>
</show-dhcp-pool-info>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ba1ff87c-59dd-4a3f-a7eb-193373a293a7">
<data xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-snooping"/>
--------------------------------------------------
Pool-name : pool2
Subnet : 2001:db8::/64
Lease : 2001:db8::100 - 2001:db8::200
Lease_default_time : 3600
Lease_max_time : 7200
DNS : 2001:4860:4860::8888
Vlan : Vlan100
</data>
</rpc-reply>

Request example to show DHCP Pool IP in use via rpc show-dhcp-pool-ip-in-use.

<show-dhcp-pool-ip-in-use>
<version>v4</version>
</show-dhcp-pool-ip-in-use>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ba1ff87c-59dd-4a3f-a7eb-193373a293a7">
<data xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-snooping"/>
+--------------+-------------------+-------------------------+-------------------------+
| IP Address | MAC Address | Lease Start | Lease End |
+==============+===================+=========================+=========================+
| 10.5.8.10 | 0c:16:03:d4:a7:b4 | 2025-03-29 12:20:52 UTC | 2025-03-29 13:20:52 UTC |
+--------------+-------------------+-------------------------+-------------------------+
</data>
</rpc-reply>

Request example to show DHCPV6 Pool IP in use via rpc show-dhcp-pool-ip-in-use.

<show-dhcp-pool-ip-in-use>
<version>v6</version>
</show-dhcp-pool-ip-in-use>

Response example

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:ba1ff87c-59dd-4a3f-a7eb-193373a293a7">
<data xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-snooping"/>
+-----------------+-------------------+-------------------------+-------------------------+
| IPv6 Address | MAC Address | Lease Start | Lease End |
+=================+===================+=========================+=========================+
| 2001:db8:1::103 | 0c:16:03:d4:a7:b4 | 2025-03-29 12:20:58 UTC | 2025-03-29 12:30:58 UTC |
+-----------------+-------------------+-------------------------+-------------------------+
</data>
</rpc-reply>