Switching

last person joined: yesterday 

Ask questions and share experiences about EX and QFX portfolios and all switching solutions across your data center, campus, and branch locations.
  • 1.  Use SNMP to figure out which port a MAC address is reachable on

    Posted 09-08-2011 11:54

    Greetings

     

    I have a collection of EX2200 switches running a mixture of 10.2 and 10.3.

     

    I am looking for an OID (or collection of OIDs) I can use to figure out which physical port the switch thinks a given MAC address is.

     

    I am used to using the MIB-II Bridge OIDs and/or the Q-Bridge-II MIBs, but the relevant parts of both these tables return as empty on my EX2200s.

     

    Which OIDs should I be querying?  Or is there some other thing I've neglected to do to make these tables visible via SNMP?

     

    Thanks for your time.



  • 2.  RE: Use SNMP to figure out which port a MAC address is reachable on

    Posted 09-11-2011 01:37


     

    The mibs that are used for pulling the mac address is dot1dTpFdbAddress, 1.3.6.1.2.1.17.4.3.1.1.

    What is the Junos version you are using?

    I checked in 10.4R6 and looks like thos mibs are not present in the Junos version for 2200.

    root> show log snmp_reg_objs | match address
    .1.2.840.10006.300.43.1.1.1.1.2 (dot3adAggMACAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.2.2.1.6 (ifPhysAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.4.22.1.2 (ipNetToMediaPhysAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.4.22.1.3 (ipNetToMediaNetAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.6.13.1.2 (tcpConnLocalAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.6.13.1.4 (tcpConnRemAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.7.5.1.1 (udpLocalAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.10.32.1.1.3 (frDlcmiAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.10.32.1.1.4 (frDlcmiAddressLen) (/var/run/mib2d-11)
    .1.3.6.1.2.1.14.6.1.1 (ospfHostIpAddress) (/var/run/rpd_snmp)
    .1.3.6.1.2.1.14.7.1.1 (ospfIfIpAddress) (/var/run/rpd_snmp)
    .1.3.6.1.2.1.14.7.1.2 (ospfAddressLessIf) (/var/run/rpd_snmp)
    .1.3.6.1.2.1.14.8.1.1 (ospfIfMetricIpAddress) (/var/run/rpd_snmp)
    .1.3.6.1.2.1.14.8.1.2 (ospfIfMetricAddressLessIf) (/var/run/rpd_snmp)
    .1.3.6.1.2.1.14.10.1.2 (ospfNbrAddressLessIndex) (/var/run/rpd_snmp)
    .1.3.6.1.2.1.37.1.2.1.9 (atmInterfaceAddressType) (/var/run/mib2d-11)
    .1.3.6.1.2.1.37.1.2.1.10 (atmInterfaceAdminAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.37.1.2.1.15 (atmInterfaceSubscrAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.55.1.5.1.8 (ipv6IfPhysicalAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.55.1.12.1.2 (ipv6NetToMediaPhysAddress) (/var/run/mib2d-11)
    .1.3.6.1.2.1.83.1.1.2.1.13 (ipMRouteRtAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.37.1.5.1.1.3 (isisISAdjNeighSNPAAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.37.1.5.2.1.2 (isisISAdjAreaAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.37.1.5.3.1.2 (isisISAdjIPAddressType) (/var/run/rpd_snmp)
    .1.3.6.1.3.37.1.5.3.1.3 (isisISAdjIPAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.60.1.1.2.1.13 (ipMRoute1RtAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.61.1.1.2.1.2 (pimInterfaceAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.61.1.1.11.1.3 (pimCandidateRPAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.61.1.1.12.1.2 (pimComponentBSRAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.92.1.1.6 (msdpRPAddressType) (/var/run/rpd_snmp)
    .1.3.6.1.3.92.1.1.7 (msdpRPAddress) (/var/run/rpd_snmp)
    .1.3.6.1.3.92.1.3.1.18 (msdpPeerLocalAddress) (/var/run/rpd_snmp)
    .1.3.6.1.4.1.2636.3.26.1.2.1.10 (jnxVpnLocalAddresses) (/var/run/rpd_snmp)
    .1.3.6.1.4.1.2636.3.26.1.2.1.11 (jnxVpnTotalAddresses) (/var/run/rpd_snmp)
    .1.3.6.1.4.1.2636.3.26.1.4.1.10 (jnxVpnRemotePeIdAddress) (/var/run/rpd_snmp)
    .1.3.6.1.4.1.2636.5.4.1.1.9.1.4 (jnxOspfv3NbrAddressType) (/var/run/rpd_snmp)
    .1.3.6.1.4.1.2636.5.4.1.1.9.1.5 (jnxOspfv3NbrAddress) (/var/run/rpd_snmp)
    .1.3.6.1.6.3.12.1.2.1.3 (snmpTargetAddrTAddress) ()

     

    how ever the mac to ip mapping was seen using the mib given below:

     

    The pc had an ip of 10.1.1.3 and it also shows the mac associated with ip, but mac alone is not pulled.

     

     

    root> show ethernet-switching table
    Ethernet-switching table: 5 entries, 2 learned
      VLAN              MAC address       Type         Age Interfaces
      clients           *                 Flood          - All-members
      clients           00:21:cc:5e:b2:8b Learn          0 ge-0/0/2.0
      clients           84:18:88:ad:a7:c0 Static         - Router
      default           *                 Flood          - All-members
      default           f0:de:f1:3f:b5:b9 Learn          0 ge-0/0/16.0

    root> show snmp mib walk .1.3.6.1.2.1.4.22.1.2
    ipNetToMediaPhysAddress.34.192.168.0.253 = 84 18 88 ad  a7 ff
    ipNetToMediaPhysAddress.38.128.0.0.1 = 00 0b ca fe  00 00
    ipNetToMediaPhysAddress.38.128.0.0.16 = 00 0b ca fe  00 00
    ipNetToMediaPhysAddress.38.128.0.0.32 = 00 0b ca fe  00 00
    ipNetToMediaPhysAddress.561.10.1.1.1 = 84 18 88 ad  a7 c0
    ipNetToMediaPhysAddress.561.10.1.1.3 = 00 21 cc 5e  b2 8b


     

    .1.3.6.1.2.1.4.22.1.2 (ipNetToMediaPhysAddress) (/var/run/mib2d-11)

     

    Looks like a possible bug.

     

    Jtac would be able to help you more on this.



  • 3.  RE: Use SNMP to figure out which port a MAC address is reachable on

    Posted 09-12-2011 13:10

    Hmmm:

     

    [root@sawmill ~]# arping -c 1 172.30.1.249

    ARPING 172.30.1.249 from 172.30.1.12 eth0

    Unicast reply from 172.30.1.249 [50:C5:8D:B1:CA:BF]

     0.763ms

    Sent 1 probes (1 broadcast(s))

    Received 1 response(s)

    [root@sawmill ~]# snmpwalk -c public -v 1 172.30.1.250 .1.3.6.1.2.1.4.22.1.2 | grep -i 50:C5:8D:B1:CA:BF

    [root@sawmill ~]#

     

    I'm going to speculate that this table has something to do with the IP space in the management brain,  not the switching brain from the switch.

     

    I'll contact the JTAC.



  • 4.  RE: Use SNMP to figure out which port a MAC address is reachable on

    Posted 09-13-2011 17:41

    And after working with JTAC, the answer is: the snmp and mib-process processes needed to be restarted on my switch.  Once done, I can query the Q-Bridge-MIB tables that I want to.

     

    There is currently no explanation as to why these processes required restarting.  Running the snmp tracer showed that the walk request for the OID was being received, but it was dying due to an internal error:

     

    Sep 13 17:33:36 snmpd[1dcae63f]  <<<  Error:       status=2 / vb_index=1

     

    To restart the required processes in edit mode:

     

    > run restart snmp

    > run restart mib-process

     

    ...and I'm working.

     

     

     



  • 5.  RE: Use SNMP to figure out which port a MAC address is reachable on

    Posted 02-28-2013 12:28

    Sorry to wake up an old thread but could you tell me what OID you were using? I've tried several of the examples on JTAC and other threads and can not seem to find a good solution to pulling the ethernet-switching table from some Juniper EX4200's I have SNMP access only on.

     

    Thanks,

    Brian

     



  • 6.  RE: Use SNMP to figure out which port a MAC address is reachable on

    Posted 04-11-2014 07:11

    First walk your interface description (IF-MIB::ifDescr or .1.3.6.1.2.1.2.2.1.2). Example output:

     

    IF-MIB::ifDescr.4 = STRING: lsi
    IF-MIB::ifDescr.5 = STRING: dsc
    IF-MIB::ifDescr.6 = STRING: lo0
    IF-MIB::ifDescr.7 = STRING: tap
    IF-MIB::ifDescr.8 = STRING: gre
    IF-MIB::ifDescr.9 = STRING: ipip
    IF-MIB::ifDescr.10 = STRING: pime
    IF-MIB::ifDescr.11 = STRING: pimd
    IF-MIB::ifDescr.12 = STRING: mtun
    IF-MIB::ifDescr.21 = STRING: lo0.16384
    IF-MIB::ifDescr.33 = STRING: me0
    IF-MIB::ifDescr.34 = STRING: me0.0
    IF-MIB::ifDescr.35 = STRING: vme
    IF-MIB::ifDescr.36 = STRING: vme.0
    IF-MIB::ifDescr.37 = STRING: bme0
    IF-MIB::ifDescr.38 = STRING: bme0.32768
    IF-MIB::ifDescr.49 = STRING: vcp-0
    IF-MIB::ifDescr.50 = STRING: vcp-0.32768
    IF-MIB::ifDescr.51 = STRING: vcp-1
    IF-MIB::ifDescr.52 = STRING: vcp-1.32768
    IF-MIB::ifDescr.501 = STRING: vlan
    IF-MIB::ifDescr.502 = STRING: vlan.0
    IF-MIB::ifDescr.503 = STRING: ge-0/0/0
    IF-MIB::ifDescr.504 = STRING: ge-0/0/0.0
    IF-MIB::ifDescr.505 = STRING: ge-0/0/1
    IF-MIB::ifDescr.506 = STRING: ge-0/0/2
    IF-MIB::ifDescr.507 = STRING: ge-0/0/1.0
    IF-MIB::ifDescr.508 = STRING: ge-0/0/2.0
    IF-MIB::ifDescr.509 = STRING: ge-0/0/3
    IF-MIB::ifDescr.510 = STRING: ge-0/0/4
    IF-MIB::ifDescr.511 = STRING: ge-0/0/5
    IF-MIB::ifDescr.512 = STRING: ge-0/0/6
    IF-MIB::ifDescr.513 = STRING: ge-0/0/3.0
    IF-MIB::ifDescr.514 = STRING: ge-0/0/4.0
    IF-MIB::ifDescr.515 = STRING: ge-0/0/5.0
    IF-MIB::ifDescr.516 = STRING: ge-0/0/6.0
    IF-MIB::ifDescr.517 = STRING: ge-0/0/7
    IF-MIB::ifDescr.518 = STRING: ge-0/0/8
    IF-MIB::ifDescr.519 = STRING: ge-0/0/7.0
    IF-MIB::ifDescr.520 = STRING: ge-0/0/8.0
    IF-MIB::ifDescr.521 = STRING: ge-0/0/9
    IF-MIB::ifDescr.522 = STRING: ge-0/0/9.0
    IF-MIB::ifDescr.523 = STRING: ge-0/0/10
    IF-MIB::ifDescr.524 = STRING: ge-0/0/10.0
    IF-MIB::ifDescr.525 = STRING: ge-0/0/11
    IF-MIB::ifDescr.526 = STRING: ge-0/0/11.0
    IF-MIB::ifDescr.527 = STRING: ge-0/0/12
    IF-MIB::ifDescr.528 = STRING: ge-0/0/12.0
    IF-MIB::ifDescr.529 = STRING: ge-0/0/13
    IF-MIB::ifDescr.530 = STRING: ge-0/0/13.0
    IF-MIB::ifDescr.531 = STRING: ge-0/0/14
    IF-MIB::ifDescr.532 = STRING: ge-0/0/14.0
    IF-MIB::ifDescr.533 = STRING: ge-0/0/15
    IF-MIB::ifDescr.534 = STRING: ge-0/0/15.0
    IF-MIB::ifDescr.535 = STRING: ge-0/0/16
    IF-MIB::ifDescr.536 = STRING: ge-0/0/16.0
    IF-MIB::ifDescr.537 = STRING: ge-0/0/17
    IF-MIB::ifDescr.538 = STRING: ge-0/0/18
    IF-MIB::ifDescr.539 = STRING: ge-0/0/19
    IF-MIB::ifDescr.540 = STRING: ge-0/0/17.0
    IF-MIB::ifDescr.541 = STRING: ge-0/0/18.0
    IF-MIB::ifDescr.542 = STRING: ge-0/0/19.0
    IF-MIB::ifDescr.543 = STRING: ge-0/0/20
    IF-MIB::ifDescr.544 = STRING: ge-0/0/21
    IF-MIB::ifDescr.545 = STRING: ge-0/0/22
    IF-MIB::ifDescr.546 = STRING: ge-0/0/23
    IF-MIB::ifDescr.547 = STRING: ge-0/0/20.0
    IF-MIB::ifDescr.548 = STRING: ge-0/0/21.0
    IF-MIB::ifDescr.549 = STRING: ge-0/0/22.0
    IF-MIB::ifDescr.550 = STRING: ge-0/0/23.0
    IF-MIB::ifDescr.551 = STRING: ae0
    IF-MIB::ifDescr.552 = STRING: ae0.0
    IF-MIB::ifDescr.553 = STRING: vlan.1
    IF-MIB::ifDescr.554 = STRING: vlan.2

     

    The number after "IF-MIB::ifDescr" is the SNMP interface ID. For example, ge-0/0/11.0 uses 526:

     

    IF-MIB::ifDescr.526 = STRING: ge-0/0/11.0

     

    Next walk BRIDGE-MIB::dot1dTpFdbAddress (.1.3.6.1.2.1.17.4.3.1.1) to get a mapping of SNMP MAC address ID's to MAC addresses. Example output:

     

    .1.3.6.1.2.1.17.4.3.1.1.0.12.41.28.146.212 = STRING: 0:c:29:1c:92:d4
    .1.3.6.1.2.1.17.4.3.1.1.0.12.41.40.75.26 = STRING: 0:c:29:28:4b:1a
    .1.3.6.1.2.1.17.4.3.1.1.0.12.41.40.75.36 = STRING: 0:c:29:28:4b:24
    .1.3.6.1.2.1.17.4.3.1.1.0.12.41.65.17.3 = STRING: 0:c:29:41:11:3
    .1.3.6.1.2.1.17.4.3.1.1.0.12.41.179.240.62 = STRING: 0:c:29:b3:f0:3e
    .1.3.6.1.2.1.17.4.3.1.1.0.14.64.168.132.64 = STRING: 0:e:40:a8:84:40
    .1.3.6.1.2.1.17.4.3.1.1.0.23.242.1.188.223 = STRING: 0:17:f2:1:bc:df
    .1.3.6.1.2.1.17.4.3.1.1.0.25.226.85.60.65 = STRING: 0:19:e2:55:3c:41
    .1.3.6.1.2.1.17.4.3.1.1.0.31.243.199.33.204 = STRING: 0:1f:f3:c7:21:cc
    .1.3.6.1.2.1.17.4.3.1.1.0.37.179.131.137.200 = STRING: 0:25:b3:83:89:c8
    .1.3.6.1.2.1.17.4.3.1.1.0.80.86.150.64.21 = STRING: 0:50:56:96:40:15
    .1.3.6.1.2.1.17.4.3.1.1.0.80.86.150.146.53 = STRING: 0:50:56:96:92:35
    .1.3.6.1.2.1.17.4.3.1.1.0.80.86.150.150.203 = STRING: 0:50:56:96:96:cb
    .1.3.6.1.2.1.17.4.3.1.1.8.234.68.8.193.128 = STRING: 8:ea:44:8:c1:80
    .1.3.6.1.2.1.17.4.3.1.1.8.234.68.121.40.64 = STRING: 8:ea:44:79:28:40
    .1.3.6.1.2.1.17.4.3.1.1.120.202.57.180.159.46 = STRING: 78:ca:39:b4:9f:2e
    .1.3.6.1.2.1.17.4.3.1.1.212.202.109.109.106.202 = STRING: d4:ca:6d:6d:6a:ca
    .1.3.6.1.2.1.17.4.3.1.1.212.202.109.151.23.54 = STRING: d4:ca:6d:97:17:36

     The number after the OID is the MAC address ID. For example, the ID for 08:EA:44:08:C1:80 is 8.234.68.8.193.128:

     

    .1.3.6.1.2.1.17.4.3.1.1.8.234.68.8.193.128 = STRING: 8:ea:44:8:c1:80

    Next walk BRIDGE-MIB::dot1dTpFdbPort (.1.3.6.1.2.1.17.4.3.1.2) to get a mapping of SNMP interface ID's to MAC address ID's. Example output:

     

    .1.3.6.1.2.1.17.4.3.1.2.0.12.41.29.65.93 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.12.41.40.75.26 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.12.41.40.75.36 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.12.41.65.17.3 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.12.41.179.240.62 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.14.64.168.132.64 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.23.242.1.188.223 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.25.226.85.60.65 = INTEGER: 0
    .1.3.6.1.2.1.17.4.3.1.2.0.31.243.199.33.204 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.37.179.131.137.200 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.80.86.150.64.21 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.80.86.150.146.53 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.0.80.86.150.150.203 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.8.234.68.8.193.128 = INTEGER: 526
    .1.3.6.1.2.1.17.4.3.1.2.8.234.68.121.40.64 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.120.202.57.180.159.46 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.212.202.109.109.106.202 = INTEGER: 1
    .1.3.6.1.2.1.17.4.3.1.2.212.202.109.151.23.54 = INTEGER: 1

     The number after the OID maps to the MAC address ID you previously grabbed. The integer value maps to the interface ID. For example, ID 8.234.68.8.193.128 (Representing a MAC address) maps to integer 526 (Representing an interface).

     

    .1.3.6.1.2.1.17.4.3.1.2.8.234.68.8.193.128 = INTEGER: 526

     

    Putting it all together...

     

    From FdbAddress, 08:EA:44:08:C1:80 maps to SNMP ID 8.234.68.8.193.128.

    From FdbPort, SNMP ID 8.234.68.8.193.128 maps to interface ID 526.

    From ifDescr, interface ID 526 maps to ge-0/0/11.0.

     

    08:EA:44:08:C1:80 -> 8.234.68.8.193.128 -> 526 -> ge-0/0/11.0

     

    This method is used by multiple vendors (Cisco, Avaya, Netgear, 3COM, etc).



  • 7.  RE: Use SNMP to figure out which port a MAC address is reachable on

    Posted 06-01-2015 02:42

    Another way;

     

    Step by step procedure;

     

    1) Get INTEGER value of mac address;

     

    snmpwalk -O0sUX -v2c -Cc -c netpublic 10.50.2.223 BRIDGE-MIB::dot1dTpFdbPort

    dot1dTpFdbPort[STRING: 90:1b:0e:1e:dd:fb] = INTEGER: 557

     

    2) Get port index of this integer;

     

    snmpwalk -O0sUX -v2c -Cc -c netpublic 10.50.2.223 BRIDGE-MIB::dot1dBasePortIfIndex | grep 557
    dot1dBasePortIfIndex[557] = INTEGER: 594

     

    3) Get physical port number from ifDescr

    snmpwalk -O0sUX -v2c -Cc -c netpublic 10.50.2.223 ifDescr | grep 594
    ifDescr[594] = STRING: ge-0/0/44.0