#!/bin/sh export DATE="18.11.2006";SCRIPT=${0#/rom} export TITLE="Netperf: Bandwidth Measurement" . ${SCRIPT%/*}/cgi-bin-pre.sh cat<Netperf: Bandwidth Measurement
EOF if [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRING fi if [ -n "$QUERY_STRING" ]; then IFS=\&;set ${QUERY_STRING%%[^%&=+-:@-_a-z~]*};unset IFS;eval $* fi if [ -n "$server_ip" ]; then client_ip=$(ip route get $server_ip | grep $server_ip | sed 's/.*src //') client_name=$(nslookup $client_ip | grep Name: | sed 's/Name:[ ]*//') if [ -n "$client_name" ]; then client="$client_ip ($client_name)" else client="$client_ip" fi server_name=$(nslookup $server_ip | grep Name: | sed 's/Name:[ ]*//') if [ -n "$server_name" ]; then server="$server_ip ($server_name)" else server="$server_ip" fi set `netperf -H $server_ip -t TCP_STREAM -l 5 | grep "^ [0-9]"` size_up=$(echo $3) time_up=$(echo $4) bw_up=$(echo $5) set `netperf -H $server_ip -t TCP_MAERTS -l 5 | grep "^ [0-9]"` size_down=$(echo $3) time_down=$(echo $4) bw_down=$(echo $5) cat<

Upload Bandwidth:

From: $client
To: $server
Message size: $size_up bytes
Test duration: $time_up seconds
Net bandwidth measured: $bw_up Mbit/sec

Download Bandwidth:

From: $server
To: $client
Message size: $size_down bytes
Test duration: $time_down seconds
Net bandwidth measured: $bw_down Mbit/sec

Measured Link:

EOF else cat<

Link to be measured:

EOF fi cat<
With this host:
 
   

Note: This page allows to measure the net bandwidth of a TCP flow between this router and another one whose IP address is indicated in the "With this host" field. This IP address must be the address of a Netperf server. The test needs about 10 seconds before displaying the result.

EOF . ${SCRIPT%/*}/cgi-bin-post.sh