1) When both IPv4 and IPv6 enabled on the Linux machine IPv4 traps are sending out through default route instead of interface ip which is present in snmp.conf file.
2) IPv6 Traps are displaying send and receive addresses are same.
-bash-4.0# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:27:C9:0D
inet addr:10.36.106.11 Bcast:10.36.255.255 Mask:255.255.0.0
inet6 addr: 2620:10a:6000:2500:20c:29ff:fe27:c90d/64 Scope:Global
inet6 addr: fe80::20c:29ff:fe27:c90d/64 Scope:Link
inet6 addr: 2620:10a:6000:2500:19f0:8684:9663:7c2/64 Scope:Global
inet6 addr: 2620:10a:6000:2500::6a0b/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44552 errors:0 dropped:30 overruns:0 frame:0
TX packets:854 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7460325 (7.1 MiB) TX bytes:1380124 (1.3 MiB)
eth1 Link encap:Ethernet HWaddr 00:0C:29:27:C9:17
inet addr:10.35.106.11 Bcast:10.35.255.255 Mask:255.255.0.0
inet6 addr: 2620:10a:6000:2400::6a0b/64 Scope:Global
inet6 addr: fe80::20c:29ff:fe27:c917/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11028134 errors:0 dropped:7326 overruns:0 frame:0
TX packets:14555 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:663357568 (632.6 MiB) TX bytes:16630250 (15.8 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:50034 errors:0 dropped:0 overruns:0 frame:0
TX packets:50034 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:37157123 (35.4 MiB) TX bytes:37157123 (35.4 MiB)
-bash-4.0#
-bash-4.0# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.35.0.1 0.0.0.0 UG 0 0 0 eth1
10.35.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
10.36.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
-bash-4.0#
-bash-4.0# cat /etc/snmp/snmpd.conf
com2sec ConfigUser
com2sec6 ConfigUser
group ConfigGroup v1 ConfigUser
group ConfigGroup v2c ConfigUser
view everything included .1
access ConfigGroup "" any noauth exact everything none none
agentxsocket tcp:localhost:705
master agentx
agentXRetries 0
agentXTimeout 300
agentuser snmp
agentgroup snmp
[snmp] clientaddr 10.36.106.11
[snmp] clientaddr 2620:10a:6000:2500::6a0b
sysname snmptest.com
sysservices 72
trap2sink 10.120.21.214 public
trap2sink 2620:10a:6000:7814::4ee public
dontLogTCPWrappersConnects true
-bash-4.0#
-bash-4.0# cat /etc/snmp/snmp.conf
clientaddr 10.36.106.11
clientaddr 2620:10a:6000:2500::6a0b
-bash-4.0#
bash-4.0#
bash-4.0# snmptrapd udp6:162,udp:162 -f -C -c /etc/snmp/snmptrapd.conf -Le
NET-SNMP version 5.7.2.1
2019-01-22 05:49:15 <unknown> [UDP: [10.35.106.11]:39663->[10.120.21.214]:162]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5071800) 14:05:18.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:15 UDP/IPv6: [2620:10a:6000:2500::6a0b]:37134 [UDP/IPv6: [2620:10a:6000:2500::6a0b]:37134]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5071800) 14:05:18.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:19 <unknown> [UDP: [10.35.106.11]:35128->[10.120.21.214]:162]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072100) 14:05:21.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:19 UDP/IPv6: [2620:10a:6000:2500::6a0b]:51146 [UDP/IPv6: [2620:10a:6000:2500::6a0b]:51146]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072100) 14:05:21.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:22 <unknown> [UDP: [10.35.106.11]:57939->[10.120.21.214]:162]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072400) 14:05:24.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:22 UDP/IPv6: [2620:10a:6000:2500::6a0b]:36524 [UDP/IPv6: [2620:10a:6000:2500::6a0b]:36524]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072400) 14:05:24.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:24 <unknown> [UDP: [10.35.106.11]:39739->[10.120.21.214]:162]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072600) 14:05:26.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
2019-01-22 05:49:24 UDP/IPv6: [2620:10a:6000:2500::6a0b]:55312 [UDP/IPv6: [2620:10a:6000:2500::6a0b]:55312]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072600) 14:05:26.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'</unknown></unknown></unknown></unknown>
There is only possible to specify 1(one) clientaddr. It's either have to be one IPv4 OR one IPv6.
I think that a solution would be to introduce a "clientaddr6" configuration, but it's not there today.
Thanks a lot Anders Wallin .
Is there any patch for this issue: IPv6 Traps are displaying send and receive addresses are same.
log:
2019-01-22 05:49:24 UDP/IPv6: [2620:10a:6000:2500::6a0b]:55312 [UDP/IPv6: [2620:10a:6000:2500::6a0b]:55312]:
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (5072600) 14:05:26.00 SNMPv2-MIB::snmpTrapOID.0 = OID: SNMPv2-MIB::snmpTrapOID SNMPv2-MIB::sysName.0 = STRING: 'Test trap'
Last edit: Suresh 2019-01-22
Note "clientaddr6" does not exist. If you updated the config it will only mean the you only have one clientaddr and that is the IPv4 address.
In 5.7.3 and 5.8 it's only printing a from address. e.g.
I have not tried 5.7.2.1
Starting in net-snmp 5.8, you can configure as follows:
You can specify a source address on a trap2sink or trapsess configuration line with "-s".
Hi @fenner,
i did upgrade to net-snmp 5.8 and still not seeing this option "-s" for trap2sink.
can you please let me know which version has this option.
The option "-s" for trap2sink was added in https://github.com/net-snmp/net-snmp/commit/df26f8f2d51409827a3ce131c1b9de67d01ee6e5 - you can see "else if (strcmp(sp, "-s") == 0)" was added in that commit. This commit was included in net-snmp 5.8.
What happens when you try to use "-s"?
(It was never added to the documentation, either the man page or the usage message, but it exists)