[Ntop-misc] Traffic generation
Brad Doctor
bdoctor at ps-ax.com
Thu Oct 27 17:47:00 CEST 2005
ttcp is pretty good, as is tcpreplay with the '-R' switch. Are you looking
for fairly realistic traffic, or fixed packet sizes, fixed rates, things of
that nature? On the commercial front, Ixia is what we use and we really,
really love it. We have the ixChariot which is software-based and allows
you to use just about any endpoint under the sun. Not cheap of course but
very cost effective for commercial software.
I've also attached a couple of perl scripts:
Storm.pl -- random source/dest IP and random source/dest port for *every*
connection. Uses Net::RawIP
DSIZE_send.pl - fixed packet sizes, UDP packets
-brad
> Hi all,
>
> We are trying to stress a firewall / qos device with variable traffic.
> We know of two opensource tools to do this, netperf and hping.
>
> Netperf is capable of creating a lot of traffic, almost saturatying
> the interface, but the traffic is too simple. Using hping we are capable
> of generating quite a bit of random traffic but very few of it (compared
> to the maximum of the interface).
>
> For example with
>
> hping2 -2 -I eth0 192.168.99.x --rand-dest -k -p 82 -i u100 -d 1472
>
> I'm generating around 500pkt/s => ~ 5,8Mbps too few :(
>
> Is there any tool to do this? Why hping cannot create more traffic?
>
> Thanks
>
> --
> Jaime Nebrera - jnebrera at eneotecnologia.com
> Consultor TI - ENEO Tecnologia SL
> Telf.- 619 04 55 18
>
> _______________________________________________
> Ntop-misc mailing list
> Ntop-misc at listgateway.unipi.it
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
>
--
Brad Doctor, CISSP
-------------- next part --------------
#!/usr/bin/perl
# bdoctor - StillSecure
use Net::RawIP;
$p = new Net::RawIP;
# Maximum data length
$max = 800;
for ($i=0;$i<=$max;$i++) {
$data = $data . "a";
}
$plen = length($data);
$sport = int(rand(65530));
# Set this to be the outgoing interface
$p->ethnew("eth1");
# Our MAC, their MAC - must be legitimate
$p->ethset(source => '00:0F:1F:03:F5:AE', dest => '00:0F:1F:03:F9:BC');
print "Data len: $plen\n";
sub genIp {
$ret = "";
for ($i = 0; $i < 4; $i++) {
$ret .= int(rand(254)) . ".";
}
$ret =~ (s/\.$//g);
return($ret);
}
sub genPort {
return(int(rand(65535)));
}
while ($p) {
# Generate a new combination for everything we do.
$p->set( {
ip => {saddr => genIp(), daddr => genIp() },
tcp => {source => genPort(), dest=>genPort(), data=>$data}
} );
$cnt++;
$p->ethsend;
}
-------------- next part --------------
#!/usr/bin/perl
# bdoctor - StillSecure
use IO::Socket;
use IO::Handle;
use Time::HiRes qw(tv_interval gettimeofday usleep);
$s = IO::Socket::INET->new(
PeerAddr => '8.1.2.2',
PeerPort => 5555,
Proto => 'udp',
) || eval {
print "no socket: $! $@\n";
};
$max = 40000;
$pkt_send = 90000;
for ($i = 0; $i <= $max; $i++) {
$data = $data . "a";
}
$plen = length($data);
$s->send("$pkt_send:$plen");
for ($count = 0; $count <= $pkt_send; $count++) {
#setsockopt($s, SOL_SOCKET,TCP_NODELAY,1);
$sent = $s->send($data) || eval {
print "No socket: $! $@\n";
};
if ($sent != $plen) {
print "DID NOT SEND ALL DATA! sent:($sent) size: ($plen)\n";
exit(1);
}
#usleep(1);
}
print "count: $count\n";
for ($i = 0 ; $i <= 30; $i++) {
$sz = $s->send("EOT");
}
exit(0);
More information about the Ntop-misc
mailing list