Search My Techie Guy

Showing posts with label snmpwalk. Show all posts
Showing posts with label snmpwalk. Show all posts

Wednesday, March 2, 2016

SNMPWALK - Juniper Switch Over Routing Instances - Discover All Interfaces Using Default Routing Instance

Summary: 

Configuring SNMP for a Juniper switch with routing-instances

Problem or Goal:
To be able to access all SNMP information on a switch that has routing instances configured

Cause: 
When i run an SNMP walk in a specific routing instance, am not able to gather all SNMP information for that switch. For example i was only able to discover interfaces within that specific routing instance that i was polling. i was not able to discover interfaces in other routing instance!

Solution:

First refer to my previous post

From the above link i was only successful with discovering the interfaces in that routing instance. the challenge is to be able to discover all interfaces:

Before, you need to take note of how to enable SNMP access to over routing instances
The quick solution is change the snmp credentials in your SNMP client to query using the default routing instance.

For example: 

snmpwalk -v2c -c default@public 10.0.1.170

Problem Solved?

Yes, using the default routing instance, am able to discover all snmp information on the switch. 

Cheers : -) 

Wednesday, February 10, 2016

Timeout: No Response from - Trying to SNMPWALK a Juniper Router/Switch with Routing-Instances Configured

Problem:

I was trying to snmpwalk a juniper switch (EX4500) that has routing instance configured!
The SNMP client was only reachable from a specific routing instance on the switch. However, i could successfully ping the switch OAM IP from the snmp client.

For example:

Ping from the snmp client is OK:

SNMP CLIENT:~ # ping 10.0.1.170
PING 10.0.1.170 (10.0.1.170) 56(84) bytes of data.
64 bytes from 10.0.1.170: icmp_seq=1 ttl=63 time=1.13 ms
64 bytes from 10.0.1.170: icmp_seq=2 ttl=63 time=1.12 ms
64 bytes from 10.0.1.170: icmp_seq=3 ttl=63 time=1.43 ms


Ping from the switch in the Global routing instance is NOT OK:

> ping 10.0.43.18                                                     
PING 10.0.43.18 (10.0.43.18): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host


Ping from the switch in VR-OAM routing instance is OK:

> ping routing-instance VR-OAM 10.0.43.18                             
PING 10.0.43.18 (10.0.43.18): 56 data bytes
64 bytes from 10.0.43.18: icmp_seq=0 ttl=63 time=1.235 ms
64 bytes from 10.0.43.18: icmp_seq=1 ttl=63 time=1.504 ms
64 bytes from 10.0.43.18: icmp_seq=2 ttl=63 time=1.878 ms
64 bytes from 10.0.43.18: icmp_seq=3 ttl=63 time=1.215 ms


And whenever i would run snmpwalk from my snmp server, i would get the message below:

SNMP CLIENT:~ # snmpwalk -v2c -c public 10.0.1.170
Timeout: No Response from 10.0.1.170

Solution:

In order to access MIB objects and perform SNMP operations for the routing-instances, SNMP v1 and v2c clients need to encode the routing-instance name in the community string in their SNMP requests. 


snmpwalk -v2c -c routing-instance-name@public x.x.x.x

Example:

SNMP CLIENT:~ # snmpwalk -v2c -c VR-OAM@public 10.0.1.170

SNMPv2-MIB::sysDescr.0 = STRING: afrsite1epcrtr01_switch
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.2636.1.1.1.2.44
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (644286429) 74 days, 13:41:04.29
SNMPv2-MIB::sysContact.0 = STRING: 
SNMPv2-MIB::sysName.0 = STRING: VR-OAM@EPC_RTR01
SNMPv2-MIB::sysLocation.0 = STRING: 
SNMPv2-MIB::sysServices.0 = INTEGER: 6
IF-MIB::ifNumber.0 = INTEGER: 272
IF-MIB::ifIndex.6 = INTEGER: 6

Problem Solved :-) 


snmpwalk: Timeout: No Response from 10.0.46.149

Problem:

Server1:~ # snmpwalk -v2c -c public 10.0.46.149
Timeout: No Response from 10.0.46.149


Server1:~ # ifconfig -a
ens160    Link encap:Ethernet  HWaddr 00:0C:29:D1:E6:46  
          inet addr:10.0.43.18  Bcast:10.0.43.63  Mask:255.255.255.192
          inet6 addr: fe80::20c:29ff:fed1:e646/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18983282 errors:0 dropped:1223 overruns:0 frame:0
          TX packets:67797 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1646195609 (1569.9 Mb)  TX bytes:5717429 (5.4 Mb)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:630856 errors:0 dropped:0 overruns:0 frame:0
          TX packets:630856 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:56145204 (53.5 Mb)  TX bytes:56145204 (53.5 Mb)

Solution:

Make sure the server IP where you are running the snmpwalk command from has been added as an snmp client and it's IP allowed on the router/switch that you are trying to query.

for my case am trying to query a juniper switch, so i added the line below:

# set snmp community public clients 10.0.43.18/32  
# commit 
configuration check succeeds
commit complete

Trying the snmpwalk command again: problem solved

Server1:~ # snmpwalk -v2c -c public 10.0.46.149
SNMPv2-MIB::sysDescr.0 = STRING: Vodafone UG Border Gateway Router 01
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.2636.1.1.1.2.43
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (3947453981) 456 days, 21:08:59.81
SNMPv2-MIB::sysContact.0 = STRING: Joshua Nomwesigwa 0723000208
SNMPv2-MIB::sysName.0 = STRING: VODAFONEUG-BGW-01
SNMPv2-MIB::sysLocation.0 = STRING: Kololo, 1 Hill Drive, Kampala
SNMPv2-MIB::sysServices.0 = INTEGER: 6

Bash: snmpwalk: command not found - Linux OpenSUSE 13.2

Problem:

Server1:~ # snmpwalk
-bash: snmpwalk: command not found

Solution:

Install net-snmp using zypper install

Server1:~ # zypper install net-snmp
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 6 NEW packages are going to be installed:
  libsensors4 libsnmp30 net-snmp perl-SNMP perl-Term-ReadKey snmp-mibs 

6 new packages to install.
Overall download size: 1.7 MiB. Already cached: 0 B  After the operation, additional 6.9 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package perl-Term-ReadKey-2.32-2.1.5.x86_64                                                                                                                      (1/6),  28.8 KiB ( 62.4 KiB unpacked)
Retrieving: perl-Term-ReadKey-2.32-2.1.5.x86_64.rpm ...........................................................................................................................................[done (5.8 KiB/s)]
Retrieving package libsensors4-3.3.5-3.3.1.x86_64                                                                                                                           (2/6),  51.4 KiB (100.7 KiB unpacked)
Retrieving: libsensors4-3.3.5-3.3.1.x86_64.rpm ............................................................................................................................................................[done]
Retrieving package snmp-mibs-5.7.3-3.1.x86_64                                                                                                                               (3/6), 245.9 KiB (  1.6 MiB unpacked)
Retrieving: snmp-mibs-5.7.3-3.1.x86_64.rpm ...................................................................................................................................................[done (96.0 KiB/s)]
Retrieving package libsnmp30-5.7.3-3.1.x86_64                                                                                                                               (4/6), 853.0 KiB (  3.4 MiB unpacked)
Retrieving: libsnmp30-5.7.3-3.1.x86_64.rpm ..................................................................................................................................................[done (657.1 KiB/s)]
Retrieving package perl-SNMP-5.7.3-3.1.x86_64                                                                                                                               (5/6), 124.5 KiB (424.4 KiB unpacked)
Retrieving: perl-SNMP-5.7.3-3.1.x86_64.rpm ................................................................................................................................................................[done]
Retrieving package net-snmp-5.7.3-3.1.x86_64                                                                                                                                (6/6), 435.2 KiB (  1.3 MiB unpacked)
Retrieving: net-snmp-5.7.3-3.1.x86_64.rpm ...................................................................................................................................................[done (343.3 KiB/s)]
Checking for file conflicts: ..............................................................................................................................................................................[done]
(1/6) Installing: perl-Term-ReadKey-2.32-2.1.5 ............................................................................................................................................................[done]
(2/6) Installing: libsensors4-3.3.5-3.3.1 .................................................................................................................................................................[done]
(3/6) Installing: snmp-mibs-5.7.3-3.1 .....................................................................................................................................................................[done]
(4/6) Installing: libsnmp30-5.7.3-3.1 .....................................................................................................................................................................[done]
(5/6) Installing: perl-SNMP-5.7.3-3.1 .....................................................................................................................................................................[done]
(6/6) Installing: net-snmp-5.7.3-3.1 ......................................................................................................................................................................[done]
Additional rpm output:
Updating /etc/sysconfig/net-snmp...

Server1:~ # snmpwalk
Created directory: /var/lib/net-snmp/mib_indexes
No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]

  Version:  5.7.3.pre5
  Web:      http://www.net-snmp.org/
  Email:    net-snmp-coders@lists.sourceforge.net

Monday, November 24, 2014

ld.so.1: snmpwalk: fatal: libgcc_s.so.1: open failed: No such file or directory Killed

I had just finished installing net-snmp on one of my old DNS server to help me monitor it remotely using cacti but i ran into this error while trying to test it using snmpwalk.

Problem:

# snmpwalk -V
ld.so.1: snmpwalk: fatal: libgcc_s.so.1: open failed: No such file or directory
Killed


Solution:

1. I ran a search to try and find this library, and yes libgcc was already installed on my server:

# find / -name libgcc*
/usr/local/lib/libgcc_s.so
/usr/local/lib/libgcc_s.so.1

2. So i checked my library PATH, and the path to libgcc wasn't there:

# echo $LD_LIBRARY_PATH
/usr/openwin/lib


3. I added it:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

4. Check again:

# echo $LD_LIBRARY_PATH
/usr/local/lib:/usr/openwin/lib


5. Test snmpwalk again:

# snmpwalk -V
NET-SNMP version: 5.4.4

6. To make the library PATH persistent, do the following:
Edit the /etc/profile file:

  • vi /etc/profile
Add this line at the bottom, depending on your system's library PATH:
  • LD_LIBRARY_PATH=/usr/local/lib:/usr/openwin/lib
Run this command to update the system environment PATH:
  • source /etc/profile 
Test:
  •  #echo $LD_LIBRARY_PATH