Spaces:
Running
Running
File size: 1,592 Bytes
c001f24 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | #!/bin/bash
#
# This script runs iperf3 in client mode to test network speed.
#
# Check if iperf3 is installed
if ! command -v iperf3 &> /dev/null
then
echo "iperf3 could not be found. Please install it."
echo "For Debian/Ubuntu, use: sudo apt install iperf3"
echo "For CentOS/RHEL, use: sudo yum install iperf3"
echo "For macOS (with Homebrew), use: brew install iperf3"
echo "For Windows, download from iperf.fr"
exit 1
fi
# Check for server IP argument
if [ -z "$1" ]
then
echo "Usage: $0 <server_ip_address>"
exit 1
fi
SERVER_IP=$1
PORT=5201
PARALLEL_STREAMS=4
echo ""
echo "------------------------------------------------------------------"
echo " iperf3 Client"
echo "------------------------------------------------------------------"
echo " Server IP: ${SERVER_IP}"
echo " Port: ${PORT}"
echo "------------------------------------------------------------------"
echo ""
echo "Running standard test (client to server)..."
iperf3 -c ${SERVER_IP} -p ${PORT}
echo ""
echo "Running reverse test (server to client)..."
iperf3 -c ${SERVER_IP} -p ${PORT} -R
echo ""
echo "Running test with ${PARALLEL_STREAMS} parallel streams (client to server)..."
iperf3 -c ${SERVER_IP} -p ${PORT} -P ${PARALLEL_STREAMS}
echo ""
echo "Running reverse test with ${PARALLEL_STREAMS} parallel streams (server to client)..."
iperf3 -c ${SERVER_IP} -p ${PORT} -P ${PARALLEL_STREAMS} -R
echo ""
echo "------------------------------------------------------------------"
echo " Test complete."
echo "------------------------------------------------------------------"
|