How to Configure SNMP on Cisco IOS based Router or Switch

SNMP is an application-layer protocol that provides a message format for communication between SNMP managers and agents. The SNMP manager is the system used to control and monitors the activities of network hosts using SNMP; this is also called Network Management Station (NMS). This article explains how to configure Simple Network Management Protocol (SNMP) community strings on Cisco routers and Catalyst switches to enable SNMP agent. The configuration of SNMP on Cisco devices is very simple, and is handled from global configuration mode.

We must define the relationship between the SNMP manger and Client. The command to enable SNMP client on the Cisco Router is snmp community, followed by the community name. This command also allows you to configure the SNMP agent as read only or for both read and write access. If not specified, by default it will be configured as read only. In this case, you configured community name to public, allowing both read and write access. This will allow an NMS to both configure and gather information from our managed device. SNMP settings are configured from global configuration mode.

Enable SNMP Community Strings on Cisco Router

1.Telnet into the Router or Switch, Type “enable” to get in to enable mode. Enter the enable password.

prompt# telnet 192.168.1.1
Router>enable
Password:
Router#

2. Get into global configuration mode by typing “configure terminal” and find available commands for SNMP configuration on Cisco Router.

Router(config)#

Router(config)#snmp-server ?
  chassis-id                       String to uniquely identify this chassis
  community                    Enable SNMP; set community string and access privs
  contact                          Text for mib object sysContact
  context                           Create/Delete a context apart from default
  drop                                 Silently drop SNMP packets
  enable                            Enable SNMP Traps
  engineID                       Configure a local or remote SNMPv3 engineID
  file-transfer                  File transfer related commands
  group                            Define a User Security Model group
  host                                Specify hosts to receive SNMP notifications
  ifindex                           Enable ifindex persistence
  inform                           Configure SNMP Informs options
  ip                                     IP ToS configuration for SNMP traffic
  location                         Text for mib object sysLocation
  manager                        Modify SNMP manager parameters
  packetsize                     Largest SNMP packet size
  queue-length                Message queue length for each TRAP host
  source-interface           Assign an source interface
  system-shutdown        Enable use of the SNMP reload command
  tftp-server-list              Limit TFTP servers used via SNMP
  trap                               SNMP trap options
  trap-source                  Assign an interface for the source address of all traps
  trap-timeout                Set timeout for TRAP message retransmissions
  user                                Define a user who can access the SNMP engine
  view                               Define an SNMPv2 MIB view

3. Enable SNMP with the following command:

Router(config)#snmp-server community <community-string> ro
Router(config)#snmp-server community <community-string> rw
Router(config)#snmp-server community public rw

 Here community-string is the actual community string. The “ro” means read-only and “rw” for read-write.

4. Use the snmp-server host command to specify which host or hosts receive SNMP traps.

Router(config)#snmp-server host <ip-address> <community-string>

Here “ip-address” is the IP address of the SNMP management station and “community-string” is the actual community string.

5. Enable the Router to send Simple Network Management Protocol traps or informs (SNMP notifications), use the snmp-server enable traps global configuration command. After this command is executed, SNMP traps will be sent automatically to the SNMP management station configured in the previous step.

Router(config)#snmp-server enable traps

This command turns on all the varieties of traps. You can also turn on specific traps, by appending them to the above command, one trap variant at time. Some allow for further specificity. For 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

6.      Exit configuration mode with the command “exit”, save the new SNMP configuration with the command “write memory” or “copy run start”.

Router#write memory
Building configuration

[OK]

Router#

SNMP configuration example on a Cisco Router

prompt#telnet 192.168.1.1
Router>enable
Password:
Router#configure terminal
Enter configuration commands, one per line.  End
with CNTL/Z.Router(config)#
Router(config)#snmp-server community public RO
Router(config)#snmp-server community cisco@123 RW
Router(config)#snmp-server host 172.18.42.10 public
Router(config)#snmp-server enable traps
Router(config)#exit
Router#Router#write memory
Building configuration…[OK]
Router#
Share/Bookmark

Filed Under: SNMP

Tags:

About the Author:

RSSComments (0)

Trackback URL

Leave a Reply




If you want a picture to show with your comment, go get a Gravatar.