Providing pcap file as input to NetSim Emulator

NetSim has an inbuilt traffic generator (Application) which can be used to model unicast/multicast/broadcast traffic in the network with support for application types such as CBR, Custom, Voice, Video, FTP, Database, etc. NetSim also allows users to provide pcap file as input to NetSim traffic generator and configure applications using the real IP addresses and port numbers.

Generating a pcap file for NetSim#

Any pcap file can be provided as input to NetSim by following the procedure explained here. In this example we are generating a pcap file by running wireshark and generating traffic using ping and saved it as Raw.pcap (while saving please make sure that save as file type must be Wireshark/tcpdump/.. -pcap). Ping is initiated form the Source IP: 192.168.0.154 to the Destination IP: 192.168.0.192. The pcap file will contain all incoming and outgoing packets from the system in which the capture is being done.

Figure4-45

Wireshark capture can be stopped after capturing required packets and saved in desired location with a user defined name (*.pcap). E.g.: Input_to_NetSim.pcap

PCAP file needs to be edited suitably before providing it as input to NetSim. The "editcap" application in Wireshark installation directory can be used to edit any pcap file to be provided as input to NetSim.

Go to wireshark installation directory [C:\Program Files\Wireshark]

Figure4-46

Open command prompt, and execute the following command:

editcap -C 14 -L -T rawip -F pcap "<File Location where the file is present>/Raw.pcap" "<File Location where the file needs to be saved>/Input_to_NetSim.pcap"

Where,

  • -C [offset:]<choplen> chop each packet by <choplen> bytes. Positive values chop at the packet beginning, negative values at the packet end. If an optional offset precedes the length, then the bytes chopped will be offset from that value. Positive offsets are from the packet beginning, negative offsets are from the packet end. You can use this option more than once, allowing up to 2 chopping regions within a packet provided that at least 1 choplen is positive and at least 1 is negative.
  • -L adjust the frame (i.e. reported) length when chopping and/or snapping
  • -T <encap type> set the output file encapsulation type; default is the same as the input file. An empty "-T" option will list the encapsulation types.
  • -F <capture type> set the output file type; default is pcapng. An empty "-F" option will list the file types.
    Figure4-47

4.8.2 Providing pcap file as input to NetSim#

  1. Create a system environment Variable with Variable Name as “EMULATOR_INPUT” and value as the path of the pcap file along with the file name (Ex:C:\Users\bhatv\Desktop\NetSim\INPUT_TO_NETSIM.pcap). Figure4-48
  2. Start NetSim as administrator. Now create a simple scenario in NetSim. For example, create a scenario in Internetworks with 1 router and 2 wired nodes as shown below. Create an Emulation application by giving the real source and destination IP’s present in the pcap file. In this case we have used the IP addresses 192.168.0.154 and 192.168.0.192 which we have used for generating traffic using PING. Figure4-49
  3. Run NetSim in administrator mode for Emulator application.
  4. Now create a simple scenario in NetSim. For example, create a scenario in Internetworks with 1 router and 2 wired nodes.
  5. Create an Emulator application by giving the real source and destination IP’s present in the pcap file Figure4-50
    • Multiple applications can be configured based on the packets captured. For instance, there can be one more application configured for packets from 192.168.0.192 to 192.168.0.154
    • NetSim Emulator will read the packets from pcap file as per the source and destination that we are giving in the application properties.
    • After simulation, NetSim results window provides Packet Capture Metrics. Here users can observe 4 different types of log files as explained in section 3.1
    • Open Dispatch to Emulator packets, it contains only the packets whose source and destination IP addresses match with the source and destination IP addresses that we have configured.