0

Below are the following commands I used to get the specific data that I need in a juniper switch.

  • Get Port Id and Interface

    snmpwalk -r:"switchName" -v:2 -t:10 -c:"*******" -os:"1.3.6.1.2.1.2.2.1.2" -op:"1.3.6.1.2.1.2.2.1.3"

  • Get Vlan No and Vlan Name

    snmpwalk -r:"switchName" -v:2 -t:10 -c:"*******" -os:"1.3.6.1.4.1.2636.3.40.1.5.1.5.1.2" -op:"1.3.6.1.4.1.2636.3.40.1.5.1.5.1.3"

    snmpwalk -r:"switchName" -v:2 -t:10 -c:"*******" -os:"1.3.6.1.4.1.2636.3.40.1.5.1.5.1.5" -op:"1.3.6.1.4.1.2636.3.40.1.5.1.5.1.6"

  • Get MAC Address

    ??????????????????

  • Get Port Id and Vlan No / Interface And Vlan No

    ??????????????????

Do you guys know what command/oid will I used to get the following vlan no per interface and mac address? kindly verify also the other OID that I used.

Thank you in advance.

2

I've done some of this.

The OID you want is called the Q-Bridge-II MIB, at 1.3.6.1.2.1.17.7.1.2.2.1.2 -- it returns a list of MAC addresses associated with the logical port those MAC addresses are listed on.

Now you want to beware because there are a couple of wrinkles: firstly the MAC addresses are encoded as row specifications in the OIDs, the VALUES are the ifPort that that MAC address is reachable through. So you have to pull in the table and convert base-10 MACs to the base-16 MACs you are used to dealing with.

The second is that on a Juniper the interface the mac address is associated is almost always a sub-interface, and port labels/descriptions are usually associated with the physical interface, so there isn't a trivial way to read the ifLabel off of the port description based on the portID (and glossing over the whole converting ifPort-to-ifIndex) you get back from the Q-Bridge-II.

For example:

$ findmac --DEBUG -c MyPass sa4-39 00:07:e9:25:05:3c
[...]
DEBUG:00:07:e9:25:05:3c is on port 549
DEBUG:549 is ifIndex 591
DEBUG:ifIndex: [591]
DEBUG:ifName: [ge-0/0/36.0]
sa4-39: port 549(ge-0/0/36.0)

In this case the mac is associated with 0/0/36.0, while the label is associated with 0/0/36. This hoopage-jumpage is necessary because with simpler switches, the ifPort index is the same as the physical port index -- ifPort 1 is port 1 on the switch. This is not the case with Junipers.

My script checks for ifAliases (since on other things like Dells and HPs it will find them) but the Junipers don't have them in the right place.

You can, if you are suitably detailed-oriented, apply your port descriptions to the sub-interfaces instead of the interfaces, eg:

set interfaces ge-0/0/36 description "Description on the physical port"
set interfaces ge-0/0/36 unit 0 description "Description on the sub-interface"

Both are valid, but the GUI only does the first one; similarly the GUI only displays the value from the first one. If you do the second one, it makes reading the ifAlias much more straight forward, however I have not done this globally.

Anyways, there's one of your OIDs.

-1
show interfaces extensive will give you just about everything.

Show vlan also is valid and helpful.

  • I need the data to be retrieve/get via snmpwalk. do you know what is the equivalent command/oid for that? thank you – xen Feb 2 '15 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.