cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3954
Views
10
Helpful
2
Replies

Cisco Catalyst port -> VLAN and MAC-address

phsorensen
Beginner
Beginner

Hi

For a given port on a Catalyst 4948 I need to determine:

  1. if the interface is a trunk
  2. which mac-addresses the interface has seen (same info as "show mac-address-table dynamic" gives)
  3. which VLAN the interface is on

The major problem is the it seems that I have to do reverse engineering:
examine all VLAN's, cache all MAC-addresses and look for the ifIndex...

Is there any better way to do that (hopefully without traversing everything)?

I found SNMP::Info, which gives me i_vlan_membership() and v_name(), but that
is only half-way through...

Thank you
Poul

1 Accepted Solution

Accepted Solutions

phsorensen
Beginner
Beginner

I asked the same question on https://lists.sourceforge.net/lists/listinfo/snmp-info-users

  • Netdisco was suggested
  • Kesy suggested a solution that I implemented using perl and SNMP::Info, the outline:
        1. $switch->vtp_trunk_dyn_stat() - to get trunking/notTrunking interface status
        2. $switch->fw_mac() - to get forwarding table for each vlan. Remember about community string indexing
        3. $switch->i_vlan() - to get vlan id on interface

      I have attached my script

      Poul

      Message was edited by: Poul Sorensen

      View solution in original post

      2 Replies 2

      Kevin Dorrell
      Advocate
      Advocate

      Poul,

      I'm afraid I don't know an easy way to do this, but I understand the frustration.  It's something that is so easy using the CLI, but when you try and do it with SNMP the information is presented "back to front", so it is a long involved process of loading whole tables and then doing seraches.

      I use CA Spectrum and I wrote a script to trace a MAC address through the network so that I could track down rogue hosts and errors in my model placements.  I did it using exactly the same steps as you suggest.  That is, I go to the router, download its ARP cache to look up the IP address I am interested in and get the VLAN.  Then starting at the VLAN root, I go to each switch in turn, laboriously download its forwarding table using CommunityString@VLAN, get the ifindex of the next hop port, etc. etc.

      The only thing I can suggest is to search the MIB specifications to se if there any shortcuts.  If you find any, then please let me know .

      Kevin Dorrell

      Luxembourg

      phsorensen
      Beginner
      Beginner

      I asked the same question on https://lists.sourceforge.net/lists/listinfo/snmp-info-users

      • Netdisco was suggested
      • Kesy suggested a solution that I implemented using perl and SNMP::Info, the outline:
            1. $switch->vtp_trunk_dyn_stat() - to get trunking/notTrunking interface status
            2. $switch->fw_mac() - to get forwarding table for each vlan. Remember about community string indexing
            3. $switch->i_vlan() - to get vlan id on interface

          I have attached my script

          Poul

          Message was edited by: Poul Sorensen

          Getting Started

          Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: