README

Path: README
Last Update: Tue May 03 14:12:18 CEST 2005

Packgen network packet generator

Introduction

Packgen is a simple network packet generator handling diffserv markers, useful for testing network bandwidth and QoS.

It can generate several flows of data, each having its own properties such as:

  • name;
  • destination;
  • bandwidth;
  • packet size;
  • DSCP (Differentiated Services Code Point);
  • time range.

For more information about DSCP please read RFC 2474, 2475 and 3260.

See the "Installation" section to know how to install it and the "Examples" section to see how to use it. If you encounter some troubles, take a look at the "Troubleshooting" section.

This is just a 0.1 release but it is already pretty stable and can probably be used. If you find some bugs or have any questions or suggestions, don’t hesitate to send me an email to gmary[at]lunacymaze[dot]org.

Installation

To install, it’s very easy. You just have to do the following having the required privileges:

    ruby ./setup.rb

To run the unit tests you just have to do:

    cd tests
    ruby ./ts_all.rb

Examples

How to launch Packgen?

Packgen is to be used like that:

    packgen -i <input_file> [-l log_file]

Listening for flows

Here is the example file listen.yml which shows how to listen for flows on the UDP ports 5000 and 5001 and on the TCP ports 5002 and 5003:

LISTEN:

  udp:
    -
      ports: !ruby/range 5000..5001
  tcp:
    -
      ports: !ruby/range 5002..5003

You can see here that Ruby Ranges are used in order to specify that we want to listen on several consecutive ports. However, you can also simply use an Integer port number.

Sending flows

In the following example taken from the send.yml file, we describe the different flows by giving their names, their destination (host:port), the bandwidth they should use, the packet sizes, the time intervals and the DSCP values.

SEND:

  udp:
    -
      name: Voice
      host: 127.0.0.1:5000
      bandwidth: 700Kb
      packet_size: 252B
      dscp: cs6
      from..to: !ruby/range 0.0..60.0
    -
      name: Video
      host: 127.0.0.1:5001
      bandwidth: 2.8Mb
      packet_size: 750B
      dscp: cs4
      from..to: !ruby/range 10.0..60.0
  tcp:
    -
      name: Best Effort
      host: 127.0.0.1:5002
      bandwidth: 3.2Mb
      packet_size: 1KB
      from..to: !ruby/range 20.0..60.0
    -
      name: Background
      host: 127.0.0.1:5003
      bandwidth: 3.2Mb
      packet_size: 1KB
      dscp: cs1
      from..to: !ruby/range 30.0..60.0

Listening and sending at the same time

Here is the concatenation of the two previous examples (located in the listen_and_send.yml file). We add time intervals in the listening part in order to quit the program automatically when we’re finished. Note that you need to listen before sending anything!

LISTEN:

  udp:
    -
      ports: !ruby/range 5000..5001
      from..to: !ruby/range 0.0..62.0
  tcp:
    -
      ports: !ruby/range 5002..5003
      from..to: !ruby/range 0.0..62.0

SEND:

  udp:
    -
      name: Voice
      host: 127.0.0.1:5000
      bandwidth: 700Kb
      packet_size: 252B
      dscp: cs6
      from..to: !ruby/range 1.0..61.0
    -
      name: Video
      host: 127.0.0.1:5001
      bandwidth: 2.8Mb
      packet_size: 750B
      dscp: cs4
      from..to: !ruby/range 11.0..61.0
  tcp:
    -
      name: Best Effort
      host: 127.0.0.1:5002
      bandwidth: 3.2Mb
      packet_size: 1KB
      from..to: !ruby/range 21.0..61.0
    -
      name: Background
      host: 127.0.0.1:5003
      bandwidth: 3.2Mb
      packet_size: 1KB
      dscp: cs1
      from..to: !ruby/range 31.0..61.0

Features

  • Network packet flows generation with given bandwidth (packets sent at each time interval depending on the bandwidth to produce and the size of the packets to generate);
  • UDP and TCP flows;
  • DSCP marking;
  • Log generation which gives the possibility to compute statistics on the flows (to come later).

What’s next?

  • Addition of the capability to generate plots from the different flows being sent. For example, a plot representing the bandwidth of each flow, an other representing the number of packets received, the loss rate, the jitter…
  • Addition of other generation models allowing to send packets in a burst or randomly…
  • Addition of the possibility to pause the flows.

Troubleshooting

  • If you get an error message such as /usr/local/lib/site_ruby/1.8/packgen/flow.rb:310:in `setsockopt’: Operation not permitted (Errno::EPERM), that means that you don’t have the required privileges to use the DSCP mark you chose. Try again with root privileges.
  • If you get /usr/local/lib/site_ruby/1.8/packgen/flow.rb:364:in `initialize’: Connection refused - connect(2) (Errno::ECONNREFUSED), then you try to send on a port that is not being listened to.

Copyright and License

© Copyright 2005 Ghislain Mary (gmary[at]lunacymaze[dot]org). All Rights Reserved.

Released under the same terms of license as Ruby. See COPYING file for more information.

[Validate]