Is anyone familiar with an approach to generate a list of subnets on a particular switch (let's pick a more popular one – Cisco) using SNMP? How about a list of VLANs? If so, can you point me to the MIBs / OIDs involved? (network newbie here)
Generate List of Subnets on Switch Using SNMP
ciscosnmpsubnetswitch
Related Topic
- Cisco SG300-52 SNMP ifInOctets Values Unreasonable
- Cisco IOS – Distinguishing Router Reload from sysUpTime SNMP Counter Wrap
- Routing – Secure connect & access across 2 separate LAN Subnets using PFSense/ Sophos
- Cisco Catalyst Security – Cisco Catalyst 2960 X MAC Access List
- Cisco Commands – Listing Interface Names and MAC Addresses on Cisco Device
- Cisco iOS SNMP OID for Vlan on Port
Best Answer
Interfaces/IP Addressing:
If you're looking to poll a device's IP address, subnet mask and corresponding interface you can use the following OIDs from the IP-MIB and IF-MIB MIBs:
.1.3.6.1.2.1.4.20.1.1
- The IP address can be found at this OID.1.3.6.1.2.1.4.20.1.3
- The subnet mask cane be found at this OID.1.3.6.1.2.1.4.20.1.2
- The interface index (ifTable Indexes) are unique integers for each interface..1.3.6.1.2.1.2.2.1.2
- The interface friendly name can be found at this OID and the ifTable index is appended (eg....2.1.2.[INDEX]
) for each interface.You can walk these OIDs manually, script something out in the language of your choice, or use much smarter programs/scripts similar to what's mentioned in Tim Peck's answer.
Here's a quick (and dirty) shell example:
Example:
VLANs:
If you're looking for the VLAN IDs and VLAN names you can use the following OID:
.1.3.6.1.4.1.9.9.46.1.3.1.1.4.1
The vtpVlanName can be found (on Cisco devices) at this OID and the VLAN-ID can be found appended, e.g.:...1.4.1.[VLAN-ID]
(similar to the ifIndex and ifDescr example above).Manual example of scraping the VLAN IDs: