SNMP on a CISCO Router
SNMP protocol helps network administrators to manage, monitor the state of network devices. The network device send some informations to the NMS server to trace graphics who permit to analysing the CPU, memory, I/O… This article begin a series of many about network monitoring subject.
For more informations about basic concepts of SNMP, it’s here (In this article, we will just focus on activation of snmp):
Enabling SNMP Community string
First, display the current config (running-config) to see if SNMP isn’t configured yet:
Router#show running-config Building configuration... .... |
After, if SNMP isn’t configured , go to the router configuration mode:
Router#configure terminal Enter configuration commands, one per line. End with CNTL/Z. Router(config)# |
We will now creating a public community (Read-Only):
Router(config)#snmp-server community public RO |
here “public” is the public community, who can only read the traps.
after, we create a private community (Read-&-Write):
Router(config)#snmp-server community private RW |
here “private” is the private community, who can access in read & write.
Don’t forget to save te current configuration into NVRAM:
Router#write memory Building configuration... [OK] Router# |
Vérifying SNMP configuration
Vérifying the TCP/IP connectivity between SNMP (NMS) and the router.
C:\>ping 172.16.0.1 Pinging 172.16.0.1 with 32 bytes of data: Reply from 172.16.0.1: bytes=32 time<10ms TTL=247 Reply from 172.16.0.1: bytes=32 time=10ms TTL=247 Reply from 172.16.0.1: bytes=32 time<10ms TTL=247 Reply from 172.16.0.1: bytes=32 time<10ms TTL=247 Ping statistics for 172.16.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 10ms, Average = 2ms |
We try connecting to the router via telnet:
prompt# telnet 172.16.99.20 Router>enable Password: Router# |
Display the current config and verify the SNMP informations:
Router#show running-config .... .... snmp-server community public RO snmp-server community private RW .... ....
If you can’t see any line about SNMP into the running-config, remake the first step.
You can equaly verifying the SNMP activation with the command show snmp:
Router#show snmp %SNMP agent not enabled Router# |
Here an example of this command with the SNMP service activated:
Router#show snmp Chassis: 00000000000 (1880125456) 0 SNMP packets input 0 Bad SNMP version errors 0 Unknown community name 0 Illegal operation for community name supplied 0 Encoding errors 0 Number of requested variables 0 Number of altered variables 0 Get-request PDUs 0 Get-next PDUs 0 Set-request PDUs 1 SNMP packets output 0 Too big errors (Maximum packet size 1500) 0 No such name errors 0 Bad values errors 0 General errors 0 Response PDUs 1 Trap PDUs SNMP logging: enabled Logging to 10.1.1.1.162, 1/10, 0 sent, 0 dropped. |
Modify/Delete SNMP informations
Follow this steps to modifying your SNMP communities:
To delete a community (into configuration mode):
Router(config)#no snmp-server community public RO |
To adding a community, refer to the first step of this article:
Router(config)#snmp-server community XXXX RO (où "XXXX" est la communauté) |
Configure SNMP traps on the router
To send SNMP traps (informations sended to the NMS server), you must entering this command:
Router(config)#snmp-server enable traps |
This command enable all traps types, but you can just activating a parts of traps. Example:
Router(config)#snmp-server enable traps frame-relay Router(config)#snmp-server enable traps envmon temperature Router(config)#snmp-server enable traps bgp Router(config)#snmp-server enable traps snmp |
Configuring NMS host
Now, we will configuring the IP address of NMS server:
Router(config)#snmp-server host 10.1.1.1 public |
To be more selective, we can easily send specific traps to differents NMS servers:
Router(config)#snmp-server host 10.1.1.1 public snmp bgp Router(config)#snmp-server host 10.2.2.2 public snmp frame-relay |
References
CCO Documentation on SNMP
Cisco Network Management Toolkit page
Cisco MIB information
Comments are Disabled