This guide shows how to clone and simulate devices using free and commonly used tools. This could be helpful while conducting network stress-tests, network audits, etc.
This guide is divided into 4 simple steps:
- Installation of SNMP simulator
- Extracting SNMP record files from a physical device
- Adding a device to the list of simulated devices
- Starting the simulation
Requirements and tools:
- 32 or 64 bit Linux distributions including: SuSE, RedHat Enterprise and Debian using i386 and x64 architectures.
- TCP/IP network connection.
- Java 1.6 or higher installed.
- NET-SNMP tools http://sourceforge.net/projects/net-snmp/files/net-snmp%20binaries/184.108.40.206-binaries/net-snmp-220.127.116.11-1.x86.exe/download
- Verax SNMP Agent Simulator http://www.veraxsystems.com/en/products/snmpsimulator
- Network monitoring software.
STEP 1: Installing SNMP agent simulator
First, you have to install the SNMP agent simulator (in this example it’s free Verax SNMP Agent Simulator).
- Download and unzip the simulator package (vxsnmpsimulator-1.3.1.zip).
- Recommended installation directory for the simulator: /usr/local/vxsnmpsimulator
- Create and move the simulator.conf file to the following directory: /etc/verax.d/
- Open the simulator.conf file, find the line with the SIMULATOR_HOME variable and change it to point to the installation directory.
- In the same simulator.conf file, find the line with the JRE_HOME variable file and and point to the folder where your java is located.
- Pay attention to the name of the interface (e.g. ‘eth1’) which is used to create interface aliases (e.g. ‘eth1:0’, ‘eth1:1’, etc.). The primary interface must be present before the SNMP simulator starts.
- Copy the simulatord file to /etc/init.d directory.
- Give execute permission to the following files:
- chmod +x /etc/init.d/simulatord
- chmod +x /usr/local/vxsnmpsimulator/conf/stop
- chmod +x /usr/local/vxsnmpsimulator/conf/vlan_up
- chmod +x /usr/local/vxsnmpsimulator/conf/vlan_down
STEP 2: Extracting SNMP record files from a physical device
- Extracting SNMP record files from a physical device can be done using the snmpwalk command. In order to do that, you have to install some tools allowing for snmpwalk command e.g. NET-SNMP.
- NET-SNMP can be installed by issuing the following command:
yum install net-snmp-utils
- In order to prepare SNMP record file reflecting actual SNMP agent available at given IP address, use SNMP tools and issue the following command:
snmpwalk -On -Oe -OU -v2c -c public address > [destination folder]/filename.txt
snmpwalk -On -Oe -OU -v2c -c public 192.168.100.8 > /root/cisco-snmprecordfile.txt
In this example 192.168.100.8 is an IP of a physical cisco switch we want to simulate.
Now, the generated cisco-snmprecordfile.txt file contains OID values of the real device and will be stored in the simulator/device directory.
STEP 3: Adding device to the list of simulated devices in SNMP simulator
Navigate to the vxsnmpsimulator/conf directory, open devices.conf, and add a new <device> record for a simulated device.
In order to add a new device, you have to provide a path to a recently generated file (cisco-snmprecordfile.txt) and add a new IP address. Remember that the new IP address must be virtual.
<type filepath="../device/cisco-snmprecordfile.txt"> <devices> <device ip="192.168.160.34" netmask="24" port="161"</device> </devices> </type>
STEP 4: Starting the simulation
Before running the Verax SNMP Simulator, make sure that port 161 is available. If not, stop any process using port 161.
- In order to start the SNMP Simulator, issue the following command in a terminal window (shell):
service simulatord start
- In order to open the Management Console, issue the following command in the terminal window (shell):
service simulatord console
- The Management Console will ask for connection details (it may connect to multiple simulators). By default, the simulator service process is running on the same server as the Management Console – in such a case confirm the default parameters by pressing “y” at the prompt:
Do you want to connect to default simulator server? [y/n]
Note: The default connection parameters are 127.0.0.1:43500 (localhost as the host name and 43500 for TCP port).
- Use the SHOW command to list simulated devices.
Well done, now we’ve got our cisco switch simulated by the SNMP simulator at given IP address (192.168.160.34).
Final: Adding simulated device to the monitoring system
Make sure that SNMP simulator is started and simulating (type SHOW to check a list of simulated devices).
Now, start your network monitoring tool and add a simulated device just like any other but remember to provide your simulated device IP.
Well done! You can now clone and simulate multiple SNMP devices or even networks.