5

I am trying to specify the port when I am sending a trap via snmptrap. Just in order to test my SNMP receiver I want to send traps to it, but I do not have access to port 162. How do I send the trap to another port?

As I see it the man-page does not describe this option.

(I do not fully understand what the parts of a snmptrap message is either, so if someone feels like explaining that it would be nice to)

Jolta
  • 2,620
  • 1
  • 29
  • 42
Atonic
  • 509
  • 1
  • 5
  • 14

1 Answers1

7

In the net-snmp command line tools, you specify the port number in the host identifier, like so:

192.168.1.12:162

At least, that works on my machine.

I agree that this is not really apparent from the man page of snmptrap, so I understand why you couldn't figure it out. The rest of the format is, however, described in the man page to a somewhat satisfactory extent.

Edit: As was pointed out in the comment, the address format is described on the man page for snmpcmd: http://www.net-snmp.org/docs/man/snmpcmd.html

Jolta
  • 2,620
  • 1
  • 29
  • 42
  • 1
    Questioner needs to read man-page for 'snmpcmd' which is for "Options and behaviour common to most of the Net-SNMP command-line tools" E.g. hostname[:port] is described in there. – k1eran Jun 15 '14 at 22:37