1

I have a SNMP GET timeout issue when trying to get data from an IP on a VPN connection. It seems like the SharpSnmpLib looks for the IP address from the wrong network connection and it times out.

The app is a UWP test to try out Lextm.SharpSnmpLib. I am able to GET a standard OID from 127.0.0.1 but not an IP address over the VPN connection.

Is there some way to direct SharpSnmpLib to use a different network connection or to not use only the default connection?

Here is the code snippet:

 var result = Messenger.Get(VersionCode.V1,
      new System.Net.IPEndPoint("127.0.0.1"), 161),
      new OctetString("public"),
      new List<Variable> { 
            new Variable(new ObjectIdentifier("1.3.6.1.2.1.1.1.0")) },
      6000);

The same code when tried to the router in a VPN connection, "10.192.10.1" fails with a timeout message.

Is there a way to configure SharpSnmpLib to look for the IP address in a different network connection, namely the VPN connection?

  • Manually initialize a `Socket` object to bind to your VPN address, and then pass it to Send methods of the message instance. You cannot use `Messenger` helper methods then, as such methods do not support custom socket objects. – Lex Li Jul 31 '17 at 04:44
  • Thank you Lex Li. I appreciate your quick response. Could you please just add a short snippet on how to "pass it to Send methods of the message instance"? – Daniel Maxwell Jul 31 '17 at 11:05
  • https://github.com/lextm/sharpsnmplib/blob/master/Tests/Integration/DaemonTestFixture.cs#L117 The test case is already there. What you need is to bind this socket to the VPN NIC IP. – Lex Li Aug 01 '17 at 19:09
  • I am sorry, I am not able to bind a socket that works, using the example you provided in the Tests project. I tried various methods of creating an enpoint and binding but either there is a timeout message or an error message that – Daniel Maxwell Aug 06 '17 at 22:15
  • You would have to follow the steps to enable System.NET tracing, https://support.microsoft.com/en-ca/help/947285/how-to-use-system-net-tracing-to-troubleshoot-content-deployment-issue It might show you what exactly happens under the hood. – Lex Li Aug 07 '17 at 17:39

0 Answers0