Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Cisco Catalyst port -> VLAN and MAC-address

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

Everyone's tags (5)
1 ACCEPTED SOLUTION

Accepted Solutions
New Member

Re: Cisco Catalyst port -> VLAN and MAC-address

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

      2 REPLIES

      Re: Cisco Catalyst port -> VLAN and MAC-address

      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

      New Member

      Re: Cisco Catalyst port -> VLAN and MAC-address

      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

          3127
          Views
          0
          Helpful
          2
          Replies
          CreatePlease to create content