How To Clone And Simulate Network Devices On Linux

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:

  1. Installation of SNMP simulator
  2. Extracting SNMP record files from a physical device
  3. Adding a device to the list of simulated devices
  4. Starting the simulation

Requirements and tools:

 

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).

  1. Download and unzip the simulator package (vxsnmpsimulator-1.3.1.zip).
  2. Recommended installation directory for the simulator: /usr/local/vxsnmpsimulator
  3. Create and move the simulator.conf file to the following directory: /etc/verax.d/
  4. Open the simulator.conf file, find the line with the SIMULATOR_HOME variable and change it to point to the installation directory.
    SIMULATOR_HOME=”/usr/local/vxsnmpsimulator”
  5. 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.
    JRE_HOME=/usr/local/java/jdk1.6.0_14/bin/
  6. 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.
    PRIMARY_INTERFACE='eth1'
  7. Copy the simulatord file to /etc/init.d directory.
  8. 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

  1. 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.
  2. NET-SNMP can be installed by issuing the following command:

    yum install net-snmp-utils

  3. In order to prepare SNMP record file reflecting actual SNMP agent available at given IP address, use SNMP tools and issue the following command:
    e.g.

    snmpwalk -On -Oe -OU -v2c -c public address > [destination folder]/filename.txt

    e.g.

    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.

e.g.

<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. 

  1. In order to start the SNMP Simulator, issue the following command in a terminal window (shell):

    service simulatord start

  2. In order to open the Management Console, issue the following command in the terminal window (shell):

    service simulatord console

  3. 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).

  4. 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.

Share this page:

0 Comment(s)