smolarek999
smolarek999

Reputation: 519

snmptrap SNMPv3 with selected client ip address

I would like to send trap and specify clientaddress

As I search there is two ways:

  1. edit /etc/snmp/snmp.conf and set: clientaddr [IP_OF_DEVICE]
  2. specify IP as parameter: --clientAddr="[IP_OF_DEVICE]"

When i try to issue command:

snmptrap -v 3 -l noAuthNoPriv -u SomeUser -n "" AGENT_IP .1.3.6.1.4.1.161.5.2 .1.3.6.1.4.1.161.1.2.3.4 5

It gives an error

getaddrinfo(AGENT_IP, NULL, ...): Address family for hostname not supported

When I not specify clientadress it works as expected but it use IP of the machine where I issed a command as a client IP

Upvotes: 3

Views: 1575

Answers (1)

smolarek999
smolarek999

Reputation: 519

To get rid of this I have to:

  • Define virtual interface for ip of device which you want to simulate
  • Specify protocol of agent ( by default when I set clientaddr in /etc/snmp/snmp.conf it looks like it tried to use IPv6 for agent )

    snmptrap -v 3 -l noAuthNoPriv -u SomeUser -n "" udp:AGENT_IP ...

Upvotes: 1

Related Questions