(seeing as this is probably useful to other people as well, I thought
I'd
post this to the whole list .... it also applies to Cisco routers when
you
add cards to a 7500, for instance)
Well, if you have a system with Perl and the SNMP_Session module,Quote:> How can I tell the interface Index from the Catalyst
> command line if it doesn't show up in the "show port"
> info line using 4.1 ? I know 4.5 puts the index right
> in the 'show port' screen. assume no CWSI
then you could find out via SNMP using the following program
( of course, the standard disclaimers apply ... the program works for
me - if you choose to use it and it doesn't work, feel free to fix the
problem yourself, etc. ;-) )
It prints out a list of interface name vs. snmp index number
Here's an example of a 2820 with FDDI module:
# getifid.pl switch1 ro_community
1 : 1
2 : 2
3 : 3
4 : 4
5 : 5
6 : 6
7 : 7
8 : 8
9 : 9
10 : 10
11 : 11
12 : 12
13 : 13
14 : 14
15 : 15
16 : 16
17 : 17
18 : 18
19 : 19
20 : 20
21 : 21
22 : 22
23 : 23
24 : 24
AUI : 25
A : 26
B : 27
Here's a (partial) example of a 7500:
# getifid.pl router1 ro_community
Fddi1/0/0 : 1
Serial1/1/0 : 2
Serial1/1/1 : 3
Serial1/1/2 : 4
Serial1/1/3 : 5
Serial1/1/4 : 6
Serial1/1/5 : 7
Serial1/1/6 : 8
Serial1/1/7 : 9
Serial4/0/0 : 10
Serial4/0/1 : 11
Serial4/0/2 : 12
Serial4/0/3 : 13
Serial4/0/4 : 14
Serial4/0/5 : 15
Serial4/0/6 : 16
Serial4/0/7 : 17
Serial4/1/0 : 18
Serial4/1/1 : 19
Serial4/1/2 : 20
....
Sorry, I don't have a Cat 5000 handy to grab an example from ...
Regards,
Rob.
getifid.pl
===================================================
#!/usr/local/bin/perl -w
use strict;
use SNMP_Session;
use SNMP_util;
if ($#ARGV+1 < 1 || $#ARGV+1 > 2)
{
print STDERR "usage: $0 hostname [community]\n";
print STDERR "\tcommunity will default to public if you don't provide
it.\n";
exit 1;
}
my($router) = $ARGV[0];
my($community) = "public";
$community = $ARGV[1] unless (! defined($ARGV[1]));
my($ifDescr) = '.1.3.6.1.2.1.2.2.1.2';
my($row);
foreach $row (snmpwalk($snmp, $ifDescr))
{
my($oid, $value) = split(/:/, $row, 2);
$oid =~ s/$ifDescr//;
print " $value : $oid\n";
}