DHCP‑Server
20 min
\<font color="#1d50a2">asternos dhcp server\</font> this chapter provides examples on how to use netconf to manage dhcp server configurations on asternos devices \<font color="#1d50a2">get current dhcp server configurations\</font> 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> \<font color="#1d50a2">set dhcp server configurations\</font> 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> \<font color="#1d50a2">delete dhcp server configuration\</font> 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> \<font color="#1d50a2">show dhcp pool info\</font> 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> \<font color="#1d50a2">show dhcp pool ip in use\</font> 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>
