Simple Network Management Protocol (SNMP)
Overview and Purpose
- Concept: SNMP is an industry-standard framework and protocol used to monitor network device status, extract information, and make configuration changes.
- Role in Network Operations: It allows centralized management of network infrastructure (routers, switches, firewalls) by a central server.
- Things to note: The CCNA exam (Topic 4.4) requires you to understand the function of SNMP in network operations, not necessarily deep configuration details.
Architecture and Components
SNMP operates using a manager/agent model.
graph TD
subgraph NMS [Network Management Station NMS]
Manager[SNMP Manager]
App[SNMP Application UI]
end
subgraph ManagedDevice [Managed Device e.g. Router/Switch]
Agent[SNMP Agent]
MIB[(MIB - Management Information Base)]
OID[Object IDs OID]
end
Manager -- "Get/Set Requests UDP 161" --> Agent
Agent -- "Trap/Inform Notifications UDP 162" --> Manager
Agent --- MIB
MIB --- OID
- Managed Devices: The network devices being monitored (routers, switches). They run the SNMP Agent.
- NMS (Network Management Station/System): The “SNMP Server” that manages the devices.
- SNMP Manager: The software component that interacts directly with the agents (sends requests, receives notifications).
- SNMP Application: The user interface for the network administrator to view alerts, charts, and statistics (e.g., SolarWinds).
- MIB (Management Information Base): A hierarchical database structure on the managed device that stores the variables being monitored (e.g., interface status, CPU usage, temperature).
- OID (Object ID): A unique, globally standardized identifier for every specific variable within the MIB (e.g., an OID specifically identifies the “system name” or “linkDown” status).
SNMP Versions Comparison
| Feature | SNMPv1 | SNMPv2c | SNMPv3 |
|---|---|---|---|
| Status | Original version | Most widely used | Current best practice |
| Security | Plain-text community strings | Plain-text community strings | Strong encryption and authentication |
| Key Addition | Basic Get/Set/Trap | Added GetBulk for mass-retrieval |
Security (prevents interception) |
| Passwords | Community strings | Community strings (‘c’ stands for community) | Usernames, Auth passwords, Encryption keys |
Things to note: SNMPv1 and SNMPv2c transmit all data and passwords (community strings) in plain text, making them highly insecure. SNMPv3 is strongly preferred for production networks.
SNMP Message Types and Ports
SNMP messages are categorized into four classes: Read, Write, Notification, and Response.
| Message Class | Message Type | Direction | Port Target | Reliable? | Description |
|---|---|---|---|---|---|
| Read | Get |
NMS $\rightarrow$ Agent | UDP 161 | Yes | Retrieves the value of a specific variable/OID. |
| Read | GetNext |
NMS $\rightarrow$ Agent | UDP 161 | Yes | Discovers the next available OID in the MIB. |
| Read | GetBulk |
NMS $\rightarrow$ Agent | UDP 161 | Yes | Mass-retrieval of multiple variables (Introduced in v2). |
| Write | Set |
NMS $\rightarrow$ Agent | UDP 161 | Yes | Changes the value of a variable (e.g., changing an IP address). |
| Notification | Trap |
Agent $\rightarrow$ NMS | UDP 162 | No | Alerts the NMS of an event. No response is expected. |
| Notification | Inform |
Agent $\rightarrow$ NMS | UDP 162 | Yes | Alerts the NMS of an event. Expects a Response (ACK). |
| Response | Response |
Agent $\rightarrow$ NMS | UDP 162 | Yes | Acknowledges Get, Set, and Inform messages. |
Things to note:
- UDP 161: SNMP Agents listen here for management requests.
- UDP 162: SNMP Managers (NMS) listen here for notifications.
- Trap vs. Inform:
Trapis considered unreliable because it uses UDP and does not wait for an acknowledgment. If the packet is dropped, the NMS never knows.Informis reliable because the NMS must reply with aResponsemessage.
Basic SNMP Configuration (SNMPv2c)
While detailed SNMP configuration is not strictly required for the CCNA, understanding the basic IOS commands is highly beneficial.
! 1. Optional: Define device contact and location information
Router(config)# snmp-server contact "Admin Team - admin@example.com"
Router(config)# snmp-server location "Building A, Server Room 1"
! 2. Define Community Strings (Passwords)
! RO = Read Only (Can use Get, GetNext, GetBulk)
Router(config)# snmp-server community Jeremy1 RO
! RW = Read/Write (Can use Get AND Set)
Router(config)# snmp-server community Jeremy2 RW
! 3. Specify the NMS (SNMP Server) IP and assign a community string to it
! This restricts the NMS to only use the 'Jeremy1' (RO) string
Router(config)# snmp-server host 192.168.1.1 version 2c Jeremy1
! 4. Enable specific Traps to be sent to the NMS
Router(config)# snmp-server enable traps snmp linkdown linkup
Router(config)# snmp-server enable traps config
Things to note:
- The default community strings in Cisco IOS are
public(RO) andprivate(RW). Never use these in production as they are universally known by attackers. - When viewing SNMPv2c packets in Wireshark, the community string and the payload are visible in plain text.
Summary of IOS Commands
! Optional Device Information
snmp-server contact <text>
snmp-server location <text>
! Community Strings (Passwords)
snmp-server community <string> ro
snmp-server community <string> rw
! Define SNMP Host (NMS) and Version
snmp-server host <ip-address> version <1 | 2c> <community-string>
! Enable Traps
snmp-server enable traps [feature] [specific-trap]
snmp-server enable traps snmp linkdown linkup
snmp-server enable traps config