Specifications
IP Switching Commands
snmp-server host
ISW-346
Cisco IOS IP Switching Command Reference
May 2008
Examples If you want to configure a unique SNMP community string for traps but prevent SNMP polling access
with this string, the configuration should include an access list. The following example shows how to
name a community string comaccess and number an access list 10:
Router(config)# snmp-server community comaccess ro 10
Router(config)# snmp-server host 172.20.2.160 comaccess
Router(config)# access-list 10 deny any
Note The “at” sign (@) is used as a delimiter between the community string and the context in which it is used.
For example, specific VLAN information in BRIDGE-MIB may be polled using community@VLAN_ID
(for example, public@100), where 100 is the VLAN number.
The following example shows how to send RFC 1157 SNMP traps to a specified host named
myhost.cisco.com. Other traps are enabled, but only SNMP traps are sent because only snmp is specified
in the snmp-server host command. The community string is defined as comaccess.
Router(config)# snmp-server enable traps
Router(config)# snmp-server host myhost.cisco.com comaccess snmp
The following example shows how to send the SNMP and Cisco environmental monitor
enterprise-specific traps to address
172.30.2.160 using the community string public:
Router(config)# snmp-server enable traps snmp
Router(config)# snmp-server enable traps envmon
Router(config)# snmp-server host 172.30.2.160 public snmp envmon
The following example shows how to enable the router to send all traps to the host myhost.cisco.com
using the community string public:
Router(config)# snmp-server enable traps
Router(config)# snmp-server host myhost.cisco.com public
The following example will not send traps to any host. The BGP traps are enabled for all hosts, but only
the ISDN traps are enabled to be sent to a host. The community string is defined as public.
Router(config)# snmp-server enable traps bgp
Router(config)# snmp-server host myhost.cisco.com public isdn
The following example shows how to enable the router to send all inform requests to the host
myhost.cisco.com using the community string public:
Router(config)# snmp-server enable traps
Router(config)# snmp-server host myhost.cisco.com informs version 2c public
The following example shows how to send HSRP MIB informs to the host specified by the name
myhost.cisco.com. The community string is defined as public.
Router(config)# snmp-server enable traps hsrp
Router(config)# snmp-server host myhost.cisco.com informs version 2c public hsrp
The following example shows how to send all SNMP notifications to company.com over the VRF named
trap-vrf using the community string public:
Router(config)# snmp-server host company.com vrf trap-vrf public
The following example shows how to configure an IPv6 SNMP notification server with the IPv6 address
2001:0DB8:0000:ABCD:1 using the community string public:
Router(config)# snmp-server host 2001:0DB8:0000:ABCD:1 version 2c public udp-port 2012