Getting MAC addresses using SNMP on EX2300/EX3400

In this post we are going to see how you can extract the content of the MAC address table using SNMP on EX2300 or EX3400.

This is different than some other switching platforms like EX4200, EX4500, EX8200.

To accomplish this, different Juniper enterprise MIBs must be used.

Let us see how we can achieve this.



This is the content of the ethernet switching table:


root@EX2300# run show ethernet-switching table

MAC flags (S - static MAC, D - dynamic MAC, L - locally learned, P - Persistent static, C - Control MAC
           SE - statistics enabled, NM - non configured MAC, R - remote PE MAC, O - ovsdb MAC)

Ethernet switching table : 3 entries, 3 learned
Routing instance : default-switch
    Vlan                MAC                 MAC         Age    Logical                NH        RTR
    name                address             flags              interface              Index     ID
    cairo               00:26:88:6c:ea:01   D             -    ge-0/0/2.0             0         0
    beijing             00:26:88:6c:ea:03   D             -    ge-0/0/0.0             0         0
    beijing             00:26:88:6c:ea:04   D             -    ge-0/0/1.0             0         0


And we are looking to get the MAC addresses from VLAN beijing:


root@EX2300# run show vlans beijing extensive

Routing instance: default-switch
  VLAN Name: beijing                        State: Active
Tag: 100
Internal index: 54, Generation Index: 54, Origin: Static
MAC aging time: 300 seconds
Layer 3 interface: irb.100
VXLAN Enabled : No
Number of interfaces: Tagged 0    , Untagged 2
Total MAC count: 2



It is important to record the “Internal Index”, 54 in this case.

You can use jnxL2aldVlanTable MIB to get the VLAN names and their characteristcs:


root@EX2300# run show snmp mib walk jnxL2aldVlanTable
jnxL2aldVlanName.53 = default
jnxL2aldVlanName.54 = beijing
jnxL2aldVlanName.55 = cairo
jnxL2aldVlanTag.53 = 1
jnxL2aldVlanTag.54 = 100
jnxL2aldVlanTag.55 = 200
jnxL2aldVlanType.53 = 1
jnxL2aldVlanType.54 = 1
jnxL2aldVlanType.55 = 1
jnxL2aldVlanFdbId.53 = 3473408
jnxL2aldVlanFdbId.54 = 3538944
jnxL2aldVlanFdbId.55 = 3604480



You need to get the Filtering Database for index 54 which can be taken from the above output or using the next command:


root@EX2300# run show snmp mib walk jnxL2aldVlanFdbId
jnxL2aldVlanFdbId.53 = 3473408
jnxL2aldVlanFdbId.54 = 3538944
jnxL2aldVlanFdbId.55 = 3604480



Then get the MAC addresses for the Filtering Database:


root@EX2300# run show snmp mib walk dot1qTpFdbPort.3538944
dot1qTpFdbPort.3538944. = 4096
dot1qTpFdbPort.3538944. = 4097

root@EX2300# is 00:26:88:6c:ea:03 and is 00:26:88:6c:ea:04

Next we need the interface index for 4096 and 4097:


root@EX2300# run show snmp mib walk dot1dBasePortIfIndex | match "4096|4097"
dot1dBasePortIfIndex.4096 = 513
dot1dBasePortIfIndex.4097 = 514



And these two interfaces are:


root@EX2300# run show snmp mib walk ifDescr | grep "513|514"
ifDescr.513   = ge-0/0/0
ifDescr.514   = ge-0/0/1



And this would be all on how to get the MAC addresses using SNMP.

I hope you found this interesting.


The following two tabs change content below.

Paris ARAU

Paris ARAU is a networking professional with strong background on routing and switching technologies. He is a holder of CCIE R&S and dual JNCIE(SP and ENT). The day to day work allows him to dive deeply in networking technologies. Part of the continuously training, he is focusing on Software Defined Network and cloud computing.


This post currently has 2 responses

Leave a Reply

Your email address will not be published. Required fields are marked *


%d bloggers like this: