I spent several hours to find suitable script which help me figure out my network speed between two servers. But it was fruitlessly. So, I decided to make my own script with blackjack and hoockers. (c)
My Perl script require several things :
- Perl interpreter of course
- IO::Socket perl module
- Getopt::Long perl module
I will tell you nothing about first one. To install perl modules run cpan as root:
cpan -i Getopt::Long
and
cpan -i IO::Socket
When installation will be finished. Download bandtest.pl and save it at 1-st server.
Now go to the second one and run netcat(please make sure you have this package installed):
server02# nc -4tl 7777 > /dev/null
You can use any free port instead port 7777.
Back to first server and run bandtest.pl, but before make sure there is no any firewalls rules which hamper in connection between to hosts on port 7777.
Use telnet to check connection:
server01# telnet server02 7777 Connected to kivras01. Escape character is '^]'.
This output means connection is successfully opened, so you can continue.
Make file with size for example 100Mb(I advice you to don’t use very big files, 100Mb is fit size which doesn’t fill your memory out and enough for proper results. I intentionally put file into memory before sending the data’s. This allow me delete any I/O operation during the network connection and as result prevent any result distortion.):
server01# dd if=/dev/zero of=/tmp/test bs=1024 count=1000000 100000+0 records in 100000+0 records out 102400000 bytes (102 MB) copied, 1.20234 s, 85.2 MB/s
Run bandtest.pl to get a results:
server01$ ./bandtest.pl -h server02 -p 7777 -f /tmp/test Bytes were transfered 102.40 MB Seconds taken: 8 Average speed 12.80 MB
EOF.