We are using Net-SNMP and I have setup a "gateway" to run snmptrapd and forward all traps it receives from internal entities to an external managing entity. Everything is working fine except that for SNMP Version 1 traps, the source/host address is displaying as an internal address (it appears to be using the agent-addr field from the SNMP v1 pdu) and not the external address of the "gateway" that initiates the fowarding. For SNMP Version 2 traps/informs, there is no agent-addr field since the pdu has been modified and the traps are being displayed correctly using the external address of the gateway presumably being retrieved from the source field of the IP header.

So I'm wondering how can I have snmptrapd modify the agent-addr field for SNMP Version 1 traps before they get forwarded? I noticed that snmptrapd supports the ability to execute a program when it receives a trap using the traphandle directive. From the best I can gather, I would have to capture all traps and reissue them with the correct agent address for SNMP version 1 traps (I haven't tried this yet, but I'm about to run some tests)? Is there a better way to accomplish the same thing? Is there a way to just modify the agent-addr field for SNMP version 1 traps?