To specify the
recipient of a Simple Network Management Protocol (SNMP) notification
operation, use the
snmp-server
host command in
global configuration
mode. To remove the specified host, use the
no form of
this command.
snmp-server host address [ clear | encrypted ] [informs] [traps] [ version { 1 | 2c | 3 { auth | noauth | priv } } ] community-string [ udp-port port ] [notification-type]
no snmp-server host address [ clear | encrypted ] [informs] [traps] [ version { 1 | 2c | 3 { auth | noauth | priv } } ] community-string [ udp-port port ] [notification-type]
Syntax Description
address
|
Name or IP
address of the host (the targeted recipient).
|
clear
|
(Optional)
Specifies that the
community-string
argument is clear text.
|
encrypted
|
(Optional)
Specifies that the
community-string
argument is encrypted text.
|
informs
|
(Optional)
Specifies to send inform messages to this host.
|
traps
|
(Optional)
Specifies that notifications should be sent as traps. This is the default.
|
version
|
(Optional)
Specifies the version of the SNMP used to send the traps.
|
1
|
Specifies
SNMPv1, the default.
|
2c
|
Specifies
SNMPv2C.
|
3
|
Specifies
SNMPv3. Version 3 is the most secure model because it allows packet encryption.
If you specify the SNMPv3 keyword, you must specify the security level.
|
auth
|
Enables
Message Digest 5 (MD5) algorithm and Secure Hash Algorithm (SHA) packet
authentication.
|
noauth
|
Specifies
that the noAuthNoPriv security level applies to this host. This is the default
security level for SNMPv3.
|
priv
|
Enables
Data Encryption Standard (DES) packet encryption (also called “privacy”).
|
community-string
|
Password-like community string sent with the notification
operation. We recommend defining this string using the
snmp-server community
command prior to using the
snmp-server host
command.
|
udp-port
port
|
(Optional)
Specifies the User Datagram Protocol (UDP) port of the host to use. Range is
from 1 to 65535. The default UDP port is 161.
|
notification-type
|
(Optional)
Type of notification to be sent to the host. If no type is specified, all
available notifications are sent. The notification type can be one or more of
these keywords:
-
bgp
—Enables SNMP Border Gateway Protocol Version 4
(BGPv4) traps.
-
config
—Controls configuration notifications, as defined in
the CISCO-CONFIG-MAN-MIB (enterprise 1.3.6.1.4.1.9.9.43.2). The notification
type is (1) ciscoConfigManEvent.
-
copy-complete
—Enables CISCO-CONFIG-COPY-MIB ccCopyCompletion
traps.
-
entity
—Controls Entity MIB modification notifications. This
notification type is defined in the ENTITY-MIB (enterprise 1.3.6.1.2.1.47.2)
as: (1) entConfigChange.
-
fabric
—Enables SNMP fabric traps.
-
fru-ctrl
—Enables SNMP entity field-replaceable unit (FRU)
control traps.
-
mpls
—Enables SNMP Multiprotocol Label Switching (MPLS)
traps.
-
sensor
—Enables SNMP entity sensor traps.
-
snmp
—Enables SNMP traps.
-
syslog
—Controls error message notifications
(Cisco-syslog-MIB). Specify the level of messages to be sent with the
logging history
command.
|
Command Default
This command is
disabled by default. No notifications are sent.
The default UDP
port is 161.
When this command
is entered without keywords, the default is to send all trap types to the host.
If no version
keyword is entered, the default is version 1.
If version 3 is
specified, but the security level is not specified, the default security level
is noauth.
Command Modes
Global configuration
Command History
Release
|
Modification
|
Release 2.0
|
This
command was introduced.
|
Release 4.1.0
|
The
informs
keyword was added.
|
Release 4.2.0
|
Support
for IPv6 was added.
|
Usage Guidelines
To use this command, you must be in a user group associated with a task group that includes appropriate task IDs. If the user
group assignment is preventing you from using a command, contact your AAA administrator for assistance.
SNMP notifications
can be sent as traps. Traps are unreliable because the receiver does not send
acknowledgments when it receives traps. The sender cannot determine if the
traps were received. Traps are discarded as soon as they are sent. Traps are
also sent only once.
When the
snmp-server
host command is not entered, no notifications are sent. To
configure the device to send SNMP notifications, configure at least one
snmp-server
host command. When the command is entered without keywords, all
trap types are enabled for the host.
To enable multiple
hosts, issue a separate
snmp-server
host command for each host. You can specify multiple notification
types in the command for each host.
When multiple
snmp-server
host commands are given for the same host and kind of
notification (trap), each succeeding
snmp-server
host command overwrites the previous command. Only the last
snmp-server
host command is in effect. For example, if an
snmp-server
host command with the
traps keyword
is entered for a host and then another command with the
traps keyword
is entered for the same host, the second command replaces the first.
Either a host name
or IP address can be used to specify the host.
Both IPv4 and IPv6 IP
address formats are supported.
The
snmp-server
host command is used with the
snmp-server
engineid command. Use the
snmp-server
traps command to specify which SNMP notifications
are sent globally. For a host to receive most notifications, at least one
snmp-server
traps command and the
snmp-server
host command for that host must be enabled.
However, some
notification types cannot be controlled with the
snmp-server
traps command. For example, some notification
types are always enabled. Other notification types are enabled by a different
command.
The availability
of a notification-type depends on the device type and Cisco software features
supported on the device.
To display which
notification types are available on the system, use the question mark (? ) online help function at the end of the
snmp-server
host command.
The
no
snmp-server
host command used with no keywords disables traps.
Use the
clear keyword
to specify that the clear text community string you enter is displayed
encrypted in the
show
running command output. To enter an encrypted
string, use the
encrypted
keyword. To enter a clear text community string that is not encrypted by the
system, use neither of these keywords.
If the
informs
keyword is used, the SNMP version can be only SNMPv2C or SNMPv3.
Task ID
Task ID
|
Operations
|
snmp
|
read,
write
|
Examples
This example shows
how to send RFC 1157 SNMP traps to the host specified by the name
myhost.cisco.com. Other traps are enabled, but only SNMP traps are sent because
only the
snmp keyword
is specified in the
snmp-server
host command. The community string is defined as
comaccess.
RP/0/RP0/CPU0:router(config)# snmp-server traps
RP/0/RP0/CPU0:router(config)# snmp-server host myhost.cisco.com comaccess snmp
This example shows
how to send the SNMP traps to address 172.30.2.160:
RP/0/RP0/CPU0:router(config)# snmp-server traps snmp
RP/0/RP0/CPU0:router(config)# snmp-server host 172.30.2.160 public snmp
This example shows
how to enable the router to send all traps to the host, myhost.cisco.com, using
the community string public:
RP/0/RP0/CPU0:router(config)# snmp-server traps
RP/0/RP0/CPU0:router(config)# snmp-server host myhost.cisco.com public
This example shows
how to prevent traps from being sent to any host. The BGP traps are enabled for
all hosts, but only the configuration traps are enabled to be sent to a host.
RP/0/RP0/CPU0:router(config)# snmp-server traps bgp
RP/0/RP0/CPU0:router(config)# snmp-server host hostabc public config
This example shows how to
send SNMPv3 informs to a host:
RP/0/RP0/CPU0:router(config)# snmp-server host 172.30.2.160 informs version 3