This document describes how to clear a single Address Resolution Protocol (ARP) entry in a router using Simple Network Management Protocol (SNMP).
There are no specific requirements for this document.
The information in this document is based on all devices which support RFC1213MIB running Cisco IOSĀ® software.
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, make sure that you understand the potential impact of any command.
Refer to Cisco Technical Tips Conventions for more information on document conventions.
There is no Cisco IOS software command to clear a single ARP table entry. The Cisco IOS software clear arp-cache command clears the entire table.
You can use the SNMP with the MIB object ipNetToMediaType (.1.3.6.1.2.1.4.22.1.4) within the tableipNetToMediaTable (.1.3.6.1.2.1.4.22) from the RFC1213 MIB.
.1.3.6.1.2.1.4.22 ipNetToMediaTable OBJECT-TYPE -- FROM RFC1213-MIB DESCRIPTION "The IP Address Translation table used for mapping from IP addresses to physical addresses." ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) ip(4) 22 } .1.3.6.1.2.1.4.22.1.4 ipNetToMediaType OBJECT-TYPE -- FROM RFC1213-MIB SYNTAX Integer { other(1), invalid(2), dynamic(3), static(4) } MAX-ACCESS read-create STATUS Current DESCRIPTION "The type of mapping. Setting this object to the value invalid(2) has the effect of invalidating the corresponding entry in the ipNetToMediaTable. That is, it effectively disassociates the interface identified with said entry from the mapping identified with said entry. It is an implementation-specific matter as to whether the agent removes an invalidated entry from the table. Accordingly, management stations must be prepared to receive tabular information from agents that corresponds to entries not currently in use. Proper interpretation of such entries requires examination of the relevant ipNetToMediaType object." ::= { iso(1) org(3) dod(6) internet(1) mgmt(2) mib-2(1) ip(4) ipNetToMediaTable(22) ipNetToMediaEntry(1) 4 }
When you run ansnmpseton the MIB Object,ipNetToMediaType (.1.3.6.1.2.1.4.22.1.4), to invalid=2, you can delete a single ARP entry.
Note: Make sure to configure the SNMP Read-Only(RO)/Read-Write (RW) Community Strings on the router.
Here is the snmpwalk output of the MIB Object ipNetToMediaType on the router:
snmpwalk 172.16.99.1 public .1.3.6.1.2.1.4.22.1.4 ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.1.172.16.98.1 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.1.172.16.98.2 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.2.172.16.98.36 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.2.172.16.98.37 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.3.172.16.97.1 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.3.172.16.97.101 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.3.172.16.97.254 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.4.172.16.98.41 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.4.172.16.98.45 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.7.172.16.96.1 = other(1) --<snip>--
When you execute an snmpset to one ARP entry, for example:
ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.1.172.16.98.2 = dynamic(3)
and set its value to 2=invalid, according to the MIB definition:
snmpset 172.16.99.1 private ipNetToMediaType.1.172.16.98.2 i 2 ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.1.172.16.98.2 = invalid(2)
If you execute another snmpwalk of the MIB Object ipNetToMediaType on the router, you see this output:
snmpwalk 172.16.99.1 public .1.3.6.1.2.1.4.22.1.4 ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.1.172.16.98.1 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.2.172.16.98.36 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.2.172.16.98.37 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.3.172.16.97.1 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.3.172.16.97.101 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.3.172.16.97.254 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.4.172.16.98.41 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.4.172.16.98.45 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.7.172.16.96.1 = other(1) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.7.172.16.96.31 = dynamic(3) ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.7.172.16.96.40 = dynamic(3) --<snip>--
The targeted output is no longer in the output.
ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType.1.172.16.98.2 = dynamic(3)
Here's an explanation of the variables used above:
172.16.99.1 = IP address of the router used in this example.
private = RW SNMP Community string of the router
public = RO SNMP Community string of the router
.1.3.6.1.2.1.4.22.1.4= Object ID (OID) for the MIB Object ipNetToMediaType
i = Integer as defined SYNTAX in the MIB
2 (invalid)= Value of the MIB object