3.1.3 SNMP Configuration

Use this command to enable/disable the SNMP server and set Engine ID.

Command Syntax:

snmp-server 
snmp-server engine-id local <engineID>
Table 3-5. Command Description

Argument

Description

Parameter

<engineID>

Local engine ID

Default

N.A

Mode

Global Configuration mode

Usage

Enable SNMP server and specify engine ID. To disable the SNMP, use the ‘no’ version of the command.

Example

Example 1:

Enable SNMP.

# configure terminal
(config)# snmp-server engine-id local 800019cb030200c1966887

Use this command to trap Destination and Source configuration.

Command Syntax:

snmp-server trap <source_name> [ id <filter_id> ] [ <oid_subtree> { include | exclude } ]
Table 3-6. Command Description

Argument

Description

Parameter

<source_name>

Name of the event. Possible options are: alarmTrapStatus, authenticationFailure, coldStart, entConfigChange, ipTrapGlobalsMain, ipTrapInterfacesLink, linkDown, linkup, lldpRemTablesChange, newRoot, psecTrapGlobalsMain, psecTrapInterfaces, topologyChange, and warmStart.

<filter_id>

Trap source filter ID

<oid_subtree>

OiD to use as index filter

Default

N.A

Mode

Global Configuration mode

Usage

Configure SNMP source. To delete the entry, use the ‘no’ version of the command.

Example

Example 1:

Add “Remote SNMP client was trying to access the unit using invalid username/password values” event to the trap source configuration.

# configure terminal
(config)# snmp-server trap authenticationfailure

Use this command to configure the SNMP community table used as part of SNMP group configuration.

Command Syntax:

snmp-server community <v3_comm> [ { ip-range <v_ipv4_addr> <v_ipv4_netmask> | ipv6-range <v_ipv6_subnet> } ] { <v3_sec> | encrypted <v3_sec_enc> }
Table 3-7. Command Description

Argument

Description

Parameter

<v3_comm>

Community Name to map to the SNMP Groups configuration. String length is 1–32 and valid ASCII characters range 33–126.

ip-range <v_ipv4_addr> <v_ipv4_netmask>| ipv6-range <v_ipv6_subnet>

Indicates SNMP access source address. A range of source addresses can be used to restrict source subnet when combined with source netmask.

<v3_sec> | encrypted <v3_sec_enc>

Indicates the community secret (access string) to permit access using SNMPv1 and SNMPv2c to the SNMP agent. The allowed string length is 1–32, and the allowed content is ASCII characters from 33–126.

Default

N.A

Mode

Global Configuration mode

Usage

Configure SNMP community. To delete it, use the ‘no’ version of the command.

Example

Example 1:

Create SNMP community named “c-name” with community secret “secret”.

# configure terminal
(config)# snmp-server community c-name secret

Use this command to configure SNMPv3 user.

Command Syntax:

snmp-server user <username> engine-id <engineID> [ { md5 { <md5_passwd> | { encrypted <md5_passwd_encrypt> } } | sha { <sha_passwd> | { encrypted <sha_passwd_encrypt> } } } [ priv { des | aes } { <priv_passwd> | { encrypted <priv_passwd_encrypt> } } ] ]
Table 3-8. Command Description

Argument

Description

Parameter

<username>

User name. String length is 1–32, and the valid ASCII characters range is 33–126.

<engineID>

Octet string. Must contain an even number (in hexadecimal format) between 10 and 64 digits.

md5 <md5_passwd>

Authentication protocol MD5. The password length is 8–32 and the valid ASCII characters range is 33–126.

sha <sha_passwd>

Authentication protocol SHA. The password length is 8–40 and the valid ASCII characters range is 33–126.

priv { des | aes }

Privacy protocol DES or AES

<priv_passwd>

Privacy password. The password length is 8–32 and the valid ASCII characters range is 33–126.

Default

N.A

Mode

Global Configuration mode

Usage

Configure SNMPv3 user. To delete it, use the ‘no’ version of the command.

Example

Example 1:

Add SNMPv3 user "testuser" with authentication protocol MD5 and password "testpassword".

# configure terminal
(config)# snmp-server user testuser engine-id 800019ab12345 md5 testpassword 

Use this command to configure SNMP group-name based on Security Model and Security name.

Command Syntax:

snmp-server security-to-group model { v1 | v2c | v3 } name <security_name> group <group_name>
Table 3-9. Command Description

Argument

Description

Parameter

v1 | v2c | v3

The security model to which the entry should belong.

<security_name>

One of the security names created in SNMP Community for v1 and v2c or one of the SNMPv3 users.

<group_name>

Group name. String length is 1–32, and the valid ASCII characters range is 33–126.

Default

N.A

Mode

Global Configuration mode

Usage

Configure SNMP group name. To delete it, use the ‘no’ version of the command.

Example

Example 1:

Configure SNMPv2 security model and group.

# configure terminal
(config)# snmp-server security-to-group model v2c name public group ro_group

Use this command to configure which SNMP OiDs must be included/excluded from the entire SNMP OiD tree.

Command Syntax:

snmp-server view <view_name> <.oid_subtree> { include | exclude }
Table 3-10. Command Description

Argument

Description

Parameter

<view_name>

A string identifying the view name that this entry should belong to. The allowed string length is 1–32, and the allowed content is ASCII characters from 33–126.

<.oid_subtree>

OiD defining the root of the subtree to add to the named view. String length is 1–128. Allowed string content is number or asterisk (*).

Default

N.A

Mode

Global Configuration mode

Usage

Configure SNMP View OiD-range. Use the ‘no’ version of the command to delete it.

Example

Example 1:

Create an SNMP view OiD-range named “mib-ii” with access to all SNMP OiDs exept for the MIB-II system branch .1.3.6.1.2.1.1.

# configure terminal
(config)# snmp-server view mib-ii .1.3.6.1.2.1.1 excluded

Use this command to configure the SNMP access.

Command Syntax:

snmp-server access <group_name> model { v1 | v2c | v3 | any } level { auth | noauth | priv } [ read <view_name>] [ write <write_name>]
Table 3-11. Command Description

Argument

Description

Parameter

<group_name>

Group name previously configured by security-to-group command. String length is 1–32 and valid ASCII characters range 33–126.

model {v1 | v2c | v3 | any}

Security model the entry should belong to.

level {auth | noauth | priv}

Security level.
  • Auth, NoPriv: Authentication and no privacy.
  • NoAuth, NoPriv: No authentication and no privacy.
  • Auth, Priv: Authentication and privacy.

read <view_name>

Name of the MIB view defining the MIB objects for which this request may read OiD values

write <write_name>]

Name of the MIB view defining the MIB objects for which this request may set OiD new values

Default

N.A

Mode

Global Configuration mode

Usage

Configure the SNMP group name. To delete it, use the ‘no’ version of the command.

Example

Example 1:

Configure SNMPv2 access.

# configure terminal
(config)# snmp-server access ro_group model v2c level noauth read mib-ii