One very convenient and powerful tool for querying device interfaces and routers is the snmpnetstat command. When you run this command it will return information on any SNMP MIB-II compliant device that it can see, including, among others: workstations, servers, printers, routers, and other devices. It's a relatively simple command, and since the command is vendor neutral, it returns information from all of these systems in an identical...
The snmpnetstat command has several options, including: -a, display socket connections, -i, display all interfaces; -I, display a particular network interface; -o, display summary of interfaces; -n display network address in numeric form; -p, display statistics sorted by networking protocols; -r, show routing tables; and –s, show the by protocol network statistics. Just which of these switches your version of Unix supports can be determined from the man pages with the command man snmpnetstat.
As an example, to obtain the network interfaces on a particular server, you would issue the command # snmpnetstat –i servername public. The returned output will give you: the protocol name, Mtu, network address (for 192.168.1.25 this would be simply 192.168.1), the server address (192.168.1.25), Ipkts, Ierrs, Opkts, Oerrs, and Queue – measures of input and output throughput and errors. This version of the command looks similar to the netstat command, but gives you the interface data you needed.
To get routing data from a Cisco router, you would use the command #snmpnetstat –r cisco-kai3 public. What comes back is a four column display of the routing table destinations, their gateways, flags, and their interface type.
As a final example, you might want to use # snmpnetstat –s servername public to see server statistics. You get back a listing of each protocol used, the input and output; and depending upon the specific protocol errors, discards, requests and deliveries, and so forth. This very useful form of the snmpnetstat command can be used to diagnose server network performance, and give you an idea of what traffic to monitor in order to correct the problems you see.
Barrie Sosinsky is president of consulting company Sosinsky and Associates (Medfield MA). He has written extensively on a variety of computer topics. His company specializes in custom software (database and Web related), training and technical documentation.