#!/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 " 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 "------------------------------------------------------------------"