I have compared two tools for the speed of sending packets, hping
and packETHcli
. The command line options for packETHcli is
./packETHcli -i eth0 -m 2 -n 0 -d -1 -f icmpSample.pcap
and for hping is
hping --flood 192.168.0.1
But in iptraf, it shows that the packets sending speed of hping is about 10 times faster than packETHcli.
Both tools use raw sockets, but why such a big difference?
Here is the link to get the source codes.
hping: http://wiki.hping.org/
packETHcli: http://sourceforge.net/projects/packeth/
EDIT:
I noticed that the hping
use AF_INET raw socket, the payload is TCP. packETHcli
use PF_PACKET raw socket, and in my example the payload is and IP packet with payload of ICMP.
Do it make the difference of the packet sending speed ?
EDIT2
This time,I use ifconfig to find the TX packets count difference between before and after running hping3
and packETHcli
. And found that the packets generating rates are close for the two tools. hping3
is about 100000 packets per seconds and packETHcli
is about 80000 packets per seconds.
I also use vnstat
to measure the packets generating rates. And the result is consistent with the number I get from ifconfig
.
So, it seems that iptraf
lies. And I use iptraf
to monitor the repeated resending of a TCP packet, without update the IP ID number and TCP sequence number. iptraf
think my packet sending rate is 0 packets per seconds. May be iptraf
don't count the duplicated packets?