How to identify which MAC address (non-default VLAN) is learnt from which interface via SNMP

SUMMARY:

This article provides information on how to identify which MAC address (non-default VLAN) is learnt from which interface via SNMP.

Note: This article applies only to legacy EX series products.

SYMPTOMS:

  • For the default VLAN, the dot1dTpFdbAddress object is available to list all the learnt MAC entries.
  • For the non-default VLAN, the customer may expect that dot1qTpFdbAddress can achieve the same requirement.
  • Unfortunately, dot1qTpFdbAddress is not available in Junos, as per RFC 4363.

SOLUTION:
With the following ethernet-switching table as a reference, the procedure to identify which interface is learnt from which MAC address for a certain VLAN is as follows:

{master:0}
lab@EX10> show ethernet-switching table 
Ethernet-switching table: 7 entries, 4 learned
  VLAN              MAC address       Type         Age Interfaces
  default           *                 Flood          - All-members
  vlan750           *                 Flood          - All-members
  vlan750           00:26:88:6d:a9:81 Learn       4:04 ge-0/0/4.0
  vlan750           00:26:88:6d:a9:87 Learn          0 ge-0/0/4.0
  vlan750           00:26:88:74:15:01 Static         - Router
  vlan750           00:26:88:79:4e:4d Learn          0 ge-0/0/10.0
  vlan750           00:26:88:79:4e:4e Learn          0 ge-0/0/11.0 

For example, refer to the line highlighted in blue above; it belongs to vlan750.

  1. Use dot1qVlanStaticName to obtain the VLAN internal index for vlan750. The following output indicates that the value is 4:
    {master:0}
    lab@EX10> show snmp mib walk dot1qVlanStaticName | match vlan750 
    dot1qVlanStaticName.4 = vlan750
    
    The corresponding CLI command is as follows:
    {master:0}
    lab@EX10> show vlans vlan750 extensive | match index    
    802.1Q Tag: 750, Internal index: 4, Admin State: Enabled, Origin: Static
  2. Use dot1qTpFdbPort to obtain all of the entries of the right VLAN (add .4 for the required VLAN)
    {master:0}
    lab@EX10> show snmp mib walk dot1qTpFdbPort.4                   
    dot1qTpFdbPort.4.0.0.0.0.0.0 = 0
    dot1qTpFdbPort.4.0.38.136.109.169.129 = 517
    dot1qTpFdbPort.4.0.38.136.109.169.135 = 517
    dot1qTpFdbPort.4.0.38.136.116.21.1 = 0
    dot1qTpFdbPort.4.0.38.136.121.78.77 = 523
    dot1qTpFdbPort.4.0.38.136.121.78.78 = 524
  3. Obtain the MAC address and port interface Index from the value that was obtained in step 2:
    dot1qTpFdbPort.4.0.38.136.121.78.77 = 523
    0.38.136.121.78.77 is the MAC address in the decimal format and 523 is dot1dBasePortIfIndex.
  4. Convert the MAC address from the decimal format to the Hexadecimal format:
    0.38.136.121.78.77 (Dec)
    equal to
    0:26:88:79:4E:4C (Hex)
  5. Obtain the interface SNMP IfIndex from dot1dTpFdbPort:
    {master:0}
    lab@EX10> show snmp mib walk dot1dBasePortIfIndex | match 523 
    dot1dBasePortIfIndex.523 = 514
    
    Here, 514 is the SNMP IfIndex for the actual interface.
  6. Obtain the interface name from the SNMP IfIndex:
    {master:0}
    lab@EX10> show snmp mib get ifName.514 
    ifName.514    = ge-0/0/10.0
    
    This interface name can also be obtained from the SNMP IfIndex by using the following CLI command:
    {master:0}
    lab@EX10> show interfaces extensive | grep SNMP | match 514 
      Logical interface ge-0/0/10.0 (Index 67) (SNMP ifIndex 514) (Generation 132)
    

With the above procedure, the00:26:88:79:4e:4d MAC address from the ge-0/0/10 interface under vlan750 was identified. You can use the same procedure to obtain all of the MAC addresses and interface names for vlan750.MODIFICATION HISTORY:

2020-05-20: Added note that this article only applies to legacy EX products.

Guess you like

Origin blog.csdn.net/allway2/article/details/121332269