# Not able to send IPv6 SNMP trap

**URL:** <https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724>\
**Category:** CDB and CDB API\
**Created:** [June 29, 2021, 11:46pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724 "2021-06-29T23:46:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![padma](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@padma](https://dmap-community.ductus.global/u/padma)\
**Post date:** [June 29, 2021, 11:46pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/1 "2021-06-29T23:46:38Z")

</div>

Hi,  
On my device, I have configured the SNMP trap receiving host as IPv6. But not able to receive any traps on the IPv6 host. IPv4 works fine.

developer logs shows the following error  
 28-Jun-2021::22:20:32.038 confd[549]: devel-snmpa cannot send message to FD49:B785:906:FAB0:9999::9A5:162: address family not supported by protocol family

Our OS supports ipv6 no issue with that. strace shows entries for IPv4 but not for IPv6.

snmp.log, has an entry for IPv6  
 29-Jun-2021::23:24:37.939confd[392]: snmp snmpv2-trap reqid=2021799458 FD49:B785:906:FAB0:9999::9A4:162 (TimeTicks sysUpTime=1842217)(OBJECT IDENTIFIER s…

Please let me know what is the reason for confd not able to send IPv6 traps.

Thanks,  
Padma

---

<div class="post-metadata">

**Author:** ![padma](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@padma](https://dmap-community.ductus.global/u/padma)\
**Post date:** [June 30, 2021, 11:27pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/2 "2021-06-30T23:27:08Z")

</div>

Found the issue. The reason is SNMP agent source addres is IPv4 and target address is IPv6. Due to this mismatch, it’s failing to send v6 trap.  
But want to know how to solve this issue.  
we call confd\_notification\_set\_snmp\_src\_addr api to bind to either IPv4 or IPv6 address as source address. And this is done only once.  
So if multiple snmp target addresses are configured with a mix of IPv4 and IPv6, and since the source address can be either of them, how does the confd snmpagent send traps to all the IPv4 and IPv6 hosts?

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [July 1, 2021, 11:24am UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/3 "2021-07-01T11:24:15Z")

</div>

You can call confd\_notification\_set\_snmp\_src\_addr() as many times as you want. So you can change the source address at any time.  
Or you can create two notification contexts (e.g. nctx\_ipv4 and nctx\_ipv6) using the confd\_register\_snmp\_notification() function. One for IPv4 and the other for IPv6. Then call confd\_notification\_send\_snmp() using either of the two notification contexts.

---

<div class="post-metadata">

**Author:** ![padma](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@padma](https://dmap-community.ductus.global/u/padma)\
**Post date:** [July 1, 2021, 4:23pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/4 "2021-07-01T16:23:24Z")

</div>

Thanks for your reply.

I hope calling confd\_notification\_set\_snmp\_src\_addr API as many time as we want shouldn’t cause any performance effect. If we want to use this approach, before calling confd\_notification\_send\_snmp API, we need to call confd\_notification\_set\_snmp\_src\_addr for both IPv4 and IPv6 to change the source address, right?

else we want to follow the 2nd approach  
“Or you can create two notification contexts (e.g. nctx\_ipv4 and nctx\_ipv6) using the confd\_register\_snmp\_notification() function. One for IPv4 and the other for IPv6. Then call confd\_notification\_send\_snmp() using either of the two notification contexts.”

With this we will not be calling “confd\_notification\_set\_snmp\_src\_addr” API right? If we don’t call this API, then while sending the trap, source port always shows as ‘161’ which is reserved for SNMP requests. While sending traps, we want the source port to be transient port not fixed port.

By defining these 2 contexts nctx\_ipv4 and nctx\_ipv6, how does confd\_notification\_send\_snmp API would know source address type? Can you provide more info on this.

confd\_register\_snmp\_notification(dctx, workersock,  
notify\_name, “nctx\_ipv4”, &nctx);  
confd\_register\_snmp\_notification(dctx, workersock,  
notify\_name, “nctx\_ipv6”, &nctx)

confd\_notification\_send\_snmp(nctx, “linkDown”, &vb[0], 3);

---

<div class="post-metadata">

**Author:** ![cohult](https://yyz2.discourse-cdn.com/flex010/user_avatar/dmap-community.ductus.global/cohult/32/221_2.png) [@cohult](https://dmap-community.ductus.global/u/cohult)\
**Post date:** [July 2, 2021, 12:27pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/5 "2021-07-02T12:27:12Z")

</div>

> [@padma](#):
>
> If we want to use this approach, before calling confd\_notification\_send\_snmp API, we need to call confd\_notification\_set\_snmp\_src\_addr for both IPv4 and IPv6 to change the source address, right?

Right.

> [@padma](#):
>
> With this we will not be calling “confd\_notification\_set\_snmp\_src\_addr” API right?

You will need to call `confd_notification_set_snmp_src_addr()` to set the IP address for each of the two contexts.  
I believe that the benefit of the latter approach is that you only need to set the source address once for the two contexts. With the first approach, I believe you will have to set the source address at least each time you change between sending with an IPv4 and IPv6 source address. Not an issue, so it is up to you.

> [@padma](#):
>
> While sending traps, we want the source port to be transient port not fixed port.

You cannot configure the source port to something other than the port that the ConfD SNMP agent listens to.  
The SNMP agent in ConfD uses the same socket to send traps. This is probably an optimization, to avoid open a new UDP socket each time a trap is sent.

---

<div class="post-metadata">

**Author:** ![padma](https://avatars.discourse-cdn.com/v4/letter/p/ecc23a/32.png) [@padma](https://dmap-community.ductus.global/u/padma)\
**Post date:** [July 2, 2021, 4:52pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/6 "2021-07-02T16:52:11Z")

</div>

Regarding having 2 context, would the following code work?

if (confd\_register\_snmp\_notification(dctx, workersock,  
notify\_name, “nctx\_ipv4”, &nctx) == CONFD\_ERR)  
confd\_fatal(“Failed to register snmp notification \n”);  
if (confd\_register\_snmp\_notification(dctx, workersock,  
notify\_name, “nctx\_ipv6”, &nctx) == CONFD\_ERR)  
confd\_fatal(“Failed to register snmp notification \n”);

for IPv4 address  
confd\_notification\_set\_snmp\_src\_addr(nctx, &src);  
for IPv6 address  
confd\_notification\_set\_snmp\_src\_addr(nctx, &src);

confd\_notification\_send\_snmp(nctx, “linkUp”, &vb[0], 3);

---

<div class="post-metadata">

**Author:** ![yogevc](https://avatars.discourse-cdn.com/v4/letter/y/8491ac/32.png) [@yogevc](https://dmap-community.ductus.global/u/yogevc)\
**Post date:** [November 10, 2025, 12:28pm UTC](https://dmap-community.ductus.global/t/not-able-to-send-ipv6-snmp-trap/3724/7 "2025-11-10T12:28:14Z")

</div>

@padma - did you manage to solve it?
