Changes between Initial Version and Version 1 of NSM2021/Agenda/SNMP-Hands-on


Ignore:
Timestamp:
May 10, 2021, 11:25:20 AM (3 years ago)
Author:
admin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NSM2021/Agenda/SNMP-Hands-on

    v1 v1  
     1= SNMP Hands - On =
     2
     3=== Goals ===
     4- Install and learn to use the SNMP commands
     5- Install vendor specific MIBs and use those with the SNMP commands
     6
     7=== Notes ===
     8- For below hands-on we will be using Ubuntu 20.04 version.
     9- If you are installing snmp client (manager) tools on a remote server/computer you will need to connect the server through a SSH connection.
     10
     11== Installing SNMP Client (Manager) tools ==
     12
     13Connect to the server which will be used as the NMS (Network Management Station) and Open the Terminal program.
     14
     15Update your software package repository
     16{{{
     17$ sudo apt-get update
     18}}}
     19This might take a few moments if everyone in class is doing this at the same moment.
     20
     21Install the net-snmp tools:
     22{{{
     23$ sudo apt-get install snmp
     24$ sudo apt-get install snmp-mibs-downloader
     25}}}
     26The second of the two commands downloads the standard IETF and IANA SNMP MIBs which are not included by default.
     27
     28Now, edit the file /etc/snmp/snmp.conf:
     29{{{
     30$ sudo vi /etc/snmp/snmp.conf
     31}}}
     32
     33Note: Here we are using '''vi''' editor. You can use any text editor you are familiar with
     34
     35Change this line:
     36{{{
     37mibs :
     38}}}
     39
     40so that it looks like:
     41{{{
     42# mibs :
     43}}}
     44
     45(You are "commenting out" the empty mibs statement, which was telling the snmp* tools not to automatically load the mibs in the /usr/share/mibs/ directory)
     46
     47=== User specific SNMP configurations ===
     48Now, in your home directory make a .snmp directory with file snmp.conf inside it, make it readable only be you, and add the credentials to it:
     49{{{
     50$ cd
     51$ mkdir .snmp
     52$ chmod 700 .snmp/
     53$ vi .snmp/snmp.conf
     54}}}
     55
     56
     57Put the following contents in the file:
     58{{{
     59
     60defVersion 3
     61
     62# SNMP v3 Configurations
     63defSecurityLevel authNoPriv
     64defSecurityName admin
     65defAuthPassphrase <class passowrd>
     66defAuthType SHA
     67
     68# SNMP v2c default community string
     69defCommunity <class passowrd>
     70
     71}}}
     72
     73== Configuration of SNMP Agent on Routers and Switches ==
     74
     75==== Cisco ====
     76
     77connect to your router and go to configure mode.
     78{{{
     79Router> enable
     80
     81Router# configure terminal
     82}}}
     83Now we need to add an Access Control List rule for SNMP access, turn on SNMP, assign a read-only SNMP community string as well as a SNMPv3 group and user and tell the router to maintain SNMP information across reboots. To do this we do:
     84{{{
     85Router(config)# access-list 99 permit 192.248.6.0 255.255.255.0
     86Router(config)# snmp-server community <class passowrd> ro 99
     87Router(config)# snmp-server group ReadGroup v3 auth access 99
     88Router(config)# snmp-server user admin ReadGroup v3 auth sha <Class Password>
     89Router(config)# snmp-server ifindex persist
     90Now let's exit and save this new configuration to the routers permanent config.
     91
     92Router(config)# exit
     93Router# write memory           
     94Router# exit       
     95}}}             
     96
     97==== HP ====
     98Connect to the Router and go to config mode
     99{{{
     100<Router> system-view
     101}}}
     102
     103Add the following configurations
     104{{{
     105[Router]acl number 2000
     106[Router-acl-basic-2000]rule 0 permit source 192.248.6.0 0.0.0.255
     107[Router]snmp-agent
     108[Router]snmp-agent community read <class passowrd>
     109[Router]snmp-agent sys-info version all
     110[Router]snmp-agent group v3 ReadGroup authentication acl 2000
     111[Router]snmp-agent usm-user v3 admin ReadGroup authentication-mode sha <class passowrd>
     112}}}
     113
     114== Testing SNMP ==
     115Now we have both a SNMP Manager and SNMP Agent. To check that your SNMP installation works, run the snmpstatus command on the SNMP Manager host.
     116
     117{{{
     118$ snmpstatus <IP_ADDRESS>
     119}}}
     120Note that you just used was the SNMPv3 because we set the default version as SNMPv3. Try again, adding "-v2c" as a parameter. Notice that the command automatically uses the community string in the snmp.conf file instead of the v3 user credentials. Try "-v1".
     121
     122To use the SNMP v2 or v1 we can add an option as below. Which will override the settings in the configuration file(/.snmp/snmp.conf).
     123
     124snmpstatus -v2c <IP_ADDRESS>
     125snmpstatus -v1 <IP_ADDRESS>
     126
     127Again we didn't want set Community string as it was set in the manager configuration file.
     128
     129For the Router,
     130{{{
     131#snmpstatus <Router IP>
     132}}}
     133
     134For the Switch,
     135{{{
     136#snmpstatus <Switch IP>
     137}}}