🎓 BookMCQ
← Back to 27. Network Management

📝 SNMP protocol in computer networks (11 MCQs)

Exchanging Management Information with SNMP

Simple Network Management Protocol (SNMP) allows management applications to monitor and, where permitted, modify information exposed by network devices. It is commonly used with routers, switches, servers and printers. SNMP messages carry protocol data units that refer to managed objects, enabling a manager to request values, change selected settings or receive notifications about device events. It gives administrators a common method for collecting device-level information.

Managers, Agents and Managed Object Identifiers

An SNMP system includes management applications, SNMP engines, managed objects and a management information definition. Object identifiers identify specific values in a MIB. SNMPv1 and SNMPv2c commonly use community strings, while SNMPv3 adds a framework for authentication, privacy and access control. Agents usually receive requests over UDP port 161; notifications commonly use UDP port 162.

Request, Response and Notification Operations

For a read operation, the manager sends a GetRequest PDU naming one or more object identifiers. The agent processes the request and returns a Response PDU with values or an error indication. SetRequest changes writable objects, while traps and informs communicate notifications; informs differ because the receiver acknowledges them. The response is matched using its request identifier.

Example: Reading an Interface Counter Remotely

A monitoring station requests the interface input-octet counter from a switch using its object identifier. The switch's SNMP agent retrieves the current counter and returns it in a Response PDU. The monitoring application stores the value, compares it with a later reading, and estimates incoming traffic during the interval. A later sample allows the manager to calculate a rate.

SNMP Transport and Version-Dependent Security

SNMP complements device command-line administration by providing structured, programmatic access to management data. SMI defines the object descriptions and MIB modules organize them, while ASN.1-based syntax and BER encoding represent values in messages. Secure deployment should prefer SNMPv3 with suitable authentication and privacy settings over exposed community strings. It is especially useful for repeatable, multi-vendor monitoring tasks.

Correcting Misunderstandings About SNMP Behavior

'SNMP carries ordinary user web pages' is incorrect because it carries management messages. 'A trap is always acknowledged' is false; an SNMP trap is unacknowledged, whereas an inform expects a response. 'SNMPv3 is secure without configuration' is mistaken because security level, users, keys and access rules must be set correctly.

SNMP Operations, Versions and Port Questions

Be able to identify Get, GetNext, GetBulk, Set, Response, Trap and Inform operations, and distinguish manager from agent roles. Memorize the common UDP ports 161 and 162, compare SNMPv1, v2c and v3 security, and trace an object identifier from a request into a returned value. Also explain how access permissions limit which objects can be changed.

SNMP Protocol Operation Terms

  • SNMP - Protocol for exchanging network management information.
  • Manager - System initiating management operations.
  • Agent - Device-side SNMP protocol entity.
  • Object identifier - Unique identifier for a managed object.
  • PDU - Structured protocol data unit.
  • Community string - Shared text used by SNMPv1 and v2c.
3
Easy
5
Medium
3
Hard

📝 All SNMP protocol in computer networks MCQs

Q1. If the recv loop terminates because recv returns 0, what does the variable len contain?

A.-1 (error)
B.Unchanged from its initial value
C.0 (no data)
D.The total number of bytes received before the connection closed ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: When recv returns 0 it signals an orderly shutdown by the peer. The loop stops, leaving len as the sum of all bytes accumulated in previous iterations, which represents the total bytes successfully received.

Q2. Which SNMP operation would you use to periodically retrieve the number of bytes processed by this echo server?

A.Use an SNMP SET request on a custom OID
B.Issue an SNMP TRAP when the count changes ✅
C.Perform an SNMP GET request on a custom OID that tracks byte count
D.SNMP cannot monitor runtime counters in this application
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: An SNMP GET request reads the current value of a managed object. By defining a custom OID that the server updates with the byte count, a management station can poll that OID regularly to monitor the server’s traffic volume.

Q3. When walking through a table of active connections, which SNMP request is most appropriate?

A.SNMP GET request for each exact OID
B.SNMP SET request to modify the table
C.SNMP GETNEXT request to retrieve the next entry sequentially ✅
D.SNMP INFORM request for reliable notifications
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: SNMP GETNEXT returns the next OID in lexicographic order, making it ideal for iterating over a table of entries such as active connections. Using GETNEXT avoids needing to know every exact OID in advance, unlike GET which requires a specific OID each time.

Q4. If the bind call fails because the address is already in use, which socket option should be set before bind to allow reuse?

A.SO_REUSEADDR
B.SO_KEEPALIVE ✅
C.SO_LINGER
D.SO_BROADCAST
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The SO_REUSEADDR flag permits a socket to bind to an address that is already in use, typically when a previous instance of the server is in TIME_WAIT state. Setting this option before the bind call prevents the “address already in use” error and enables rapid restarts.

Q5. To send an SNMP trap when a client disconnects unexpectedly, where should the code be inserted?

A.After the send() call that echoes data
B.Before the accept() loop starts
C.Immediately after the recv() loop exits, before close() ✅
D.Inside the error‑handling block for accept()
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: An unexpected client disconnect is detected when the recv() loop ends without receiving further data. Placing trap‑generation code right after this loop (and before closing the socket) ensures the event is captured promptly, allowing the server to notify the manager of the abrupt termination.

Q6. Evaluating the risk of hard‑coding SNMP community strings in the echo server’s source, which statement is most accurate?

A.There is no security risk because community strings are public
B.The risk is moderate; only experienced attackers might exploit it
C.The risk is high; anyone with source access can read the strings and gain unauthorized access ✅
D.The risk exists only if the strings are transmitted without encryption
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Community strings act as passwords for SNMP v1/v2c. Embedding them in source code exposes them to anyone who can view or decompile the binary, enabling unauthorized read or write operations on managed objects, which constitutes a high security vulnerability.

Q7. If the server receives a packet larger than the current maxLen, how does the while loop handle the excess data?

A.The data is truncated and lost
B.The data is split across multiple iterations, each reading up to maxLen ✅
C.A buffer overflow occurs, corrupting memory
D.recv() returns an error and the loop exits
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Each iteration of the loop reads at most maxLen bytes, then updates maxLen and the buffer pointer. When a packet exceeds the remaining buffer capacity, recv() reads only the portion that fits, and the loop continues until the entire packet has been consumed, preventing overflow.

Q8. What security improvement does SNMP v3 provide over SNMP v2c for managing this server?

A.It adds encryption and strong authentication mechanisms ✅
B.It introduces community strings for access control
C.It timestamps each message for replay protection
D.It makes no additional security changes
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: SNMP v3 incorporates user‑based security models that support authentication (e.g., HMAC‑SHA) and privacy (encryption) of messages, addressing the weak, clear‑text community‑string model of v2c. This enhancement protects management traffic for the echo server against eavesdropping and tampering.

Q9. Which statement best describes the typical transport protocol choice for SNMP?

A.SNMP can use both UDP and TCP equally
B.UDP is the default because of its low overhead ✅
C.TCP is preferred for all SNMP messages due to reliability
D.SNMP only operates over TCP
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: SNMP was originally designed to run over UDP, which provides minimal latency and overhead suitable for frequent polling. Although newer versions allow TCP for reliability, the standard and most common deployment still rely on UDP as the transport layer.

Q10. What structure does an OID use to uniquely identify a managed object in SNMP?

A.A hierarchical numeric tree ✅
B.A human‑readable string name
C.An IP address of the device
D.A MAC address of the interface
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Object Identifiers (OIDs) are expressed as a series of numbers separated by dots, forming a hierarchical tree that uniquely identifies each managed object across all devices. This numeric representation enables consistent referencing regardless of vendor or platform.

Q11. What does the acronym SNMP stand for?

A.Simple Network Management Protocol ✅
B.Secure Network Management Procedure
C.System Network Monitoring Protocol
D.Simple Node Management Protocol
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: SNMP stands for Simple Network Management Protocol, a widely used Internet‑standard protocol that enables network devices to be monitored and managed from a centralized location.

🔗 Related Topics (MCQs)