Newsgroup: it.comp.reti.cisco
Titolo: Cisco Catalyst 6000 Forwarding Table

Hi,
I'm using SNMP to query the forwarding table of our cisco catalyst 6000
Switch.
When I walk through 1.3.6.1.2.1.17., I collect all mac addresses behind
the ports that are in VLAN1 (the management VLAN of the switch). 
The problem is that I cannot find any information about the forwarding
table of the other VLAN's. I can only  discover them by entering "Show
Cam Dynamic vlanNr" at the CLI
Does anyone has any experience in this matter?? Do have to look at
another OID?

 wrote in message
news:3B85296F...@imec.be...

We have a Tcl script that extracts bridge table information from a number of
devices.  Kevin Chan (
kc...@po.cwru.edu
) wrote the routine that extracts the
bridge tables from a Cisco 6000 series.  The routine is shown below (this
routine is just part of a much larger software system).  If you have any
other questions you might send him an e-mail.
Barron Hulver
bar...@po.cwru.edu
set CiscoOID 1.3.6.1.4.1.9.1.113
set Cisco2924OID 1.3.6.1.4.1.9.1.220
set Cisco2610OID 1.3.6.1.4.1.9.1.185
set Cisco2620OID 1.3.6.1.4.1.9.1.209
set Cisco3500OID 1.3.6.1.4.1.9.1.278
set Cisco6509OID 1.3.6.1.4.1.9.5.44
set Cisco6009OID 1.3.6.1.4.1.9.5.39
set Cisco4003OID 1.3.6.1.4.1.9.5.40
set Cisco2948OID 1.3.6.1.4.1.9.5.42
set Cisco4912OID 1.3.6.1.4.1.9.5.41
#---------------------------------------------------------------------------
#
#Procedure to dump a bridge table from a Cisco Catalyst 6000 Series
#  Loop through each vlan and grab bridge Table
#  add "@<vlan#>" to the end of Community Name
#
proc dumpCatalyst { host community } {
  global Cisco2924OID
  global Cisco2610OID
  global Cisco3500OID
  global Cisco6509OID
  global Cisco6009OID
  global Cisco4003OID
  global Cisco2948OID
  global Cisco4912OID
  global sysOID
  set vlanIndexOID 1.3.6.1.4.1.9.5.1.9.2.1.1
  set vtpVlanTypeOID 1.3.6.1.4.1.9.9.46.1.3.1.1.3
  set crossIndexOID 1.3.6.1.4.1.9.5.1.4.1.1.3
  set groupIndexOID 1.3.6.1.4.1.9.9.87.1.4.1.1.4
  set vlanIndex {}
  #---------------
  #Find catalyst VLANs
  #---------------
  set s [snmp session -timeout 25 -address $host -community $community]
  if [catch {$s walk tempVLANidx "$vtpVlanTypeOID" {
#     lappend vlanIndex [lindex [lindex $tempVLANidx 0] 2]
     lappend vlanIndex [lindex [split [lindex [lindex $tempVLANidx 0] 0] .]
15]
  }} errString ] {
     syslog error "collector ($host): TableWalk: $errString"
     $s destroy
     return ERROR
  }
  #close snmp session, vlanIndex now has all VLAN index
  $s destroy
  #--------------
puts "$host $vlanIndex"
  #--------------
  #Build Port Table
  #--------------
  set ciList {}
  set s [snmp session -timeout 25 -address $host -community $community]
  set cat29003500 "$Cisco3500OID $Cisco2924OID $Cisco2948OID"
  if {[lsearch $cat29003500 $sysOID] >=0} {
    set IndexOID $groupIndexOID
    set modIdx 14
    set portIdx 15
  } else {
    set IndexOID $crossIndexOID
    set modIdx 13
    set portIdx 14
  }
  if [catch {$s walk entry "$IndexOID" {
      set module [lindex [split [lindex [lindex $entry 0] 0] .] $modIdx]
      set port [lindex [split [lindex [lindex $entry 0] 0] .] $portIdx]
      set crossIndex [lindex [lindex $entry 0] 2]
      set portlist($crossIndex) "$module $port"
      lappend ciList $crossIndex
  } } errString ] {
        syslog error "collector ($host): TableWalk: $errString"
        $s destroy
        puts "PortList error $errString"
        return ERROR
  }
  $s destroy
  #--------------
  #--------------
  #Get Bridge Table
  #--------------
  set AddrTbl [list]
  foreach vlan $vlanIndex {
   #Temporarily skip VLAN 100 (Crawford 6509 ATM vlan)
   #  11/27 skipping KSL ATM vlan also (VLAN 10)
   #  'causing SNMP to hang
   if {$vlan==100} {
    continue
   }
   if {$vlan==10}  {
    continue
   }
   #dump the dot1d bridge table
   set dot1dTbl [dumpDot1d $host $community@$vlan]
   # for each entry, set the board ID to 1
   foreach entry $dot1dTbl {
          if { [lsearch $ciList [lindex $entry 1]] < 0} {
                set mod 0
                set port [lindex $entry 1]
          } else {
                set mod [lindex $portlist([lindex $entry 1]) 0]
                set port [lindex $portlist([lindex $entry 1]) 1]
          }
          lappend AddrTbl [list [lindex $entry 0] $mod $port]
   }
  }
  return $AddrTbl
}
#--------------------------------------------------------------------------
#
# Procedure to dump a standard dot1d bridge table via snmp
#
proc dumpDot1d { host community } {
# open the snmp session
set s [snmp session -timeout 25 -address $host -community $community]
#dump the bridge table
set AddrTbl [list]
# Walk the dot1dbridge table entries corresponding to MAC and port. Bail on
errors.
# only collect learned entries
#puts "walkdot"
if [catch {$s walk address "1.3.6.1.2.1.17.4.3.1.1 1.3.6.1.2.1.17.4.3.1.2
1.3.6.1.2.1.17.4.3.1.3" {
        if { [string match [lindex [lindex $address 2] 2] learned] } {
                set MAC [lindex [lindex $address 0] 2]
                set port [lindex [lindex $address 1] 2]
                #puts "$MAC : $port"
                lappend AddrTbl [list $MAC $port]
        }
}} errString ] {
        syslog error "collector ($host): TableWalk: $errString"
        $s destroy
        return ERROR
}
# close the snmp session and return the address table
$s destroy
return $AddrTbl
}

Hi,
you have to use community indexing! To get all mac adresses of a VLAN
123 modify your community string from 'public' to 'public@123'. To get
all mac adresses of a catalyst you'll have to query the catalyst VLANs
and loop over all VLANs.
Pieter Uytterhoeven schrieb:

-- 
___________________________________________________________
 Stefan G. R. Finzel    Dipl. Phys. (Univ.)
 Amalienstraße 69/IV    Phone 
+49 (0)911 7419474
 D - 90763 Fürth        EMail mailto:
fin...@osn.de
 Germany, Europe        URL   
http://www.osn.de/user/finzel/
___________________________________________________________