snmptest
If you need to query a device that supports the
Simple Network Management Protocol (SNMP), you can do
so from a command line interface, i.e, a shell prompt, on a Mac OS X or
Linux system using the
snmptest tool. To use the utility, issue the snmptest command specifying
the "community string", which is somewhat equivalent to a password, with
the
-c
option, specify the version of SNMP with the
-v
option and then specify the IP address or
fully qualified domain name (FQDN). You will get
a "Variable:" prompt when you run the command. You can specify an
object identifider (OID) that you wish to query at that prompt. If
you hit
Enter the prompt will be repeated. When you've finished
entering variables you wish to query, hit
Enter at the next
"Variable" prompt without entering any variable. You should then see
the results returned as shown below. You can hit
Ctrl-C to terminate
the program.
# snmptest -c SomeSecret0123 -v 1 192.168.0.11
Variable: system.sysLocation.0
Variable: system.sysContact.0
Variable:
Received Get Response from UDP: [192.168.0.11]:161->[0.0.0.0]:41231
requestid 0xAF07FC2 errstat 0x0 errindex 0x0
SNMPv2-MIB::sysLocation.0 = STRING: London
SNMPv2-MIB::sysContact.0 = STRING: John Doe
Variable: ^C
#
[ More Info ]
[/network/snmp]
permanent link
Installing SNMP Under Windows XP
To install Simple Network Protocol Management (SNMP) support on a Windows
XP system, you can follow
these steps.
[/network/snmp]
permanent link
Get ARP Table
I needed to be able to get the ARP table from Cisco devices, so I
created
get_arp, a
Perl script which will query a router, switch, etc. via
SNMP
and obtain the ARP table from the device. There are two mandatory arguments for
the script, the hostname or IP address for the device and the read-only
community string for the device. If given only those two arguments, the
script will produce output similar to what is shown below:
% ./get_arp 192.168.220.76 tViSoN1a
ARP table for 192.168.220.76 on Wed Feb 1 22:21:38 2006
192.168.220.65 = 0:30:f2:ec:17:fc
192.168.220.66 = 0:30:f2:ec:8b:fc
192.168.220.67 = 0:30:f2:ec:17:ff
192.168.220.68 = 0:30:f2:ec:8b:ff
192.168.220.69 = 0:90:b1:81:e9:0
192.168.220.70 = 0:60:3e:7e:c7:40
192.168.220.75 = 0:9:b7:7d:e6:0
192.168.220.76 = 0:60:3e:7e:1e:a0
192.168.220.77 = 0:f:f7:5b:b:0
192.168.220.78 = 0:f:f7:5d:64:f0
An optional argument "--nomac" will cause the script to only display
the IP addresses in the ARP table, not the
MAC addresses associated
with the IP addresses as shown below:
% ./get_arp --nomac 192.168.220.76 tViSoN1a
ARP table for 192.168.220.76 on Wed Feb 1 22:21:49 2006
192.168.220.65
192.168.220.66
192.168.220.67
192.168.220.68
192.168.220.69
192.168.220.70
192.168.220.75
192.168.220.76
192.168.220.77
192.168.220.78
To use the script,
download the
script and use chmod 744
to make the script executable by
the owner. Modify the first line, if Perl is located somewhere else
on your system, which you can determine by the command which perl
.
The script relies on the snmpwalk utility, which is available from
http://www.net-snmp.org/. You
can determine if it is available on your system already by issuing the
command which snmpwalk
.
[/network/snmp]
permanent link