DHCP‑Snooping
9 min
AsterNOS-DHCP-Snooping
This chapter provides examples on how to use Netconf to manage DHCP Snooping configurations on AsterNOS devices.
Get Current DHCP Snooping Configurations
Request example to get all DHCP Snooping configurations via get-config with subtree filter.
<filter type="subtree">
<top>
<dhcp-snooping/>
</top>
</filter>Response example
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<top>
<dhcp-snooping xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-snooping">
<global>
<dhcp4-enabled>true</dhcp4-enabled>
<dhcp6-enabled>true</dhcp6-enabled>
<autosave>false</autosave>
</global>
<interfaces>
<interface>
<name>Ethernet1</name>
<enabled>true</enabled>
<trusted>true</trusted>
</interface>
<interface>
<name>Vlan100</name>
<enabled>true</enabled>
<trusted>true</trusted>
</interface>
</interfaces>
</dhcp-snooping>
</top>
</data>Set DHCP Snooping Configurations
Request example to set DHCP Snooping configuration via edit-config.
<config>
<top>
<dhcp-snooping>
<global operation="merge">
<dhcp4-enabled>true</dhcp4-enabled>
<dhcp6-enabled>true</dhcp6-enabled>
<autosave>false</autosave>
</global>
<interfaces>
<interface>
<name>Ethernet1</name>
<enabled>true</enabled>
<trusted>true</trusted>
</interface>
<interface>
<name>Vlan100</name>
<enabled>true</enabled>
<trusted>true</trusted>
</interface>
</interfaces>
</dhcp-snooping>
</top>
</config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:06239f01-5869-41af-84dd-0e4f1e1e774d">
<ok/>
</rpc-reply>Delete DHCP Snooping Configuration
Request example to delete DHCP Snooping configurations of interface via edit-config.
<config>
<top>
<dhcp-snooping>
<interfaces>
<interface operation="delete">
<name>Vlan100</name>
</interface>
</interfaces>
</dhcp-snooping>
</top>
</config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:6845257e-fb87-4b08-80c5-2a8b1b1dc264">
<ok/>
</rpc-reply>Show Snooping Table
NOTE: Snooping table include DHCP snooping and ND snooping.
Request example to show DHCP snooping table via rpc show-snooping-table.
<show-snooping-table/>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:79163e9c-c7a9-44b7-936f-56dab72436c2">
<data xmlns="http://asterfusion.com/ns/yang/asternos-dhcp-snooping"/>
<entries>
<vlan>Vlan100</vlan>
<smac>0c:13:d3:82:00:03</smac>
<sip>10.8.8.100</sip>
<lease-time>300</lease-time>
<interface>Ethernet3</interface>
<timestamp>318657056529</timestamp>
<switch-id>10.1.0.1</switch-id>
<flag>local</flag>
</entries>
<entries>
<vlan>Vlan100</vlan>
<smac>0c:13:d3:82:52:03</smac>
<sip>2001::db8:101</sip>
<lease-time>300</lease-time>
<interface>Ethernet3</interface>
<timestamp>41857052629</timestamp>
<switch-id>10.1.0.1</switch-id>
<flag>local</flag>
</entries>
</data>
</rpc-reply>Show Snooping Count
NOTE: Snooping count include DHCP snooping and ND snooping.
Request example to show DHCP snooping table via rpc show-snooping-count.
<show-snooping-count/>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"/>
<total-v4-count>1</total-v4-count>
<total-v6-count>1</total-v6-count>
<local-v4-count>1</local-v4-count>
<local-v6-count>1</local-v6-count>
<remote-v4-count>0</remote-v4-count>
<remote-v6-count>0</remote-v6-count>
</data>
</rpc-reply>