This script is made to test networking hardware and software in a simple way by verifying packets travel reliably across the network. This is mostly made to troubleshoot bad switches, NICs, and anything else that could corrupt a packet between applications.
Running ./nettest.pl by itself will give you a couple options to help you get going.
- To Listen: ./nettest.pl listen ipAddressToListenOn portToListenOn
- To Send: ./nettest.pl send ipAddressBeingListenedOn portBeingListenedOn randomNumbersToGenerate
The default IP address used is 127.0.0.1 so you definitely should specify one (though it’s not required). The default port is 12344 which can easily be changed to any TCP port the user has rights to bind (>1023 on most platforms unless run as ‘root’). Be sure when specifying a port that the firewall on the receiving side (and possibly even the sending side, though not often)
is allowing packets to be received on that port.
This script uses a couple libraries that should already be on your system including IO::Socket and Digest::MD5 which should be available should you not have them. You’ll know they are not there if you get an error like “Can’t locate Digest/MD5.pm”. An earlier version used to work with a md5sum system call but to make this a bit easier to use that has been replaced with the Perl equivalents.
Using a randomNumbersToGenerate number of 1000000 (one million) will generate approximately 15MB data. For this reason be sure you know what connection you are testing. This would be a multi-hour test of a dial-up network but would be a relatively small test of a fast LAN. For most cases is it
probably a good idea to do 10x that for a LAN at least. Note that the Perl script is caching this string which will be processed in memory before sending it to the command-line. For this reason doing multiple hundred-megabyte tests is probably better than doing a single ten-gigabyte test unless you have ten gigabytes of RAM to spare. If you get outside your RAM and get into swap space (pagefile) the performance of this test will be abysmal. Some quick testing shows that for every increment of the ‘numberToSend’ parameter sixteen to eighteen bytes are sent. This may help calculate a good number for your specific connection.