---
title: SNMP Configuration
slug: routing/snmp-configuration
createdAt: 2025-12-04T03:54:13.481Z
---

## <font color="#1d50a2">SNMP Configuration</font>

### <font color="#1d50a2">show snmp-agent trap-target</font>

**\[Command]**
**show snmp-agent trap-target**

**\[Purpose]**
Display SNMP trap server configuration

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show snmp-agent trap-target
Version TrapReceiverIP Port VRF Community User
--------- ---------------- ------ ----- ----------- ------
2 1.1.1.1 162 None testa -
```

### <font color="#1d50a2">show snmp-agent source</font>

**\[Command]**
**show snmp-agent source**

**\[Purpose]**
Display the SNMP source address and port configuration

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show snmp-agent source
ListenIP ListenPort ListenVrf
---------- ------------ -----------
30.11.0.82
```

### <font color="#1d50a2">show snmp-agent user</font>

**\[Command]**
**show snmp-agent user**

**\[Purpose]**
Display SNMPv3 user configuration

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show snmp-agent user
User Type AuthType EncryptionType
------ ------------ ---------- ----------------
test noAuthNoPriv
```

### <font color="#1d50a2">show snmp-agent threshold</font>

**\[Command]**
**show snmp-agent threshold**

**\[Purpose]**
Display SNMP alarm threshold configuration

**\[View]**
System view

**\[Use Cases]**

```plaintext
sonic# show snmp-agent threshold
Threshold-Type Threshold-Value
---------------- -----------------
cpu-usage 80%
memory-usage 80%
```

### <font color="#1d50a2">snmp-agent enable</font>

**\[Command]**
**snmp-agent enable**
**no snmp-agent enable**

**\[Purpose]**
Enable SNMP function

**\[View]**
System configure view

**\[Use Cases]**

```plaintext
sonic(config)# snmp-agent enable
```

### <font color="#1d50a2">snmp-agent community community\_name \{RO|RW\}</font>

**\[Command]**
**snmp-agent community *community\_name* \{RO|RW}**
**no snme-agent community *community\_name***

**\[Purpose]**
Add SNMP community

**\[Parameter]**

| **Parameter**     | **Description** |
| ----------------- | --------------- |
| *community\_name* | community name  |

**\[View]**
System configuration view

**\[Usage Scenario]**
The community name like a password, and devices within the community use this name for authentication during communication. Only devices with the same configured community name can access each other.

By default, the community name is set to **public**.

**\[Use Cases]**

```plaintext
sonic(config)# snmp-agent community snmptest RW
```

### <font color="#1d50a2">snmp-agent user *name*</font>

**\[Command]**
**snmp-agent user *name* AuthNoPriv \{RO|RW} \{MD5|SHA} *password***
**snmp-agent user *name* Priv \{RO|RW} \{MD5|SHA} *password* \{DES|AES} *password***
**snmp-agent user *name* noAuthNoPriv \{RO|RW}**
**no snmp-agent user *name***

**\[Purpose]**
Create SNMPv3 users

**\[Parameter]**

| **Parameter**  | **Description**                                                                                                |
| -------------- | -------------------------------------------------------------------------------------------------------------- |
| *name*         | User name                                                                                                      |
| *AuthNoPriv*   | Specify the security level as requiring authentication, and specify the&#xD; authentication method as: MD5/SHA |
| *noAuthNoPriv* | Specify the security level as no authentication required                                                       |
| *Priv*         | Specify the security level as encryption                                                                       |
| *\{RW\|RO}*    | Specify the user rights                                                                                        |
| *\{DES\|AES}*  | Specify the encryption algorithm                                                                               |

**\[View]**
System configuration view

**\[Usage Scenario]**
SNMPv3 provides encryption and authentication mechanisms to safeguard the management information of network devices from unauthorized access. Therefore, in high-security network environments, using SNMPv3 can better protect the security of network devices.

**\[Use Cases]**

```plaintext
sonic(config)# snmp-agent user user3 priv md5 12345678 des 87654321
sonic(config)# snmp-agent user user4 noauthnopriv
sonic(config)# snmp-agent user user5 authnopriv md5 12345678
```

### <font color="#1d50a2">snmp-agent trap-target threshold system-usage</font>

**\[Command]**
**snmp-agent trap-target threshold system-usage \{cpu-usage|memory-usage} *value***
**snmp-agent trap-target threshold reset system-usage**

**\[Purpose]**
Enable specific utilization alarm switch

**\[Parameter]**

| **Parameter**  | **Description**    |
| -------------- | ------------------ |
| *cpu-usage*    | CPU utilization    |
| *memory-usage* | Memory Utilization |
| *value*        | Alarm Threshold    |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic(config)# snmp-agent trap-target threshold system-usage memory-usage 70
```

### <font color="#1d50a2">snmp-agent trap-target \{1|2|3\}</font>

**\[Command]**
**snmp-agent trap-target \{1|2|3} \{*address}* \[udp-port *portnum*] \[vrf *vrfname*] \[community *community\_name*]**
**no snmp-agent trap-target \{1|2|3}**

**\[Purpose]**
Configure the server for agent trap

**\[Parameter]**

| **Parameter**     | **Description**          |
| ----------------- | ------------------------ |
| *address*         | IP address               |
| *portnum*         | Port number, default 162 |
| *vrfname*         | vrf name                 |
| *community\_name* | agent community          |

**\[View]**
System configuration view

**\[Usage Scenario]**
Devices send alarm messages that can be uploaded to a trap server using the trap command. In this case, the SNMP trap server needs to be configured. However, the reliability of trap messages is lower because the sender cannot confirm whether the trap message has been received, as the recipient does not send acknowledgment messages.

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# snmp-agent trap-target 1 10.250.0.221
sonic(config)# snmp-agent trap-target 2 10.250.0.221 udp-port 163 community comm1
```

### <font color="#1d50a2">snmp-agent source *A.B.C.D/A\:\:B|Loopback* \[udp-port *portnum*\] \[vrf *vrfname*\]</font>

**\[Command]**
**snmp-agent source *A.B.C.D/A\::B|Loopback* \[udp-port *portnum*] \[vrf *vrfname*]**

**\[Purpose]**
Configure the source IP address of the device to send SNMP protocol packets

**\[Parameter]**

| **Parameter**    | **Description**                                     |
| ---------------- | --------------------------------------------------- |
| *A.B.C.D/A\::B*  | IP address                                          |
| *nterface\_name* | interface name ,can only be configured as Loopback0 |
| *Loopback*       | Loopback                                            |
| *portnum*        | The port number, default is 161                     |
| *vrfname*        | vrf name                                            |

**\[View]**
System configuration view

**\[Use Cases]**

```plaintext
sonic# configure terminal
sonic(config)# snmp-agent source 10.250.0.221
```

