Often you might need to check the amount of throughput your network can handle to help diagnose (or prevent) performance problems. I've done this across WAN links, from WLAN clients and on lots of other occasions.
But how best can you measure it? I use a small tool called Iperf. It allows you to measure the throughput between 2 computers; at one end you set it up so it's listening, and at the other end you run it and direct traffic to the other machine. It works really well providing you have access to both computers to get it setup, but what happens when you don't? This is where PsExec comes in handy since it can be used to run programs on remote computers.
To help with this I've written a small script to automate this process. I keep it handy on a USB stick, on my laptop, or on network storage so I can get to it whenever I need it.
Save the batch file below to the same folder as a copy of Iperf, PsExec and PsKill and you're good to go. If you save the script as 'networktest.bat', run it from the command line by typing 'networktest 192.168.1.2' - just substitute the IP address for that of the other computer at the remote end.
Couple of things to bear in mind: You will need permission to connect to the remote machine in order for PsExec and PsKill to run. I try mapping a drive to the remote end first to make sure I can. Finally, anti-virus software might prevent Iperf, PsExec or PsKill from running either on the local machine or at the remote end.
@echo off
echo.
echo.
pskill \\%1 iperf.exe
rem kills any existing instance of iperf already running on the remote computer.
echo.
echo.
psexec \\%1 -scd iperf.exe -s
rem sets iperf in listening mode on the remote computer.
echo.
echo.
iperf -c %1 -r -t 30 -P 10 -w 64KB -l 128KB -i 10
rem generates some traffic and outputs to the screen. check out the iperf help for different switches and parameters.
echo.
echo.
pskill \\%1 iperf.exe
rem kills the instance of iperf running on the remote computer.
echo.
echo.
pause
When I run the script between my laptop and my home PC, both wireless on my standard ISP-issued router, the output looks as below. The key value to look for is the SUM to give you an idea of the network speed. It looks like between my laptop and my home PC I'm getting around 9 to 10 Mbps.
C:\iperf_script>networktest RICK-HOMEPC
Starting iperf on RICK-HOMEPC
Connecting with pskill service on RICK-HOMEPC...
Killing process 0 on RICK-HOMEPC...
Error killing process(es) named iperf.exe on RICK-HOMEPC:
Process iperf.exe does not exist on RICK-HOMEPC.
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 64.0 KByte
------------------------------------------------------------
------------------------------------------------------------
Client connecting to RICK-HOMEPC, TCP port 5001
TCP window size: 64.0 KByte
------------------------------------------------------------
[440] local 192.168.0.6 port 8399 connected with 192.168.0.2 port 5001
[424] local 192.168.0.6 port 8397 connected with 192.168.0.2 port 5001
[408] local 192.168.0.6 port 8395 connected with 192.168.0.2 port 5001
[392] local 192.168.0.6 port 8393 connected with 192.168.0.2 port 5001
[376] local 192.168.0.6 port 8391 connected with 192.168.0.2 port 5001
[432] local 192.168.0.6 port 8398 connected with 192.168.0.2 port 5001
[416] local 192.168.0.6 port 8396 connected with 192.168.0.2 port 5001
[400] local 192.168.0.6 port 8394 connected with 192.168.0.2 port 5001
[384] local 192.168.0.6 port 8392 connected with 192.168.0.2 port 5001
[368] local 192.168.0.6 port 8390 connected with 192.168.0.2 port 5001
[ ID] Interval Transfer Bandwidth
[416] 0.0-10.0 sec 1.00 MBytes 839 Kbits/sec
[384] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[440] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[424] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[408] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[392] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[376] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[432] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[400] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[368] 0.0-10.0 sec 1.13 MBytes 944 Kbits/sec
[SUM] 0.0-10.0 sec 11.1 MBytes 9.33 Mbits/sec
[400] 10.0-20.0 sec 896 KBytes 734 Kbits/sec
[384] 10.0-20.0 sec 896 KBytes 734 Kbits/sec
[368] 10.0-20.0 sec 896 KBytes 734 Kbits/sec
[440] 10.0-20.0 sec 896 KBytes 734 Kbits/sec
[424] 10.0-20.0 sec 896 KBytes 734 Kbits/sec
[416] 10.0-20.0 sec 1.00 MBytes 839 Kbits/sec
[392] 10.0-20.0 sec 896 KBytes 734 Kbits/sec
[408] 10.0-20.0 sec 1.00 MBytes 839 Kbits/sec
[376] 10.0-20.0 sec 1.00 MBytes 839 Kbits/sec
[ ID] Interval Transfer Bandwidth
[432] 10.0-20.0 sec 1.00 MBytes 839 Kbits/sec
[SUM] 10.0-20.0 sec 9.25 MBytes 7.76 Mbits/sec
[408] 20.0-30.0 sec 1.00 MBytes 839 Kbits/sec
[440] 20.0-30.0 sec 1.13 MBytes 944 Kbits/sec
[376] 20.0-30.0 sec 1.00 MBytes 839 Kbits/sec
[432] 20.0-30.0 sec 1.00 MBytes 839 Kbits/sec
[416] 20.0-30.0 sec 1.00 MBytes 839 Kbits/sec
[400] 20.0-30.0 sec 1.13 MBytes 944 Kbits/sec
[384] 20.0-30.0 sec 1.13 MBytes 944 Kbits/sec
[368] 20.0-30.0 sec 1.13 MBytes 944 Kbits/sec
[392] 20.0-30.0 sec 1.00 MBytes 839 Kbits/sec
[424] 20.0-30.0 sec 1.13 MBytes 944 Kbits/sec
[SUM] 20.0-30.0 sec 10.6 MBytes 8.91 Mbits/sec
[408] 0.0-30.6 sec 3.25 MBytes 890 Kbits/sec
[432] 0.0-30.6 sec 3.25 MBytes 890 Kbits/sec
[440] 0.0-30.6 sec 3.25 MBytes 890 Kbits/sec
[376] 0.0-30.6 sec 3.25 MBytes 890 Kbits/sec
[416] 0.0-30.7 sec 3.13 MBytes 855 Kbits/sec
[400] 0.0-30.7 sec 3.25 MBytes 889 Kbits/sec
[384] 0.0-30.7 sec 3.25 MBytes 889 Kbits/sec
[ ID] Interval Transfer Bandwidth
[368] 0.0-30.7 sec 3.25 MBytes 889 Kbits/sec
[392] 0.0-30.7 sec 3.13 MBytes 854 Kbits/sec
[424] 0.0-30.7 sec 3.25 MBytes 888 Kbits/sec
[SUM] 0.0-30.7 sec 32.3 MBytes 8.81 Mbits/sec
[156] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15041
[172] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15042
[128] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15043
[392] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15044
[356] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15045
[384] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15046
[400] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15047
[416] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15048
[372] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15049
[436] local 192.168.0.6 port 5001 connected with 192.168.0.2 port 15050
[ ID] Interval Transfer Bandwidth
[156] 0.0-10.0 sec 1.50 MBytes 1.26 Mbits/sec
[172] 0.0-10.0 sec 1.50 MBytes 1.26 Mbits/sec
[392] 0.0-10.0 sec 1.50 MBytes 1.26 Mbits/sec
[356] 0.0-10.0 sec 1.50 MBytes 1.26 Mbits/sec
[384] 0.0-10.0 sec 1.50 MBytes 1.26 Mbits/sec
[400] 0.0-10.0 sec 1.50 MBytes 1.26 Mbits/sec
[416] 0.0-10.0 sec 1.00 MBytes 840 Kbits/sec
[372] 0.0-10.0 sec 1.00 MBytes 840 Kbits/sec
[436] 0.0-10.0 sec 1.00 MBytes 841 Kbits/sec
[128] 0.0-10.0 sec 897 KBytes 735 Kbits/sec
[SUM] 0.0-10.0 sec 12.9 MBytes 10.8 Mbits/sec
[372] 10.0-20.0 sec 1.50 MBytes 1.26 Mbits/sec
[172] 10.0-20.0 sec 1.37 MBytes 1.15 Mbits/sec
[128] 10.0-20.0 sec 1024 KBytes 839 Kbits/sec
[436] 10.0-20.0 sec 894 KBytes 732 Kbits/sec
[356] 10.0-20.0 sec 1.50 MBytes 1.26 Mbits/sec
[156] 10.0-20.0 sec 895 KBytes 734 Kbits/sec
[416] 10.0-20.0 sec 895 KBytes 734 Kbits/sec
[392] 10.0-20.0 sec 895 KBytes 734 Kbits/sec
[400] 10.0-20.0 sec 1.13 MBytes 944 Kbits/sec
[ ID] Interval Transfer Bandwidth
[384] 10.0-20.0 sec 895 KBytes 734 Kbits/sec
[SUM] 10.0-20.0 sec 10.9 MBytes 9.12 Mbits/sec
[384] 20.0-30.0 sec 897 KBytes 735 Kbits/sec
[372] 20.0-30.0 sec 1.50 MBytes 1.26 Mbits/sec
[392] 20.0-30.0 sec 897 KBytes 735 Kbits/sec
[400] 20.0-30.0 sec 1.13 MBytes 944 Kbits/sec
[128] 20.0-30.0 sec 1.75 MBytes 1.47 Mbits/sec
[436] 20.0-30.0 sec 1.25 MBytes 1.05 Mbits/sec
[156] 20.0-30.0 sec 1024 KBytes 839 Kbits/sec
[172] 20.0-30.0 sec 1.75 MBytes 1.47 Mbits/sec
[416] 20.0-30.0 sec 897 KBytes 735 Kbits/sec
[356] 20.0-30.0 sec 1.63 MBytes 1.36 Mbits/sec
[SUM] 20.0-30.0 sec 12.6 MBytes 10.6 Mbits/sec
[384] 0.0-31.1 sec 3.50 MBytes 943 Kbits/sec
[128] 0.0-31.2 sec 3.88 MBytes 1.04 Mbits/sec
[372] 0.0-31.3 sec 4.25 MBytes 1.14 Mbits/sec
[392] 0.0-31.4 sec 3.50 MBytes 936 Kbits/sec
[436] 0.0-31.3 sec 3.38 MBytes 904 Kbits/sec
[400] 0.0-31.4 sec 4.00 MBytes 1.07 Mbits/sec
[172] 0.0-31.4 sec 4.88 MBytes 1.30 Mbits/sec
[ ID] Interval Transfer Bandwidth
[156] 0.0-31.5 sec 3.63 MBytes 967 Kbits/sec
[356] 0.0-31.5 sec 4.88 MBytes 1.30 Mbits/sec
[416] 0.0-31.5 sec 3.00 MBytes 798 Kbits/sec
[SUM] 0.0-31.6 sec 38.9 MBytes 10.3 Mbits/sec
Connecting with pskill service on RICK-HOMEPC...
Killing process 0 on RICK-HOMEPC...
Process iperf.exe killed on RICK-HOMEPC.
Press any key to continue . . .
No comments:
Post a Comment