VLAN to port mapping using SNMP on Juniper EX
This post is about SNMP and it will show you how you can retrieve all the ports that are part of a VLAN and how you can retrieve the vlan membership of a port on a Juniper EX switch.
Before doing this, let’s see what the cli output is and we will compare it with the snmp walk output.
The test will involve VLANs v2220, v2221 and interface ge-0/0/3:
{master:0} lab@EX4200> show vlans Name Tag Interfaces default None v2220 2220 ge-0/0/3.0* v2221 2221 ge-0/0/3.0* {master:0} lab@EX4200>
1. To retrieve all ports under a VLAN, follow this procedure:
{master:0} lab@EX4200> show snmp mib walk jnxExVlanName jnxExVlanName.3 = default jnxExVlanName.4 = v2220 ----------> index 4 jnxExVlanName.5 = v2221
{master:0} lab@EX4200> show snmp mib walk jnxExVlanPortStatus.4 jnxExVlanPortStatus.4.516 = 3
{master:0} lab@EX4200> show snmp mib get dot1dBasePortIfIndex.516 dot1dBasePortIfIndex.516 = 626
{master:0} lab@EX4200> show snmp mib get ifDescr.626 ifDescr.626 = ge-0/0/3.0
{master:0}
lab@EX4200>
2. To retrieve the VLAN membership of a port, follow this procedure:
{master:0} lab@EX4200> show snmp mib walk ifDescr | match ge-0/0/3.0 ifDescr.626 = ge-0/0/3.0
{master:0} lab@EX4200> show snmp mib walk dot1dBasePortIfIndex | match 626 dot1dBasePortIfIndex.516 = 626
{master:0} lab@EX4200> show snmp mib walk jnxExVlanPortStatus | match 516 jnxExVlanPortStatus.4.516 = 3 ----------> index 4 jnxExVlanPortStatus.5.516 = 3 ----------> index 5
{master:0} lab@EX4200> show snmp mib get jnxExVlanName.4 jnxExVlanName.4 = v2220
{master:0} lab@EX4200> show snmp mib get jnxExVlanName.5 jnxExVlanName.5 = v2221
{master:0}
lab@EX4200>
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.
Latest posts by Paris ARAU (see all)
- Junos Fusion – Part IV – Satellite policies and uplink failure detection - 30 July 2018
- Junos Fusion – Part III – Satellite commands and traffic forwarding - 16 July 2018
- Junos Fusion – Part II – Configuration, Administration and Operation - 16 July 2018
- Junos Fusion – Part I – Overview, Components, Ports and Software - 11 July 2018
- Vagrant – Part IV – Network topology using Juniper and Cumulus - 26 April 2018

Comments
So empty here ... leave a comment!