snmp-server host

Configures the agent with the SNMP trap destination information with the community or user-name attached to it.

Syntax

snmp-server { host [ ip-address | host ] comm-user udp-port version [ 1 | 2c | 3 ] }
no snmp-server { host [ ip-address | host ] comm-user }

Parameters

ip-address
Specifies the trap receiver unicast IPv4 or IPv6 address.
host
Specifies the host name of the trap receiver.
comm-user
Specifies the community string associated with SNMP traps. Community string must start with a character and can contain only alpha-numeric characters. Valid string length is 2 through 16 characters.
Supported on SNMP versions 1 and 2c.
udp-port
Specifies the port on which the receiver is listening for SNMP traps. Valid port range is 1 – 65535. Default port is 162.
version [ 1 | 2c | 3 ]
Specifies the SNMP version to be used to send SNMP traps. Default version is 2c.

Modes

Config mode

Usage Guidelines

This command is available only to users with admin role.

This command combines a host and community string.

Only valid unicast IP addresses are supported, multicast IP addresses are not supported.

The [no] form of the command removes the corresponding configuration.

Examples

The following example configures the SNMP server with the community string using version 2c.

device# configure terminal
device(config)# snmp-server host 10.23.17.128 public 162 version 2c 

device(config)# do show running-config snmp-server 
snmp-server host 10.23.17.128 public 162 version 2c 

The following example removes the configured host and community string.

device# configure terminal
device(config)# no snmp-server host 10.23.17.128 public 
The following examples show the error messages.
ngnpb(config)# snmp-server host 255.255.255.255 public 
Error: not a valid unicast address 255.255.255.255 

ngnpb(config)# snmp-server host 224.1.1.1 public 
Error: not a valid unicast address 224.1.1.1  

ngnpb(config)# snmp-server host 1.1.1.1 public 70000 version 2c 
% Value '70000' not in range <1-65535>.