![Cisco Catalyst 2350 Command Reference Manual Download Page 412](http://html.mh-extra.com/html/cisco/catalyst-2350/catalyst-2350_command-reference-manual_67583412.webp)
2-388
Catalyst 2350 Switch Command Reference
OL-19055-01
Chapter 2 Catalyst 2350 Cisco IOS Commands
snmp-server host
Usage Guidelines
SNMP notifications can be sent as traps or inform requests. Traps are unreliable because the receiver
does not send acknowledgments when it receives traps. The sender cannot determine if the traps were
received. However, an SNMP entity that receives an inform request acknowledges the message with an
SNMP response PDU. If the sender never receives the response, the inform request can be sent again.
Thus, informs are more likely to reach their intended destinations.
However, informs consume more resources in the agent and in the network. Unlike a trap, which is
discarded as soon as it is sent, an inform request must be held in memory until a response is received or
the request times out. Traps are also sent only once, but an inform might be retried several times. The
retries increase traffic and contribute to a higher overhead on the network.
If you do not enter an
snmp-server host
command, no notifications are sent. To configure the switch to
send SNMP notifications, you must enter at least one
snmp-server host
command. If you enter the
command with no keywords, all trap types are enabled for the host. To enable multiple hosts, you must
enter a separate
snmp-server host
command for each host. You can specify multiple notification types
in the command for each host.
If a local user is not associated with a remote host, the switch does not send informs for the
auth
(authNoPriv) and the
priv
(authPriv) authentication levels.
When multiple
snmp-server host
commands are given for the same host and kind of notification (trap
or inform), each succeeding command overwrites the previous command. Only the last
snmp-server
host
command is in effect. For example, if you enter an
snmp-server host inform
command for a host
and then enter another
snmp-server host inform
command for the same host, the second command
replaces the first.
The
snmp-server host
command is used with the
snmp-server enable
traps
global configuration
command. Use the
snmp-server enable
traps
command to specify which SNMP notifications are sent
globally. For a host to receive most notifications, at least one
snmp-server enable
traps
command and
the
snmp-server host
command for that host must be enabled. Some notification types cannot be
controlled with the
snmp-server enable
traps
command. For example, some notification types are
always enabled. Other notification types are enabled by a different command.
The
no snmp-server host
command with no keywords disables traps, but not informs, to the host. To
disable informs, use the
no snmp-server host informs
command.
Examples
This example shows how to configure a unique SNMP community string named
comaccess
for traps and
prevent SNMP polling access with this string through access-list 10:
Switch(config)#
snmp-server community comaccess ro 10
Switch(config)#
snmp-server host 172.20.2.160 comaccess
Switch(config)#
access-list 10 deny any
This example shows how to send the SNMP traps to the host specified by the name
myhost.cisco.com
.
The community string is defined as
comaccess
:
Switch(config)#
snmp-server enable traps
Switch(config)#
snmp-server host myhost.cisco.com comaccess snmp
This example shows how to enable the switch to send all traps to the host
myhost.cisco.com
by using the
community string
public
:
Switch(config)#
snmp-server enable traps
Switch(config)#
snmp-server host myhost.cisco.com public
You can verify your settings by entering the
show running-config
privileged EXEC command.