Anyone can login to a system and run ifconfig or netstat or other similar commands to find the network information of a system. But what will be even better? Do it remotely without logging in to each and every system. How? Using snmpwalk one can retrieve all this information provided that subject has both snmpd running, snmpd supporting network information and the querying host is allowed to make SNMP queries. Lets see how.
Interface table is covered by basic SNMP (just like system information, udp, tcp socket information, address translation and snmp stats etc). Here is how to query the interface table to get the IP address and Subnet mask information.
unixite@sanbox:~/ > snmpwalk -v1 -c public sandboxS:161 18.104.22.168.22.214.171.124.1.1
iso.126.96.36.199.188.8.131.52.184.108.40.206.4 = IpAddress: 220.127.116.11
iso.18.104.22.168.22.214.171.124.126.96.36.199.1 = IpAddress: 127.0.0.1
iso.188.8.131.52.184.108.40.206.220.127.116.11.10 = IpAddress: 192.168.1.10
iso.18.104.22.168.22.214.171.124.126.96.36.199.2 = IpAddress: 10.0.0.2
unixite@sanbox:~/ > snmpwalk -v1 -c public sandboxS:161 188.8.131.52.184.108.40.206.1.3
iso.220.127.116.11.18.104.22.168.22.214.171.124.4 = IpAddress: 255.0.0.0
iso.126.96.36.199.188.8.131.52.184.108.40.206.1 = IpAddress: 255.0.0.0
iso.220.127.116.11.18.104.22.168.22.214.171.124.10 = IpAddress: 255.255.255.0
iso.126.96.36.199.188.8.131.52.184.108.40.206.2 = IpAddress: 255.255.0.0
First one here retrieves the IP addresses on the system while second one get the subnet masks. -c public has to be changed to right community string and also the version if your supports a different one. My system name here is sandboxS and snmpd is listening on default port 161. If not then you can change the port to match yours.