IPv6 send is not working in pysnmp when snmpwalk is being run through IPv6 from external servers

33 Views Asked by At

So I have an agent implemented in past that is facing the issue. When I have 2 servers joined in a cluster, the publisher server cannot serve polling on IPv6. Running polling on IPv6 works locally on publisher but not externally. It does work externally for subscriber server in the cluster. Here is my code for nmsagent implementation.


class SNMPAgent(BaseSNMPAgent):

    SNMP_AGENT_PORT = 1161

    def __init__(self):

        BaseSNMPAgent.__init__(self)

        self._build_transport()
        self._build_access()
        self._build_context()

    def _build_transport(self):
        ''' Open a UDP socket for SNMP requests '''
        
        # UDP over IPv4
        config.addTransport(self._snmp_engine, udp.domainName, udp.UdpTransport().openServerMode((BaseSNMPAgent.SNMP_AGENT_SRC, 
                                                           SNMPAgent.SNMP_AGENT_PORT)))

Do I need to implement transport separately for IPv6. What could be some potential solutions to address this. The issue is it does go through 1st object in my system mib but keeps looping through it and hence the snmpwalk times out.

1

There are 1 best solutions below

1
Lex Li On

Do I need to implement transport separately for IPv6

Yes. The official sample already illustrates that,

https://github.com/lextudio/pysnmp/blob/v6.0.9/examples/v3arch/asyncio/agent/cmdrsp/listen-on-ipv4-and-ipv6-interfaces.py

BTW, not sure from where you got BaseSNMPAgent but that's not part of PySNMP. To create an agent with PySNMP, you should follow

https://github.com/lextudio/pysnmp/blob/v6.0.9/tests/agent_context.py