380 likes | 1.05k Views
Rudimentary NMS Software Components (Chapter 7). Network Management, MIBs, and MPLS Stephen B. Morris. Overview. How to build and use Simple Network Management Protocol (SNMP) code components Two commercial Application Programming Interfaces (APIs) Microsoft Visual C++ version 6.0
E N D
Rudimentary NMS Software Components(Chapter 7) Network Management, MIBs, and MPLS Stephen B. Morris Rudimentary NMS Software Components
Overview • How to build and use Simple Network Management Protocol (SNMP) code components • Two commercial Application Programming Interfaces (APIs) • Microsoft Visual C++ version 6.0 • Sun Microsystems Java Development Management Kit (JDMK) version 4.2 Rudimentary NMS Software Components
Building a Rudimentary Management System • Minimum Required Components • SNMP manager • Management Information Bases (MIBs) • Database • SNMP agents Rudimentary NMS Software Components
Configuring SNMP onWindows NT/2000/XP • Windows NT • If the SNMP Service is already installed: • Click Start-Settings-Control Panel • Select Services and scroll down to the SNMP Service • If the SNMP Service is not installed: • Double click the Control Panel icon and select the Services tab • Click the Add button and the scroll down to the SNMP Service and then click OK Rudimentary NMS Software Components
Configuring SNMP onWindows NT/2000/XP (continued) • Windows 2000/XP • If the SNMP Service is already installed: • Double click the Control Panel Administrative Tools icon and select the Services tab • Right click on the SNMP Service and select the Properties option • If the SNMP Service is not installed: • Double click the Control Panel icon and select the Add Remove Programs tab • Click the Add/Remove Windows Components button and the scroll down to the Management and Monitoring Tools and then click Details • Check the box next to Simple Network Management Protocol and click OK Rudimentary NMS Software Components
Setup Required for theVisual C++ Program • Supplied software was tested in the following environments • Windows NT Workstation Version 4.00 Build 1381 Service Pack 6a • Windows 2000 Version 5.0.2195 Service Pack 2 Build 2195 Rudimentary NMS Software Components
Building the SampleVisual C++ SNMP Manager • Get.bat – Executes single SNMP GET • Set.bat – Executes single SNMP SET • Walk.bat – Walks a specified agent MIB table • Gettraps.bat – Prepares program for receiving traps • Getnext.bat – Executes single SNMP getNext • snmpdefs.h – Header file • snmpmgr.c – C code • snmpmgr.exe – Executable Rudimentary NMS Software Components
Building the SampleVisual C++ SNMP ManagerThe Source Code Components • snmpdefs.h and snmpmgr.c provide the codebase • snmpdefs.h is comprised of three main sections • Symbolic constants for SNMP operations • Global variables • Available function calls Rudimentary NMS Software Components
Building the SampleVisual C++ SNMP ManagerStructure of the Sample Program • Supports the following operations • GET • GETNEXT • SET • WALK • TRAP Rudimentary NMS Software Components
Using theRudimentary Management SystemBasic Architecture Rudimentary NMS Software Components
Using theRudimentary Management SystemAn SNMP GET Rudimentary NMS Software Components
Using theRudimentary Management SystemAn SNMP GETNEXT Rudimentary NMS Software Components
Using theRudimentary Management SystemAn SNMP SET Rudimentary NMS Software Components
Using theRudimentary Management SystemAn SNMP TRAP Rudimentary NMS Software Components
Using theRudimentary Management SystemCombining the Batch Files • These batch files can be chained together • For example, a SET followed by a GET • A real NMS uses this type of logic to create rich sets of functions Rudimentary NMS Software Components
Using theRudimentary Management SystemA Security Violation • Security is increasingly important in network management • Two actions a remote agent should take upon receiving an incorrect community string • Discard the message so that no reply occurs • Emit an authenticationFailure(4) trap Rudimentary NMS Software Components
Using theRudimentary Management SystemSecurity Failure and Associated Actions Rudimentary NMS Software Components
Using theRudimentary Management SystemSecurity Violations and Retries Rudimentary NMS Software Components
A Note On Security • Types of network attacks • Hacking • Denial of Service • Message interception • Message modification • Message replay • Protection must be provided at all levels Rudimentary NMS Software Components
The Sample JDMKJava SNMP Manager • Evaluation copies of JDMK toolkit can be downloaded from Sun Microsystems • The code used for this example implements the following SNMP requests • GetRequest • GetNext Rudimentary NMS Software Components
The Sample JDMKJava SNMP ManagerInstalling JDMK • Install the Java Development Kit (JDK). Text example used Java 2 SDK Standard Edition v1.3.1_02 • Install JDMK. Text example used JDMK 4.2 for JDK 1.1.8 and for Java 2 Platform • Run Setup.bat • Extracts JDMK class files • jdmk42_nt-12.class • jdmk42_nt_11.class Rudimentary NMS Software Components
The Sample JDMKJava SNMP ManagerInstalling JDMK (continued) • Set environment variables. Text examples shown below • JDMKPATH=C:\Program Files\SUN\Wjdmk\jdmk4.2\1.2 • PATH=%JDMKPATH%\bin;C:\jdk1.3.1_02\bin • CLASSPATH=%JDMKPATH%\lib\collections.jar;%JDMKPATH%\lib\jdmkrt.jar;%JDMKPATH%\lib\jdmktk.jar; • Ensure SNMP agent has two configured community strings • public (read-only) • private (read-write) Rudimentary NMS Software Components
Building the SampleJava Manager • mib_II.txt – Contains the definition of the MIB II standard objects • SynchronousManager.java – Contains the Java class that sends either and SNMP GET or getNext message • Get.bat – Executes single SNMP GET • GetNext.bat – Executes single SNMP getNext Rudimentary NMS Software Components
Building the SampleJava ManagerTo Build the Java Program • Two commands are required • mibgen –mo –d . mib_II.txt • This builds a file called RFC1213_MIBOidTable.java • javac –d . *.java • Creates the bytecode file SynchronousManager.class Rudimentary NMS Software Components
Building the SampleJava ManagerAn SNMP GET Rudimentary NMS Software Components
Building the SampleJava ManagerAn SNMP GETNEXT Rudimentary NMS Software Components
Building the SampleJava ManagerThe Structure of the Synchronous Manager • Simple. All of the code is contained in one file that also contains a Java class • Operation • Command line options are validated • Required operation is recorded • API is prepared for making SNMP calls • SNMP request is executed • Exceptions are caught in a try/catch block Rudimentary NMS Software Components
Building the SampleJava ManagerThe Synchronous Manager • JDMK API provide synchronous and asynchronous operation • Production standard NMS needs to be asynchronous. It could be synchronous if it used multiple threads • Book examples are synchronous for simplicity Rudimentary NMS Software Components
Building the SampleJava ManagerComparing the Visual C++ and JDMK 4.2 APIs Rudimentary NMS Software Components
Ways to Improve the Two SamplePrograms • Make operations asynchronous • Move parameters off the command line or encrypt them • Make the programs independent of MIB object specifications • Provide a facility for adding support for new MIBS Rudimentary NMS Software Components
Ways to Improve the Two SamplePrograms (continued) • Allow multiple OIDs in one PDU • Move all SNMP API code into a separate module or a separate server • Remove global variables • Provide a non-debug version of the C++ program Rudimentary NMS Software Components
Ways to Improve the Two SamplePrograms (continued) • Allow table-based operations • Provide an external data sourse other than the command line • Support SNMPv3 Rudimentary NMS Software Components
Extending the SampleSNMP Programs • Utilize distinct or possibly distributed components • Fault server • Configuration server • Accounting server • Performance server • Security server • Straight-forward to build a complex system once basic agent and management entities are in place Rudimentary NMS Software Components
Selected Bibliography • Microsoft Visual C++ • Link to Microsoft Visual C++ (http://msdn.microsoft.com/visualc/) • Link to SNMP Builder for C++ (http://www.hallogram.com/snmpc++/) • Sun Microsystems JDMK • Link to Sun Microsystems JDMK (http://www.sun.com/software/jdmk/) Rudimentary NMS Software Components
Summary • Two simple programs that interact with Windows NT/2000/XP SNMP agents • Visual C++ • Java • SNMP’s process of handling security violations was demonstrated • These programs can be used individually or together as building blocks for more complex systems or a NMS Rudimentary NMS Software Components