SNMP Proxy for Windows Code
Status: Beta
Brought to you by:
alex_b
SNMP Proxy for Windows v0.1 (c) 2005 by Alex Burger Table of Contents ----------------- GENERAL INFORMATION INSTALLATION USAGE SAMPLE CONFIGURATION TROUBLESHOOTING KNOWN LIMITATIONS DISCLAIMER General Information ------------------- SNMP Proxy for Windows is an extension agent for the Microsoft SNMP service which allows the Microsoft SNMP agent to redirect requests for user defined OIDs to another SNMP agent running on the same machine with a different TCP/IP port number, or another machine on the network. SNMP Proxy for Windows allows for multiple OIDs to be redirected to another agent. All OIDs below a defined OID will be proxied to the defined agent. For example, defining .1.3.6.1.4.1.9999 will result in everything below .1.3.6.1.4.1.9999 being proxied. The current home of SNMP Proxy for Windows is http://www.fragit.net/snmppfw Installation ------------ SNMP Proxy for Windows should run on Windows NT 4.0 or higher as it uses the original SNMP API and not WinSNMP. To compile using Microsoft Visual Studio 6.0, the Platform SDK (PSDK) is required. The PSDK can be downloaded from: http://msdn.microsoft.com/downloads/ Compiling should be possible without the PSDK when using Microsoft Visual Studio 2002 or higher. Full installation instructions can be found in the INSTALL file. Usage ----- A registry key under HKLM\SOFTWARE\SNMPPfW\Config\ must be defined for each OID to be proxied. The following values must be defined: AgentAddress AgentCommunity AgentPort ProxyOIDRoot ProxiedOIDRoot Retries TimeOut Note: All entries must be REG_SZ. AgentAddress: IP Address or host name of remote agent. AgentCommunity: Community name for remote agent. AgentPort: Optional port number for remote agent. Defaults to 161. ProxyOIDRoot: Base OID that the Microsoft SNMP agent should listen for. ProxiedOIDRoot: Optional base OID of remote agent. Defaults to ProxyOIDRoot value. Retries: Optional number of times to retry query to remote agent. Defaults to 3. TimeOut: Optional timeout in thousands of a second for requests to the remote agent. Defaults to 2000. The OID of the remote agent can be the same as the source agent, or it can be changed. For example, the ProxyOIDRoot can be set to .1.3.6.1.4.1.9999 and the ProxiesOIDRoot can be set to .1.3.6.1.4.1.77. An SNMP get to .1.3.6.1.4.1.9999.3.6.7 will result in a query to the remote agent using OID .1.3.6.1.4.1.77.3.6.7. Sample configuration -------------------- A sample configuration is provided in the file Registry_Settings_Sample_Config.reg. The sample configuration does the following: - forwards requests for .1.3.6.1.4.1.9999.* to: - host 127.0.0.1 - with community name public - on port 1161 - to OID .1.3.6.1.2.1.1 - with 3 retries - and 2 second timeout To test this configuration, do the following steps. Note: This assumes that Net-SNMP has been installed. 1. Install the binary and registry settings as described in the INSTALL file. A debug version of the DLL is available in the bin folder. 2. Launch another SNMP agent on the same computer such as Net-SNMP but using UDP port 1161. Net-SNMP's snmpd.exe can be started with: snmpd -d localhost:1161 3. Start the Microsoft SNMP service. 4. Test a local snmpget using: snmpget -v 1 -c public localhost .1.3.6.1.2.1.1.1.0 This should return the sysDescr.0 value such as: SNMPv2-MIB::sysDescr.0 = STRING: Hardware: x86 Family 15 Model 12 Stepping 0 AT/AT COMPATIBLE - Software: Windows 2000 Version 5.0 (Build 2195 Uniprocessor Free) 5. Test a local snmpget to the Net-SNMP agent using: snmpget -v 1 -c public localhost:1161 .1.3.6.1.2.1.1.1.0 This should return the sysDescr.0 value such as: SNMPv2-SMI::enterprises.9999.1.0 = STRING: "Windows server1 5.0.2195 Service Pack 4 2000 Server x86 Family 15 Model 12 Stepping 0" As you can see, the format of the sysDescr.0 value is different. 6. Test the proxy using: snmpget -v 1 -c public localhost .1.3.6.1.4.1.9999.1.0 This should query the Microsoft SNMP agent but redirect the request to the Net-SNMP agent and return the following: SNMPv2-SMI::enterprises.9999.1.0 = STRING: "Windows server1 5.0.2195 Service Pack 4 2000 Server x86 Family 15 Model 12 Stepping 0" Troubleshooting --------------- When testing or contributing to the code, it will be useful to run Microsoft's SNMP agent in debug mode. To do this, download the *checked build* of the latest service pack and extract snmp.ex_. You can then expand snmp.ex_ by typing: expand snmp.ex_ snmp.exe To enable debug mode, from a command prompt type: snmp /loglevel:20 /logtype:7 Note: For Windows NT 4.0, use /loglevel:5 /logtype:2 Known limitations ----------------- See BUGS Disclaimer ---------- There is no warranty, expressed or implied, associated with this product. Use at your own risk. Alex Burger <alex_b@users.sourceforge.net>