Querying information from a network device requires the device to have a management interface in the first place. This means that an unmanaged device cannot be queried at all.
There are 3 management interfaces: command line, GUI and SNMP. If the device has a serial interface, one can connect a computer directly to that to access the CLI. On remote devices CLI is accessed with SSH or telnet; latter being strongly discouraged for security reasons. GUI interfaces are browser-based.
Which interfaces are available for a device is (or at least should be) found in the device specifications. Soho routers generally have only a GUI, but CLI may be available for some devices. SNMP is extremely rare.
A network device is just a computer designed to perform very specific tasks. Like any computers, they have operating systems designed by the manufacturer. Cisco IOS, ArubaOS, ExtremeXOS, Juniper OS etc. differ in the same way as any other computer OS:s. Cisco IOS doesn't recognize ArubaOS commands.
SNMP is the protocol every network management application uses to manage devices. There are 3 more or less incompatible versions - for example a switch having only SNMPv1 interface cannot be queried with SNMPv2c at all.
To manage the devices SNMP uses Object Identifiers (OID). These have a standardized structure, beginning with the string 1.3.6.1.4.1. This is read:
1 iso - ISO is the name of the group that launched the OID standard
.3 org - Organization specified next to this figure
.6 dod - The US Department of Defense
.1 internet - Determines that communication will be through the internet
.4 private - States that the device is manufactured by a private company
.1 enterprise - States that the manufacturer is an enterprise
Next element in the string is the Private Enterprise Number (PEN) which identifies the manufacturer. These are assigned by IANA. For example for Cisco devices the string begins 1.3.6.1.4.1.9
, for HP devices it's 1.3.6.1.4.1.11
, for Intel devices 1.3.6.1.4.1.343
and so on.
There are a few command line SNMP implementations. Net-SNMP and OpenSNMP are pretty much industry standards. Using them has a few hurdles beyond the protocol version:
- How to implement SNMP in a device is entirely on the discretion of
the manufacturer. An object present on ACME GreatSwitch 2000 may not
be implemented in ACME GS 1000; an object present on ACME GS 2000
running ACMEOS 42 may not be available in ACMEOS 41 or 43.
- While there are some online repositories like OID Info and
OiDView, they aren't reliable. Updating them with available OIDs
and MIBs is entirely up to the discretion of the manufacturer.
Up-to-date info is only available from the manufacturers
... just to name two.
Due to aforementioned reasons it's simply impossible to have a simple command in the vein of query switch arp table
. Someone has created an SNMP cmdlet for PowerShell. However just like every other command line SNMP implementation it requires knowledge of available OIDs and how to utilize them.