skip to content

Manager/Agent Architecture

Managers poll agents on UDP 161 and agents send notifications to UDP 162, exposing only objects in their MIB view. Polling versus trap-driven collection is the design trade-off to be ready for.

on this pageshow

questions

5

In SNMP, what do the manager and the agent each do, and which UDP ports carry requests and notifications?

level: juniorimportance: must knowfreq 55%

answer

  1. two roles, traffic in two directions
  2. who asks and who answers
  3. RFC 3411's five application types
  4. requests inbound, notifications outbound
  5. which side listens on which port

basics

~20 s

An SNMP manager sends requests to agents and receives their notifications; the agent on each managed device answers from its managed objects and sends notifications on events. Requests go to the agent on UDP 161, notifications to the manager on UDP 162.

solid answer

~40 s

An SNMP **agent** runs on every managed device: it answers `GetRequest`, `GetNextRequest`, `GetBulkRequest` and `SetRequest` messages against the objects its MIB view exposes, and it originates notifications when something happens on the device. The **manager** (the management station) sends those requests and receives the notifications. RFC 3411 describes both as SNMP entities made of applications: a manager holds a *command generator* and a *notification receiver*, an agent a *command responder* and a *notification originator*, and a *proxy forwarder* relays messages between entities. Over UDP the agent listens on **161** and the manager listens for notifications on **162** (RFC 3417 §3.2, RFC 1157 §4); responses return to whatever source port the manager used. One entity can hold both sets of applications - RFC 3411 calls it a mid-level manager or dual-role entity.

go deeper

for a junior

Recall the two roles and the two ports: the manager asks and listens on 162 for notifications; the agent answers on 161 and can also speak first when something happens.

for a middle

Explain RFC 3411's applications - command generator, command responder, notification originator, notification receiver, proxy forwarder - and map each to the traditional manager and agent, including dual-role entities.

for a senior

Translate the roles into firewall rules and failure modes: which flows each direction needs, what breaks when only 161 is open, and why 161 and 162 are suggested defaults rather than constants.

for a principal

Use the application model to place mid-level managers and proxies in a large estate, weighing summarisation and isolation against extra hops, extra state and another component to secure.

## The two traditional roles SNMP (the Simple Network Management Protocol) splits network management between two kinds of participant: - The **agent** lives on each **managed device** - a switch, router, server or printer. It has access to the device's **management instrumentation**: interface states, counters, configuration values. It answers questions about them and reports events. - The **manager** (also called a **management station**) is the system the operator runs. It asks agents for values, occasionally changes one with a `SetRequest`, and collects the events agents report. The values themselves are **managed objects**, named by OBJECT IDENTIFIERs and defined in MIB modules. The agent never hands out everything it knows: each request is answered from a **MIB view**, the subset of objects that this particular request may see. ## What RFC 3411 actually defines The SNMPv3 architecture (RFC 3411, part of Internet Standard 62) stops talking about "managers" and "agents" as boxes. It defines an **SNMP entity** as an SNMP engine plus one or more **applications**, and names five application types: | Application | What it does | Traditionally part of | |---|---|---| | `command generator` | monitors and manipulates management data by sending requests | manager | | `command responder` | provides access to management data by answering requests | agent | | `notification originator` | initiates asynchronous messages | agent | | `notification receiver` | processes asynchronous messages | manager | | `proxy forwarder` | forwards messages between entities | proxy agent | In RFC 3411's words, an entity with command generator and/or notification receiver applications "has traditionally been called an SNMP manager", and one with command responder and/or notification originator applications "an SNMP agent". The decomposition matters because real systems mix them. ## Ports, and which way the traffic flows The preferred transport mapping is **SNMP over UDP** (RFC 3417 §3), one message per datagram. Two well-known ports appear: 1. **Requests**: the manager sends `GetRequest`, `GetNextRequest`, `GetBulkRequest` or `SetRequest` from an ephemeral source port to the agent's **UDP 161**. 2. **Responses**: the agent's `Response` returns to that ephemeral port. RFC 1157 §4.1 states the rule for SNMPv1: the response is sent *from* the transport address the request was sent *to* - so it leaves from 161. 3. **Notifications**: when something happens - an interface about to go down, a restart - the agent's notification originator sends a trap or inform to the manager's **UDP 162**. RFC 3417 §3.2 words both as suggestions: it is "suggested" that command responders listen on 161 and notification receivers on 162. They are well-known defaults, not protocol constants; an operator may move either, at the price of reconfiguring every manager or every agent's notification target to match. Other transport mappings use other ports: SNMP over TLS and DTLS (RFC 6353) registers **10161** for requests and **10162** for notifications. RFC 3417 also sets a floor on message size: an entity using the UDP mapping must accept messages up to **484 octets**, and RFC 3417 recommends accepting up to 1472. ## Entities that are both Because roles are applications, one entity can hold several: - A **mid-level manager** (RFC 3411's "dual-role entity") runs command generator and notification receiver applications toward the devices below it, and command responder and notification originator applications toward a manager above it - useful for summarising a region before a central station sees it. - A **proxy forwarder** relays requests and notifications to another engine by context, without interpreting the objects inside them (RFC 3413 §1.5); it is how a modern manager can reach a device speaking an older SNMP version. - An **extensible agent** (AgentX, RFC 2741) splits one agent into a master agent and subagents internally, while still looking like one agent to the manager. ## Mistakes worth avoiding - Swapping the ports: 161 is where the *agent* listens; 162 is where the *manager* listens. - Thinking the agent only answers. The notification originator lets it speak first, which is exactly how a manager hears about an event between polls. - Assuming one box is one role. A monitoring server that forwards events upward, or a gateway translating versions, holds both kinds of application. - Opening only 161 on a firewall between the two and then wondering why no notifications arrive.

  • Which UDP flows must a firewall between an SNMP manager and its switches allow?
    Manager ephemeral port to each agent's UDP 161 for requests, plus the agent's response from 161 back to that ephemeral port, which a stateful firewall matches to the request. Agent to the manager's UDP 162 for notifications, and if agents send informs, the manager's acknowledgement back to the agent. SNMP over TLS or DTLS (RFC 6353) uses 10161 and 10162 instead.
  • Are UDP 161 and 162 mandatory in SNMP?
    No. RFC 3417 §3.2 only "suggests" that command responders listen on 161 and notification receivers on 162. They are the well-known defaults every implementation assumes, so moving one means reconfiguring every manager that polls, or every agent's notification target, to match.

saying these in an interview costs you the question

  • The manager listens on UDP 161 and agents send their data to it.
  • Traps are sent to the agent's UDP port 161.
  • An SNMP agent only ever answers; it can never send anything first.
  • One system is either a manager or an agent, never both.
  • SNMP needs a TCP connection between manager and agent for every poll.
open as a page

Monitoring 300 campus switches with SNMP, why poll on a five-minute loop and also take link-down notifications, and what does each one miss?

level: seniorimportance: must knowfreq 35%

basics

~20 s

SNMP polling gives complete, regular data and proves each agent still answers, but sees a failure up to one interval late and misses flaps between polls. Notifications arrive within seconds but only on events and can be lost, so estates use both.

open as a page

An SNMP agent answers noSuchObject for an object its device's MIB module defines; how can the agent's MIB view explain that?

level: middleimportance: should knowfreq 18%

basics

~20 s

An SNMP agent answers each request only from the MIB view selected for that requester. An object outside the view is treated exactly like one that does not exist, so a Get gets noSuchObject or noSuchInstance and a walk skips it.

open as a page

An SNMPv3 manager must monitor a few legacy switches that speak only SNMPv1; what does an SNMP proxy forwarder do, and where should it sit?

level: seniorimportance: should knowfreq 12%

basics

~20 s

An SNMP proxy forwarder (RFC 3413) relays requests and notifications to another SNMP engine by context, without interpreting the objects; under RFC 3584 it also translates versions. Place it next to the SNMPv1 switches, because its downstream leg still carries a cleartext community.

open as a page

In SNMP's AgentX protocol, what do the master agent and its subagents each do, and why does the manager never see the split?

level: middleimportance: nice to knowfreq 7%

basics

~20 s

An AgentX master agent speaks SNMP on the agent's address and enforces access control and MIB views; subagents register MIB regions with it and hold the actual instrumentation. RFC 2741 makes the split invisible: managers see one ordinary agent.

open as a page