Vxsnmpsimulator Userguide
Vxsnmpsimulator Userguide
April 2015
Version 2.2.x
Verax SNMP Simulator - User Guide 2
Contact Information:
E-mail: [email protected]
Internet:http://www.veraxsystems.com
Technical support:
E-mail: [email protected]
Verax Systems have taken care in the preparation of this publication, but make no expressed or implied
warranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for
incidental or consequential damages in connection with or arising out of the use of the information or
programs contained herein.
All brand names or product names mentioned in this publication are either trademarks or registered
trademarks of their respective owners.
TABLE OF CONTENTS
1 Introduction........................................................................................................................ 7
1.1 System requirements...................................................................................................... 7
2 Installation.......................................................................................................................... 8
2.1 Windows installer ........................................................................................................... 8
8 APPENDIX ........................................................................................................................ 46
8.1 How to configure Virtual IP Address in Windows XP/2000/ME/2003.............................. 46
8.2 How to configure Microsoft Loopback Adapter to work with Verax SNMP Agent Simulator in
Windows 7 ................................................................................................................................ 47
Notation used
Source code, commands, user-entered data, on-screen messages and user interface
elements (menus, choice lists, etc.) are shown using the Courier font.
This notation (Warning) is used to flag actions that can lead to data loss, system
malfunction, etc.
The following logotypes are used to flag information relevant to a particular operating
system:
Microsoft
LINUX Linux WIN Windows
1 Introduction
Verax SNMP Agent Simulator enables simulation of multiple SNMP v1/v2c agents on a
single host. It allows to save money by rapid building of simulated networks without
purchasing additional hardware. Each agent runs on the standard SNMP 161 port with a
different IP address assigned via multi-netting. Agents' responses can be loaded from
bundled configuration files or collected from real devices using SNMP-walk and can be
modified at runtime by user-defined rules.
System requirements:
RAM, processor, and free disk space requirements depend on a variety of factors
including the number of simulated SNMP agents and tier complexity (number of OIDs,
number of modifiers), number of device types (different SNMP record files) as well as
agents pooling frequency. Hardware recommendation for agents of medium complexity
(with approximately 3K OIDs per each agent) are as follows:
2 Installation
2.1 Windows
1. Download and copy the installation package to a temporary directory and run
it:
snmpsimulator-2.2.x-windows-installer.exe
Log in as root, copy the installation .bin file to a temporary directory (e.g. /tmp) and
run it:
Use sudo when running a root shell is not allowed or discouraged (e.g. Ubuntu or
Debian Linux distributions):
sudo ./snmpsimulator-2.2.x-linux-installer.bin
etc/simulator.conf Main configuration file template. The running copy of this file
is located in /etc/verax.d (Linux) or
C:\Windows\etc\verax.d directories (Windows)
If you have a commercial license (allowing to simulate more than 1 device), copy the
simulator-license.lic file to SIMULATOR_HOME/conf and restart the simulator.
Please contact [email protected] to order your license.
3 Managing simulator
3.1 Starting the simulator service
Please note that starting the service initiates the process of loading network
configuration and creating virtual interfaces (if configured). This process may take a
while depending on a number of interfaces and overall performance of a machine
running the simulator. The application log file may be examined to trace the process of
creating a simulated network.
Note that all errors and main activities of the simulator service are logged into
application log file. The log file snmp-simulator-agent.log is located in the
logs directory.
Verax SNMP Agent Simulator provides a CLI console for managing simulator (possibly
running on another host). In order to open the CLI Console:
Verax SNMP Agent Simulator provides a web console for managing simulator through
GUI (possibly running on another host). In order to open the Web Console:
The default connection parameters are 127.0.0.1:43500 (localhost as the host name
and 43500 for TCP port).
3. The most frequently used command is SHOW. This command displays the list of
virtual agents and their statuses.
State Description
Running Agent is up and running, thus able to respond to SNMP queries.
Agent is stopped, not able to respond to SNMP queries.
Agent can be stopped because STOP or STOPALL command was
Agent cannot start because it cannot bind to the interface. Most likely
the problem is related to another process using the specified port
Cannot bind (e.g. port 161 is using by SNMP service). Please use netstat
command to find the process and kill it. Typically, stopping SNMP
service helps solving this issue.
Agent cannot start because it cannot assign requested address to the
interface. Most likely the IP address specified for the agent in the
devices.conf.xml configuration file does not exists. Please verify if the
PRIMARY_INTERFACE in the configuration file points to the existing
network adapter which must be enabled, up and running. This
adapter should be configured with static IP address. If it is
configured to obtain IP address from DHCP server, please change the
No interface configuration in order for the Simulator to automatically assign static
IP address. Also please verify if the Verax SNMP Agent Simulator has
sufficient privileges to assign IP address to this adapter (must be
running with root or administrator privileges). Depending on the
CREATE_INTERFACES parameter in the configuration file, Verax
SNMP Simulator is either assigning IP address to the network adapter
or expecting to be assigned manually.
State Description
Agent has been initialized but not yet started. Please wait a while for
Initialized the agent to start. If agent cannot start, refer to the application log
files for further details.
Agent has been initialized and is ready to start. Please issue
Ready
command START or STARTALL to start the agent.
• Level 1 – for management of device types supported by the simulator (add and
remove device type, start and stop devices). Device type is a group of devices using
the same SNMP record file. Once console is opened, this level is available by default.
• Level 2 – for management of devices (agent instances) under current device type
(start, stop, add, remove devices). To go to this level SELECT command must be
issued at level 1.
A different set of commands is available for each level. In order to see all available
commands for the current level, use HELP command.
Command Description
END Server shutdown (including all device instances).
EXIT Disconnect console from the currently connected server.
SELECT <ID> Select device type identified by <ID> and go to device mode.
SHOW Display the list of all devices (instances) in the simulator.
Start simulation for all devices (of all types). Always issue this
STARTALL
command if you see some devices are not responding.
STOPALL Stop simulation for all devices (of all types).
Remove device type identified by <ID>. All devices of this type
REMOVE <ID>
will be removed.
Add new device type using <FILE> file. To start simulation,
ADD[<FILEPATH>] switch to the device mode (using SELECT) and add a device
instance (using ADD).
Command Description
END Server shutdown (including all device instances).
EXIT Disconnect console from server.
SHOW Display list of devices for the current device type with their details.
BACK Return to type mode.
STARTALL Start simulation of all current device types.
STOPALL Stop simulation of all current device types.
START <ID> Start simulation for a device identified by <ID>.
STOP <ID> Stop simulation for a device identified by <ID>.
REMOVE <ID> Remove a device identified by <ID>.
Add new device(s) without starting them:
<IP RANGE> – a single IP address or a ‘-‘ delimited range of IP
addresses.
<NET MASK> – network mask in IPv4 representation or mask
ADD <IP length.
RANGE> <NET <PORT RANGE> – single port or ‘-‘ delimited port range (port
MASK> <PORT range will be applied for each specified IP address)
RANGE> <STATE> - optional attribute defining initial device state (valid
<STATE> values are RUN, STOP and DISABLED.
For instance:
ADD 192.168.1.100-192.168.1.104 24 135-136
To start simulation of created device(s), issue START <ID> or
STARTALL
• -p <port> – Port number on which the simulator service is listening for console
commands. This argument is optional – the default port value is used if it is not
provided.
• -h <host> – IP address of a host on which the simulator service is running (if not
provided, localhost is assumed).
For example, to run SHOW command in the batch mode on Linux, issue the following
command:
Please note that on Windows simulator.bat does not support batch mode
invocation (full java command has to be used instead).
The configuration file is an XML file containing information about simulated devices. The
following fields are defined for each device (identified by the <device> tag):
• ip – IP address for which the simulator will run simulated devices (defined as
ranges or comma separated values), e.g. "127.0.0.1".
• port – port on which the simulator is listening for SNMP requests. Make sure the
port is not occupied by any other service (e.g. port 161 is typically occupied by
SNMP service).
• filepath – path to SNMP record file (it is recommended to use absolute path).
On Windows, replace all "/" with "\\" in path specifications for a proper operation.
Do not use file and directory names with space (‘ ‘) characters. In essence, the
record files contain SNMP OIDs and response values for the simulated agents.
Please refer to section 6 for details.
The configuration file is organized by device types which are top elements within the
XML structure. For each device type (<type> tag) one or more device instances
(<device>) can be defined. Exemplary XML structure is shown below:
<simulator.veraxsystems.com>
<types>
<type filepath="../device/cisco/cisco4900.txt">
<devices>
</devices>
</type>
</type>
</types>
</simulator.veraxsystem.com>
See section 3 for the detailed information how to stop and start the simulator service.
The simulator requires virtual interfaces to run simulated devices. Each simulated device
has a separate IP address assigned to a separate virtual interface. Virtual interfaces
must be configured before starting the simulator.
Virtual interfaces can be created and removed automatically by the simulator or can be
managed manually.
In order to configure your virtual interfaces, go to the configuration directory and open
the simulator.conf file
WIN C:\Windows\etc\verax.d\simulator.conf
LINUX /etc/verax.d/simulator.conf
In order to allow the simulator to manage virtual interfaces specify the primary physical
interface the simulator will assign virtual IP addresses to. In order to do that, edit the
simulator.conf file and provide the name of an interface in the following line:
PRIMARY_INTERFACE=dev_name
For example, eth0 is used by default for Linux or “Local Area Connection” for
Windows.
Copyright © Verax Systems, April 2015
DL704
Verax SNMP Simulator - User Guide 24
This interface must exist in your system. You can also use a loopback interface with the
simulator (see section 8.2).
CREATE_INTERFACES=0
This option disables the automatic interface creation feature. Before the Simulator is
started, all required IP addresses have to be created manually. See APPENDIX for more
information on how to configure interfaces on Windows.
CREATE_INTERFACES=1 (Recommended)
This option enables the automatic interface creation feature. Make sure that DHCP is
disabled in your network settings for the primary interface. Automatic interface
management requires the primary interface to have a static IP assigned. If your
interface is configured to work with DHCP, use another interface instead, for example
loopback interface. For Windows you can install Microsoft Loopback adapter (for
Windows XP, see http://support.microsoft.com/kb/839013/en-us or section 8.2), assign
static IP address for it and use with the simulator.
CREATE_INTERFACES=2 (Advanced)
This option allows creating interfaces automatically without interfaces removal. This
feature may be used to make the simulator start (or restart) faster, but all interfaces
that are not used will be still available.
2. Add the <group> item containing <ip> sub-items for each IP address used to
interconnect devices, for example:
<groups>
<group key="192.168.240.5:161">
<ip>192.168.240.33/28</ip>
<ip>192.168.240.101/28</ip>
</group>
</group>
Where:
For example, if advanced network configuration file contains the following two groups
(each containing a single device):
<groups>
<group key="192.168.240.5:161">
<ip>192.168.240.33/28</ip>
<ip>192.168.240.101/28</ip>
</group>
<group key="192.168.240.39:161">
<ip>192.168.240.65/28</ip>
</group>
</group>
and SNMP record file for both devices (192.168.240.5 and 192.168.240.39) contains the
following OID definitions:
.1.3.6.1.2.1.4.20.1.1.//^ipa.adr(0)^// = IpAddress:
//^ipa.adr(0)^//
.1.3.6.1.2.1.4.20.1.1.//^ipa.adr(1,192.168.200.100)^// =
IpAddress: //^ipa.adr(1,192.168.200.100)^//
.1.3.6.1.2.1.4.20.1.1.//^ipa.adr(2,104.16.20.13)^// =
IpAddress: //^ipa.adr(2,104.16.20.13)^//
[....]
.1.3.6.1.2.1.4.20.1.3.//^ipa.adr(0)^// = IpAddress:
//^ipa.net(0)^//
.1.3.6.1.2.1.4.20.1.3.//^ipa.adr(1,192.168.200.100)^// =
IpAddress: //^ipa.net(1,255.255.0.0)^//
.1.3.6.1.2.1.4.20.1.3.//^ipa.adr(2,104.16.20.13)^// =
IpAddress: //^ipa.net(2,255.255.255.0)^//
.1.3.6.1.2.1.4.20.1.1.192.168.240.5 = IpAddress:
192.168.240.5
.1.3.6.1.2.1.4.20.1.1.192.168.240.33 = IpAddress:
192.168.240.33
.1.3.6.1.2.1.4.20.1.1.192.168.240.101 = IpAddress:
192.168.240.101
[....]
.1.3.6.1.2.1.4.20.1.3.192.168.240.5 = IpAddress:
255.255.255.0
.1.3.6.1.2.1.4.20.1.3.192.168.240.33 = IpAddress:
255.255.255.240
.1.3.6.1.2.1.4.20.1.3.192.168.240.101 = IpAddress:
255.255.255.240
.1.3.6.1.2.1.4.20.1.1.192.168.240.39 = IpAddress:
192.168.240.39
.1.3.6.1.2.1.4.20.1.1.192.168.240.65 = IpAddress:
192.168.240.65
[....]
.1.3.6.1.2.1.4.20.1.3.192.168.240.39 = IpAddress:
255.255.255.0
.1.3.6.1.2.1.4.20.1.3.192.168.240.65 = IpAddress:
255.255.255.240
.1.3.6.1.2.1.4.20.1.3.104.16.20.13 = IpAddress:
255.255.255.0
Each simulated network device is represented by a set of SNMP objects which are
exposed by the simulator and can be read by external applications (e.g. by network
management system). SNMP objects are kept in files called SNMP record files. Each
SNMP record file contains SNMP objects representing a single device type (e.g. Cisco
switch).
SNMP record file is a plain text file in which each line represents a single SNMP object.
Each line has the following format:
.1.3.6.1.2.1.2.2.1.16.55 = Counter32:
364431835//$c32.tmr(1,0,24,25,1000,0,4294967295)
SNMP record file is a plain text file and can be prepared manually in a text editor. It can
also be prepared based on an actual SNMP agent by copying objects exposed by the
agent to the SNMP record file.
In order to prepare SNMP record file reflecting actual SNMP agent available at given IP
address, use Linux SNMP tools and issue the following command:
Provide the correct read only community string, IP address and file name. Refer to
snmpwalk manual for the details. Please verify if each line in the resulting file contain a
valid record in the format: OID = TYPE: VALUE. If not, which sometimes happens,
correct it manually.
Resulting SNMP record file can then be copied to SNMP record files subfolder
($SIMULATOR_HOME/devices/). It is now ready to be used.
If many devices are simulated based on the same SNMP record file, each device will
expose the same SNMP object values. To differentiate object values, separate SNMP
record files with different values can be created (which often requires a lot of manual
work) or modifiers can be applied.
Modifiers are also useful to define variable SNMP objects (e.g. counters) which return
changing values simulating real-world behavior of a device. Using modifiers requires the
user to familiarize himself with the modifier syntax; however it speeds up the process of
defining simulated devices especially for large networks.
Modifier is an optional element in object definition in SNMP record file that follows the
object value and modifies it.
Pre-loaded modifier – object value is modified upon simulator start when SNMP
record files have been loaded. This modifier generates constant value of object which
will be returned unchanged on every object read operation.
Post-loaded modifier – object value is modified on every object read operation. The
value returned will be different each time it was read. This modifier can be used to
simulate performance counters or other objects representing constantly changing
metrics.
7.2.1 Format
The pre-loaded modifier has the following, general format:
//^type.modifer(args)^//
Where:
• type – type of value returned by modifier (as defined by SMI),
• modifier – type of modifier,
• args – modifier arguments.
For instance:
.1.3.6.1.2.1.1.5.0 = STRING:
"switch//^int.rnd(10,1000)^//.veraxsystems.com_//^int.unq()^//"
.1.3.6.1.2.1.4.20.1.1.//^ipa.adr(0)^// = IpAddress:
//^ipa.adr(0)^//
.1.3.6.1.2.1.4.20.1.3.//^ipa.adr(1,192.168.200.100)^// =
IpAddress: //^ipa.net(1,255.255.0.0)^//
It is possible to use multiple modifiers in a single line. Types of pre-loaded modifiers are
described in the following sections.
Where:
• idx – index of address entry (if 0, address is equal to the address of a given
device, if greater than 0, the address is retreived from Advanced network
configuration file).
• default – default value substituted if the address has not been found in
Advanced network configuration file.
If default value is not defined, then the simulator returns the address with index equals
to idx%max_idx, where max_idx is the maximum number of address entries found.
For instance:
EXAMPLE:
Example of OID line in the SNMP record file containing post-loaded modifier has been
shown below:
.1.3.6.1.2.1.33.1.2.1.0 = INTEGER: 0 //$int.rnd(0,1,1,1,1,1,4)
Note: The value of “0” in the line above is the initial value which will be replaced with
the random value generated by the modifier on the first OID read.
where:
• direction – describes the trend how the value should be changed, the following
values are allowed:
o -1 (decrement)
o 0 (random increment or decrement, applicable for integer values only)
o 1 (increment)
• scount_min – minimum number of steps in which the value changes within the
same trend,
• scount_max – maximum number of steps in which the value changes within the
same trend,
• svalue_min – minimum deviation between previous and next value,
• svalue_max – maximum deviation between previous and next value,
• value_min – lower bound of the value (cannot be negative for Gauge and
Counter types),
• value_max – upper bound of the value (cannot be negative for Gauge and
Counter types).
NOTE:
Steps are understood as polls (or reads). Attributes scount_min and scount_max
determine how often the series will change monotonicity.
EXAMPLES:
A B C
direction = 0 direction = 1 direction = 0
scount_min = 0 scount_min = 0 scount_min = 0
scount_max = 0 scount_max = 0 scount_max = 0
svalue_min = 0 svalue_min = 0 svalue_min = 0
svalue_max = 0 svalue_max = 10 svalue_max = 100
value_min = -100 value_min = 0 value_min = 0
value_max = 100 value_max = 100 value_max = 100
A. If direction is set to 0 that means value may increase or decrease. The value of
each sample is constant because the deviation is set to 0 (svalue_min =
svalue_max = 0). This modifier is not actually randomizing values.
B. If direction is set to 1 that means the value will always increase. The values will
change randomly, ranging from 0 to 100. The deviation between each sample is
ranging from 0 to 10 which limits the speed of value increase (the value can
increase by 10 maximum).
C. If direction is 0 that means the value may increase or decrease. The values will
change randomly, ranging from 0 to 100. The deviation between each sample is
ranging from 0 to 100. As the same range was applied here as for value_min,
value_max, the value can increase or decrease very flexible.
For instance:
//$hex.rnd(,:,6,0) – a random MAC address is generated, separated with
":" sign, e.g.
On 1-st request: a3:b4:c5:d6:e7:33 || On 2-nd request: a3:b4:c5:d6:e7:33
//$hex.rnd(, ,6,1) – a random 6 bytes hex string is generated, separated
with " " (single space), e.g.
On 1-st request: a3 b4 c5 d6 e7 33 || On 2-nd request: d5 fa f1 32 12 e2
//$hex.rnd(, ,10,0) – at the beginning random 10 bytes hex string is
generated, separated with " " (single space), e.g.
On 1-st request: 1d 13 f5 e4 56 1a a3 c6 f8 ff || On 2-nd request: 1d 13 f5 e4 56 1a a3
c6 f8 ff
//$hex.rnd(11 02 , ,4,1) – random 6 bytes hex string is generated,
always started with "11 02 ", separated with " " (single space), e.g.
On 1-st request: 11 02 a4 e6 55 1f || On 2-nd request: 11 02 a1 12 6f 5a
EXAMPLE:
.1.3.6.1.2.1.25.3.5.1.2.1 = Hex-STRING: //$hex.rnd(,:,8,0) – generates 8 random
hexadecimal octets separated by ":" (colon), e.g. 11 02 a4 e6 b4 c5 d6 55
EXAMPLE:
.1.3.6.1.2.1.4.20.1.1.0.0.0.0 = IpAddress: //$ipa.rnd(,.,4,0) – generates fixed IP
address, not be changed during the simulation,
.1.3.6.1.2.1.4.20.1.1.127.0.0.1 = IpAddress: //$ipa.rnd(,.,4,1) – generates IP address
changing on each read.
The parameters for this modifier are exactly the same with hex string modifier, but in
this case MAC is kept in string in alphanumeric format.
8 APPENDIX
4. Click Advanced. The Advanced TCP/IP settings dialog box is displayed showing
all configured IP addresses.
5. Click Add below the IP Addresses section and add a new IP address along
with a corresponding subnet mask (you may add as many addresses as
required).
4. Click Properties from the pop-up menu for the selected adapter. In the
Properties dialog box, click Internet Protocol Version 4
(TCP/IPv4), and then Properties.