cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1428
Views
0
Helpful
4
Replies

SNMPWalk question

davidjknapp
Level 1
Level 1

I have been fighing with developing a good way to determine if a loopback0 exists on a router using snmp.  Using snmpwalk seems to always give me a million lines of code while snmpget never responce with anything.  Sorry for the newb quesiton but I am really lost here.

Basically I need to hit 250 routers (2800's) to check for "loopback0", I also need to know what ip is on that interface and my end result will need to be:

"<router(ip or host)>,<Lo0 ip address>,<Lo0 subnet)" for later parsing. 

Anyone have a quick command referance I could use with the snmp-get win32 tools to produce this?  As an fyi, I have been using OID because I cant even seem to find a way to use MIBs with the windows version - nor what mib set to use very clear.

4 Replies 4

AFROJ AHMAD
Cisco Employee
Cisco Employee

Hi,

ObjectipAddrEntry
OID1.3.6.1.2.1.4.20.1

This is the ONLY oid ,close to what you need .

Do the SNMP WALK on this OID ,this will give you these outputs:

   ipAdEntAddr (1)

     ipAdEntIfIndex (2)

     ipAdEntNetMask (3)

      ipAdEntBcastAddr (4)

        ipAdEntReasmMaxSize (5)

Thanks-

Afroz

[Do rate the useful post]

Thanks- Afroz [Do rate the useful post] ****Ratings Encourages Contributors ****

When I run it I get everything.  This is the line I am running - thoughts?

snmpwalk -r: -c"" -v:2c -op:1.3.6.1.2.1.4.20.1>file.txt

In that file I can see the interface discriptions are listed, and some IP addresses are listed, but none in the file are the ip of the loopback0. 

Resolved - used commands below then used a vbs script to parse the data:

"Grab All Interface Desc"

snmpwalk -r: -c:"" -v:2c -os:1.3.6.1.2.1.4.20.1.1 -op:1.3.6.1.2.1.4.20.1.5>>file.txt

"Grab All IP's"

snmpwalk -r: -c:"" -v:2c -os:1.3.6.1.2.1.2.2.1.2.1 -op:.1.3.6.1.2.1.2.2.1.2.50>>file.txt

I have met similar problem and finally I decided to write a script that prepares a list of all IP interfaces of our routers. I add the list to host file so my traceroute shows hostnames and its interface names.

The script can be used for your purpose - just search lines with "Lo0". This filtering does not directly show routers with missing Loopback0 - you can e.g. compare list of Lo0 routers with list of all router etc.

http://network-linux.webnode.cz/news/bash-script-for-gathering-ip-addresses-of-interfaces-through-snmp/

Example of the result file

A.B.C.D Device_hostname-Interface_name #/Prefix #Interface description
10.1.1.1 router_R01-Gi1/0/2 #28  
10.5.1.22 Beijing-router01-WAN-Tu611 #24 # Port to internet
192.168.24.254 firewall2-eth5 #24

Review Cisco Networking for a $25 gift card