Spaces:
Running
Running
File size: 878 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 |
#!/bin/bash
#
# This script starts an iperf3 server and displays the server's IP address.
#
# 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"
exit 1
fi
# Get the server's IP address
IP_ADDRESS=$(hostname -I | awk '{print $1}')
PORT=5201
echo ""
echo "------------------------------------------------------------------"
echo " iperf3 Server"
echo "------------------------------------------------------------------"
echo " Server IP: ${IP_ADDRESS}"
echo " Port: ${PORT}"
echo ""
echo "Starting iperf3 server..."
echo "Press Ctrl+C to stop the server."
echo "------------------------------------------------------------------"
# Start the iperf3 server
iperf3 -s -p ${PORT}
|