Rudimentary NMS Software Components (Chapter 7)

Download Report

Transcript Rudimentary NMS Software Components (Chapter 7)

Rudimentary NMS Software Components
(Chapter 7)
Network Management, MIBs, and MPLS
Stephen B. Morris
Revised Spring 2006
Rudimentary NMS Software
Components
1
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
Revised Spring 2006
Rudimentary NMS Software
Components
2
Building a Rudimentary Management
System

Minimum Required Components




SNMP manager
Management Information Bases (MIBs)
Database
SNMP agents
Revised Spring 2006
Rudimentary NMS Software
Components
3
Configuring SNMP on
Windows 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
Revised Spring 2006
Rudimentary NMS Software
Components
4
Configuring SNMP on
Windows 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
Revised Spring 2006
Rudimentary NMS Software
Components
5
Setup Required for the
Visual 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
Revised Spring 2006
Rudimentary NMS Software
Components
6
Building the Sample
Visual 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
Revised Spring 2006
Rudimentary NMS Software
Components
7
Building the Sample
Visual C++ SNMP Manager
The 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
Revised Spring 2006
Rudimentary NMS Software
Components
8
Building the Sample
Visual C++ SNMP Manager
Structure of the Sample Program

Supports the following operations





GET
GETNEXT
SET
WALK
TRAP
Revised Spring 2006
Rudimentary NMS Software
Components
9
Using the
Rudimentary Management System
Basic Architecture
Revised Spring 2006
Rudimentary NMS Software
Components
10
Using the
Rudimentary Management System
An SNMP GET
Revised Spring 2006
Rudimentary NMS Software
Components
11
Using the
Rudimentary Management System
An SNMP GETNEXT
Revised Spring 2006
Rudimentary NMS Software
Components
12
Using the
Rudimentary Management System
An SNMP SET
Revised Spring 2006
Rudimentary NMS Software
Components
13
Using the
Rudimentary Management System
An SNMP TRAP
Revised Spring 2006
Rudimentary NMS Software
Components
14
Using the
Rudimentary Management System
Combining 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
Revised Spring 2006
Rudimentary NMS Software
Components
15
Using the
Rudimentary Management System
A 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
Revised Spring 2006
Rudimentary NMS Software
Components
16
Using the
Rudimentary Management System
Security Failure and Associated Actions
Revised Spring 2006
Rudimentary NMS Software
Components
17
Using the
Rudimentary Management System
Security Violations and Retries
Revised Spring 2006
Rudimentary NMS Software
Components
18
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
Revised Spring 2006
Rudimentary NMS Software
Components
19
The Sample JDMK
Java 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
Revised Spring 2006
Rudimentary NMS Software
Components
20
The Sample JDMK
Java SNMP Manager
Installing 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
Revised Spring 2006
Rudimentary NMS Software
Components
21
The Sample JDMK
Java SNMP Manager
Installing 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)
Revised Spring 2006
Rudimentary NMS Software
Components
22
Building the Sample
Java 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
Revised Spring 2006
Rudimentary NMS Software
Components
23
Building the Sample
Java Manager
To 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
Revised Spring 2006
Rudimentary NMS Software
Components
24
Building the Sample
Java Manager
An SNMP GET
Revised Spring 2006
Rudimentary NMS Software
Components
25
Building the Sample
Java Manager
An SNMP GETNEXT
Revised Spring 2006
Rudimentary NMS Software
Components
26
Building the Sample
Java Manager
The 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
Revised Spring 2006
Rudimentary NMS Software
Components
27
Building the Sample
Java Manager
The 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
Revised Spring 2006
Rudimentary NMS Software
Components
28
Building the Sample
Java Manager
Comparing the Visual C++ and JDMK 4.2
APIs
Revised Spring 2006
Rudimentary NMS Software
Components
29
Ways to Improve the Two Sample
Programs




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
Revised Spring 2006
Rudimentary NMS Software
Components
30
Ways to Improve the Two Sample
Programs (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
Revised Spring 2006
Rudimentary NMS Software
Components
31
Ways to Improve the Two Sample
Programs (continued)



Allow table-based operations
Provide an external data sourse other than the command
line
Support SNMPv3
Revised Spring 2006
Rudimentary NMS Software
Components
32
Extending the Sample
SNMP 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
Revised Spring 2006
Rudimentary NMS Software
Components
33
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/)
Revised Spring 2006
Rudimentary NMS Software
Components
34
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
Revised Spring 2006
Rudimentary NMS Software
Components
35