My Linux machine has both IPv4 and IPv6 (dual stack).
When I define trap listener (SNMP class) as IPv4: new DefaultUdpTransportMapping(new UdpAddress(InetAddress.getByName(IPv4),162)), listener not receives traps sent to IPv6 address.
And vice versa, when I define listener as IPv6: new DefaultUdpTransportMapping(GenericAddress.parse(“udp:[”+IPv6+"]/162")), listener not receives traps sent to IPv4 address.
I have tried to define two transport mappings (IPv4 and IPv6) into the same MessageDispatcher and initialize Snmp object with such MessageDispatcher :
MessageDispatcher mtDispatcher = new MultiThreadedMessageDispatcher(threadPool, new MessageDispatcherImpl()); mtDispatcher.addTransportMapping(transportIPv6); mtDispatcher.addTransportMapping(transportIPv4); snmp = new Snmp(mtDispatcher);
But this solution also not works.
I should receive both traps from different senders registered on different IP types of my Linux machine.
If somebody knows right solution, please, advise.
Thank you in advance.