I am new to SNMP. When sending an SNMP trap, does the agent need to know the port number of the receiver? Or it only needs to know the receiver's IP address? and the receiver should specify agent's ip + port when it subscribes?

2

Best Answer


When SNMP traps are sent, usually the port that managers listen to is 162. It may happen that the port is different, but that's often for very precise purposes. But yes the agent needs to know the port of the receiver. For the IP address, yes the agent needs to know the IP address of the manager. (When I say manager here I'm talking receiver).

And the receiver should "know" the sender's IP in way that he needs to authorize him to send traps to him. This if often done in config.

I don't know what you're currently using, but Net-Snmp is a great tool to learn about SNMP.

Hope this helps

By default SNMP traps are monitored at port 162 and no device wants to be different. Unless you are dealing with non standard device or weird scenarios you should stick to such a port.