Tools to help you prototype: traffic generators

Let’s forget about what type of network technology you are using. Now, suppose you want to perform a benchmark for your new network topology, protocol, antenna, or other. Regardless of which of the aforementioned test you want to perform, it should be tested under realistic traffic sources. Also, it might be even better if these sources can be customized to your own needs in terms of: throughput, packet structure, header values, etc.

In these short series I will be reviewing some of my experiences while prototyping proposals and getting relevant (i.e.: publishable) results. So first, let’s talk about tools for creating your own traffic generators.

Realistic traffic?

When we talk about real-world traffic we are usually referring to its characteristics, like packet arrival distributions, intervals between burst, or throughput. For instance, if you plan to test a new MAC protocol that should improve voice quality over a network link, then you should better do performance evaluation of your proposal using source-traffic modelling real voice, and so on.

Some studies are based on real traces, but this can be inconvenient when working with resource-constrained devices (traces often taking large disk space), or use Constant Bit-Rate (CBR) sources employing tools such as iPerf. Nevertheless, these may not accurately represent the source traffic your solution will experience.

If you find yourself in this situation, maybe building your own traffic source is the way to go.

iPerf

It has been extensively used for many years. iPerf provides a Server and Client options, where you may define the port number and L4 protocol (UDP or TCP) on the server side, and other characteristics, like: throughput, length of test, interval between reports, packet size, and others in the client side.

iPerf is the go-to tool for extracting throughput metrics using CBR sources. It is simple, accepted by the community, and also provides already averaged results.

Scapy

Scapy is a Python-based library that you can use to create custom packets. Moreover, it provides a very easy syntax for encapsulating different OSI layers in the order you decide. For instance, you may encapsulate an Ethernet frame inside an UDP segment, and then encapsulate that into an IP packet and an additional TCP segment (for whatever reason, the point is that you can).

On top of that, Scapy is very friendly in terms of its documentation, which I invite you to overview before attempting anything. It also works within the Python interpreter, so you can test custom-made packets right away.

As Scapy is mainly a library, you can write Python scripts for controlling the packet generation rate, interval between bursts, source and destination MAC or IP addresses, UDP or TCP ports, and many other features. You may connect it with Wireshark and dissect received packets, or even build your own Client-Server applications.

Libtins

As Scapy, Libtins is a set of libraries for packet creation, parsing, and sniffing, albeit written in C++. It also provides you with installation guides and a step-by-step tutorial to get you started very quickly.

With Libtins you may write scripts to represent virtually any traffic model, while taking advantage of C++’s speed and portability. I would like to point you to a short tutorial I made on how I used Libtins to a create custom-made applications and simulate high volumes of traffic, a server for it, and a parser for getting every interesting metric I needed.

Did you know any of these tools? What’s your favorite? Care to point us to any other one? Tell us in the comments section.

Regards,

L.

Leave a comment