There was a recent comment about a Usenet positing I made back in 2002 in comp.protocols.snmp.
In the post I was responding to someone looking for information on how to decode the value returned from the ipNetToMediaIfIndex when querying an ERS 8600 switch. Thankfully Shane (Nortel) was able to help me come up with the forumla.
card = ( $value AND 62914560 ) / 4194304 port = (( $value AND 4128768) / 65536 ) + 1
With that formula you could now walk the ipNetToMediaTable and retreieve the entire ARP table providing you the card and port number, MAC address, and IP address for each entry in the table.
The next issue was how to deal with MultiLink Trunk interfaces. In this case (and with my current software code) I build a table of all the MLT interfaces prior to polling the ipNetToMediaTable. I still use Perl but it shouldn’t be very hard to convert to PHP.
# rcMltNumMlts $nummlts = $sess->get("rcMltNumMlts.0"); for ($i = 1; $i <= $nummlts; $i++) { # rcMltName $mltname[$i] = $sess->get("rcMltName.$i"); # rcMltId $mltindex[$i] = $sess->get("rcMltId.$i"); # rcMltIfIndex $mltifindex[$i] = $sess->get("rcMltIfIndex.$i"); print "DEBUG: MltId = $i and MltName = $mltname[$i] and MltIndex = $mltindex[$i] and MltIfIndex = $mltifindex[$i]\n" if ($DEBUG); };
Now that we have the rcMltTable in an array we can walk the ipNetToMediaTable and match up any entries. Here’s the code I use (again it’s Perl but you should be able to convert to PHP);
# Evaulate with bitwise operation $card = (($vals[0] & 62914560) / 4194304); $port = (($vals[0] & 4128768) / 65536) + 1; # Evaulate to determine if port is a MLT if ($card != 0) { $intf = (((64 * $card) + $port) - 1); print "DEBUG: $vals[1] address found on card $card port $port\n"; } else { $mlt = 1; print "DEBUG: $vals[1] address found on MLT $mltname[$port]\n"; } # end else
Hopefully that doesn’t look too complicated. The important piece here is that you need to merge the rcMltTable with the ipNetToMediaTable to get your results. If you name the MLT with something meaningful you can then return that string to the application that is making the query.
I wrote a Perl application that would search the ARP table of an Ethernet Routing Switch 8600 dynamically for a specific IP address entry. Here’s an example of the output;
Nortel Passport 8600 Gigabit Switch IP ARP Table Search Initializing query for sw-ccr-8600.datacenter.acme.org for IP address 1.1.1.10... sysDescr = ERS-8610 (4.1.3.0) sysObjectID = .1.3.6.1.4.1.2272.30 sysUpTime = 169 Days 6 Hours 43 mins 11 secs sysContact = Acme Network Infrastructure Team sysName = sw-ccr-8600.datacenter.acme.org sysLocation = USA Please be patient it may take a while to complete the search... DEVICE FOUND 1.1.1.10 (000AE4753FC9) address found on MLT SMLT-5500 We searched through 1183 forwarding records... That's all folks!
I will look to publish the complete code on my website sometime in the near future.
Cheers!
justmacs says
I am looking forward to this code. I have tried to do this in the past but the code would get confused on the SMLTs and just recursively travel down each one in a circle.
rjansen says
That comment was me and I started that comment in an off topic post (http://michaelfmcnamara.blogspot.com/2007/12/ping-snoop.html#links). The link above contains some basic embedded perl in PHP code I wrote based on Michael’s formulae. Referencing it for completeness.
I’m looking forward to the new code ! TIA
CresceNet says
Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my site, it is about the CresceNet, I hope you enjoy. The address is http://www.provedorcrescenet.com . A hug.
rjansen says
When the new example code is available, could a link be posted here for further reference please ?
I’ll try and convert it to embedded perl in PHP code.
(See my previous post)
Thanks in advance.
Michael McNamara says
I’ve posted some basic Perl code to my website that should help those that were interested.
http://mysite.verizon.net/michaelfmcnamara/perl.htm#passportarp
Here’s the specific code;
http://mysite.verizon.net/michaelfmcnamara/files/passportarp.pl.txt
Cheers
rjansen says
Thanks for code indeed !
From what I see, is that for an MLT the card will say 0 and the port will give the MltID, but then you only know the MLT where the address is found.
l elaborate on the matter.
MLT’s consist de-facto of 2 or more ports.
What I’m actually am trying to do is to determine on which EXACT PHYSICAL port a MAC address exists that’s part of an MLT.
Reason,… when you know the EXACT physical port, you can easily search on that port for it’s neighbor via the Nortel topology info by searching for a specific port in the topology table and that should work for MLT’s to a stack, split MLT etc,…
Anyone ideas on that ?