# Why is in all arp table snmp oids an interface index before the ip number?

When I want to get arp information about a single ip number or subnet, I have to snmpwalk the whole arp table, as some oid architects had the "great" idea to always insert an interface index before the ip number in the oid. .1.3.6.1.2.1.3.1.1.2.(interface).(ip) , .1.3.6.1.2.1.4.22.1.2.(interface).(ip) , .1.3.6.1.2.1.4.35.1.4.(interface).1.4.(ip) . Or do I miss something ?

• Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer. – Ron Maupin Dec 17 '20 at 19:48

ARP is actually per interface. A router has a different network for each interface, and ARP is only relevant for the network (interface) of the IP address. Some OSes actually have multiple ARP tables, and you seem to only see it as a single table when listing ARP for the device, but it is really a different table for each interface.

For example, on a Cisco router, you can use the show arp command that will list out all the ARP entries for all the ARP tables, or you can use the show arp <interface> or show arp <network> commands to show a single ARP table for one of the interfaces.

By using the interface index for SNMP, you can see the ARP table of the interface.

Even arp of specific ip can be fetched by command

Show ip arp | i 192.168.X.X in few of cisco high end switches like neXus 6k ,9k and in catalysts layer3 switches.

In windows pc arp -a command is used to get entire arp table association with connected network

• That doesn't answer why there's an interface in each ARP entry. – Zac67 Aug 10 '20 at 14:07

In the meantime i found a solution. The problem is, that a priori only the target IP is known, but not the interface index, so one can not construct the necessary oid for one arp entry .1.3.6.1.2.1.4.22.1.2.interface.ip1.ip2.ip3.ip4, but as one wants to ask the gateway for this arp entry, one has anyway to guess the gateway IP (probably something like ip1.ip2.ip3.1), and so one can find the interface index via the oid -1.3.6.1.2.1.4.20.1.2.ip1.ip2.ip3.1 . With a little bash magic one finally gets snmpbulkwalk -c public -v 2c -OnQx ip1.ip2.ip3.1 .1.3.6.1.2.1.4.22.1.2.\$(snmpget -c public -v 2c -Oqv ip1.ip2.ip3.1 .1.3.6.1.2.1.4.20.1.2.ip1.ip2.ip3.1 | tr -d "\n").ip1.ip2.ip3.ip4