Distinguish manager-to-agent requests from agent-to-manager trap notifications.
Which UDP port pairing is appropriate?
SNMP requests target UDP 161; traps and notifications are received on UDP 162.
Detailed explanation
request 162 / trap 161Incorrect. It reverses request and trap ports.
Incorrect. It reverses request and trap ports.
request 161 / trap 514Incorrect. UDP 514 is classic syslog.
Incorrect. UDP 514 is classic syslog.
request 161 / trap 162Correct. SNMP request 161 and trap 162 are the standard mapping.
Correct. SNMP request 161 and trap 162 are the standard mapping.
request 389 / trap 636Incorrect. Those are LDAP and LDAPS ports.
Incorrect. Those are LDAP and LDAPS ports.
Try it yourself
An example you can run in a temporary verification environment.
python3 -c "import socket; print(socket.getservbyname('snmp','udp'), socket.getservbyname('snmptrap','udp'))"Expected result
161 162Key points
- Requests 161
- Traps 162
- Normally UDP
Notes
- Environment: Python 3 socket service database
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.