Generate traffic using mgen

Multi Generator is one of  free traffic generators.  Current release is mgen 4.2b4. Source could be downloaded here. I installed it on fresh and default Centos 5.3 (2.6.18-128.el5) linux. In order  to work mgen properly, libstdc++.so.5 must be installed:
yum install libstdc++.so.5
and after according to manual:
tar -xvf src-mgen-4.2b6.tgz
cd mgen-4.2b6/unix/
make –f Makefile.linux mgen

and add directory to PATH:
export PATH=$PATH:/path/to/mgen-4.2b6/mgen
Mgen can sent and receive traffic. That’s why one host acts as sender and other as receiver
Now we can make a test:
Create script on sender side: test_input.mgn with:
0.0 ON 1 UDP DST 192.168.10.116/4000 PERIODIC [10.0 1024] TOS 0x10
10.0 OFF 1

It says that we send to 192.168.10.116 on port 4000 PERIODIC traffic. Each packet is 1024 bytes long and in one second 10 packets are sent. What is more, we set on each packet ToS = 0×10. Notice, that 1024B includes IP header. Mgen stops sending packets after 10s.
On receiver side mgen must listen on given port. In order to do this we create script test_listen.mgn:
LISTEN UDP 4000
Please remember to allow traffic to go through your firewall! Or simply type:
service iptables stop

First we must start listening on receiver side:
mgen input test_listen.mgn output test_output.drc
In test_output.drc would be stored captured data for using with TRPR in order to provide QoS metrics.
Now we can start sending packets. We do it on sender side by:
mgen input test_input.mgn
After 10s mgen terminates itself and we can prepare other things with test_output.drc, which would be shown in next posts.
It is worth to read about other avaliable options in mgen. According to particular needs they might be very useful.

Comments