r/linuxmint • • 25d ago

Discussion Iperf3 Network BenchGUI

I decided to try a bit of app development so this was my first real finished looking project. It's a very simple graphical network speed and benchmark test using Iperf3 between 2 machines. I found some config issues and hardware limitations that were revealed by this and made it simpler to see then verify the improvements. My speeds were tripled after I found 1 router setting limitation over a VPN. Then hit the next hardware limitation which will be removed soon.

This is to test total throughput on your connection from your device to the remote server which can be on the same LAN or over a VPN to another device. As long as it's reachable and running iperf3

This app will ask for the IP, port number then run tests and show a quick summary but gives a button to view the whole test output. Then asks to run the reverse test which uploads from the server back to you again showing the quick summary

This is also easy to transfer between machines etc since it's just a file. It will require enabling execute permission on the device you're copying it to.

Network SpeedBenchGUI for Iperf3

***Requirements yad for the client & iperf3 for target and local client

  1. Install yad on client side -- sudo apt update && sudo apt install -y yad

OR use your Software Manager

2. I like Geany for txt files but use anything you want. Nano is very common, queue editor war. Make a new file called network_benchgui.sh save to Home or whatever folder you like. Terminal : nano network_benchgui.sh --creates file in your Home folder /Home/YourUserName/network_benchgui.sh OR just navigate in the GUI File Manager to folder location desired R click then create file, Name the file, then edit and copy code there, Save

3. Copy the complete file text into the file and save. ***SECURITY WARNING*** you're pasting foreign text into an executable file on your system beware and verify code, know what you're doing or trust the source. You may be authorizing your first born into the New World Order Service, your wife into a wife swap brothel and sending your dog to be put in soup to feed Teradactyl's.. Nothing dangerous here BUT never trust a stranger that says trust me bro, especially on the internet.

Then make sure file is executable with chmod +x network_benchmark_gui.sh Enter/change path as needed depending on where the file is located. I’ve started putting all my scripts in a folder in Home called scripts so /Home/YourUserName/scripts/Filename. OR find the file in the GUI File Browser right click on it go to properties tab then check box for Execute

4. With the file saved and ready to run you can right click on desktop Create New Launcher, name it then click browse and find the path and file, select an Icon etc. You DON’T want to check box launch in Terminal. It can be added to the Main Menu similarly...just follow guides for adding to the menu which just links to the file.

Install iperf3 on the remote target device and your local device: Your remote device is the server and can be a different operating system just has to be running iperf3

sudo apt update && sudo apt install -y

sudo apt install iperf3

OR your GUI Software Manager

5. On a remote/target machine: Identify IP and use iperf3 -s =to start the server with a default port

6. Click your icon to start the test or run the filename from a terminal by typing ./network_benchgui.sh or with a different path use /Home/USERNAME/PATH/FILENAME ---add path to your file

YOUTUBE VID of it in operation: https://www.youtube.com/watch?v=LZYqqU_LqKg&list=PLqkmlrpDHy5M8Kx7zDxsSAWetAcHWtWFl&index=7

CODE for file:

set -o pipefail

HISTORY_FILE="$HOME/.iperf_target_history"

PORT_HISTORY_FILE="$HOME/.iperf_port_history"

OUTPUT_LOG="/tmp/iperf_gui_output.log"

TMP_IPERF="/tmp/iperf_tmp_$$.log"

SUMMARY_LOG="/tmp/iperf_summary_$$.log"

rm -f "$OUTPUT_LOG" "$TMP_IPERF" "$SUMMARY_LOG"

cleanup() { rm -f "$TMP_IPERF" "$SUMMARY_LOG"; }

trap cleanup EXIT

# ------------------------------------------------------------------

# Helper: Extract only the final Sender + Receiver bitrates

# ------------------------------------------------------------------

extract_final_bitrates() {

awk '

/bits\/sec/ && (/sender/ || /receiver/) {

role = (/sender/) ? "Sender " : "Receiver"

for(i=1; i<=NF; i++) {

if ($i ~ /bits\/sec/) {

value = $(i-1)

unit = $i

if (unit ~ /Gbits/) {

printf "%s : %s Gbits/sec\n", role, value

} else if (unit ~ /Mbits/) {

printf "%s : %s Mbits/sec\n", role, value

} else {

printf "%s : %s %s\n", role, value, unit

}

break

}

}

}

' "$1" | tail -n 2

}

# ------------------------------------------------------------------

# Step 0: Initial reminder

# ------------------------------------------------------------------

yad --image="dialog-information" \

--title="Network BenchGUI" \

--text="⚠️ <b>REMINDER</b> ⚠️\n\nThe remote target machine MUST be running the iperf3 listener:\n\n👉 <b>iperf3 -s -p PORT</b> 👈\n\nEnsure the firewall allows traffic on the chosen port.\n\nReady to proceed?" \

--button="Yes, Server is Ready:0" --button="Exit:1" --width=480 --center

[ $? -ne 0 ] && exit 1

# ------------------------------------------------------------------

# Step 0.5: Port selection

# ------------------------------------------------------------------

PREV_PORT="5201"

if [ -f "$PORT_HISTORY_FILE" ]; then

PREV_PORT=$(tr -d '[:space:]' < "$PORT_HISTORY_FILE")

fi

[ -z "$PREV_PORT" ] && PREV_PORT="5201"

yad --question \

--title="Port Configuration" \

--text="Last used port was <b>$PREV_PORT</b>.\n\nUse this port?" \

--button="Yes, Use $PREV_PORT:0" --button="No, Change Port:1" --center

if [ $? -eq 0 ]; then

TARGET_PORT="$PREV_PORT"

else

TARGET_PORT=$(yad --entry \

--title="Custom Port Entry" \

--text="Enter the current iperf3 port:" \

--entry-text="$PREV_PORT" --center)

if [ $? -ne 0 ] || [ -z "$TARGET_PORT" ]; then

TARGET_PORT="5201"

fi

fi

echo "$TARGET_PORT" > "$PORT_HISTORY_FILE"

# ------------------------------------------------------------------

# Step 1: Target IP

# ------------------------------------------------------------------

PREV_IP=""

[ -f "$HISTORY_FILE" ] && PREV_IP=$(tr -d '[:space:]' < "$HISTORY_FILE")

TARGET_IP=$(yad --entry --title="Target IP Selection" \

--text="Enter target IP address:" --entry-text="$PREV_IP" --center)

if [ $? -ne 0 ] || [ -z "$TARGET_IP" ]; then

exit 1

fi

echo "$TARGET_IP" > "$HISTORY_FILE"

START_TIME=$(date "+%Y-%m-%d %H:%M:%S")

# Master log header

{

echo "=========================================================================="

echo " UNIVERSAL NETWORK PERFORMANCE & SPEED BENCHMARK"

echo "=========================================================================="

echo "Target Destination IP : $TARGET_IP"

echo "Benchmark Target Port : $TARGET_PORT"

echo "Started : $START_TIME"

echo "=========================================================================="

} >> "$OUTPUT_LOG"

# ------------------------------------------------------------------

# Step 2: Connectivity + probe

# ------------------------------------------------------------------

(

echo -e "🔍 <b>[STEP 1 of 4] ROUTING & CONNECTIVITY</b>"

DETECTED_DEV=$(ip route get "$TARGET_IP" 2>/dev/null | grep -oP 'dev \K\S+' || echo "Unknown")

echo "Active Network Interface: $DETECTED_DEV" >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

echo -e "\n[STEP 1a] Latency sweep (ICMP – advisory)..." >> "$OUTPUT_LOG"

ping -c 5 -W 1 "$TARGET_IP" 2>&1 | grep -E "packets transmitted|rtt|100% packet loss|Destination" >> "$OUTPUT_LOG" || true

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

echo -e "\n[STEP 1b] Quick iperf3 TCP probe (3 seconds)..." >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

iperf3 -c "$TARGET_IP" -p "$TARGET_PORT" -t 3 -i 1 > "$TMP_IPERF" 2>&1

PROBE_STATUS=$?

cat "$TMP_IPERF" >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

if [ $PROBE_STATUS -ne 0 ]; then

echo "✘ FATAL: Cannot reach iperf3 server on $TARGET_IP:$TARGET_PORT" >> "$OUTPUT_LOG"

exit 1

fi

echo "✔ iperf3 server is reachable." >> "$OUTPUT_LOG"

) | yad --progress --title="Network Check" --text="Initializing..." \

--pulsate --progress-text=" " --auto-close --width=520 --height=140 --center

if [ $? -ne 0 ]; then

yad --error --title="Connectivity Failed" \

--text="Could not reach the iperf3 server on $TARGET_IP:$TARGET_PORT." --center

yad --text-info --title="Diagnostic Log" --width=750 --height=500 \

--fontname="Monospace 10" --filename="$OUTPUT_LOG" --center

exit 1

fi

PROBE_RESULTS=$(extract_final_bitrates "$TMP_IPERF")

# ------------------------------------------------------------------

# Step 3: Single-stream

# ------------------------------------------------------------------

(

echo -e "🚀 <b>[STEP 2 of 4] SINGLE-STREAM</b>"

echo -e "\n[STEP 2] Single-Stream Performance Test (20 s)..." >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

iperf3 -c "$TARGET_IP" -p "$TARGET_PORT" -t 20 -i 1 > "$TMP_IPERF" 2>&1

cat "$TMP_IPERF" >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

) | yad --progress --title="Single-Stream Run" --text="Active transmission..." \

--pulsate --progress-text=" " --auto-close --width=520 --height=140 --center

SINGLE_RESULTS=$(extract_final_bitrates "$TMP_IPERF")

# ------------------------------------------------------------------

# Step 4: Multi-stream

# ------------------------------------------------------------------

(

echo -e "🏋️‍♂️ <b>[STEP 3 of 4] PARALLEL STREAMS (-P 4)</b>"

echo -e "\n[STEP 3] Parallel Stream Workload (-P 4, 20 s)..." >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

iperf3 -c "$TARGET_IP" -p "$TARGET_PORT" -P 4 -t 20 -i 1 > "$TMP_IPERF" 2>&1

cat "$TMP_IPERF" >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

) | yad --progress --title="Multi-Stream Run" --text="Active parallel transmission..." \

--pulsate --progress-text=" " --auto-close --width=520 --height=140 --center

MULTI_RESULTS=$(extract_final_bitrates "$TMP_IPERF")

# ------------------------------------------------------------------

# Build Clean Summary

# ------------------------------------------------------------------

{

echo "==================== QUICK SUMMARY ===================="

echo "Target : $TARGET_IP"

echo "Port : $TARGET_PORT"

echo "Started : $START_TIME"

echo "Finished : $(date '+%Y-%m-%d %H:%M:%S')"

echo

echo "----- Probe (3 seconds) -----"

echo "$PROBE_RESULTS"

echo

echo "----- Single-Stream (20 seconds) -----"

echo "$SINGLE_RESULTS"

echo

echo "----- Multi-Stream (-P 4, 20 seconds) -----"

echo "$MULTI_RESULTS"

echo "========================================================="

} > "$SUMMARY_LOG"

echo >> "$OUTPUT_LOG"

cat "$SUMMARY_LOG" >> "$OUTPUT_LOG"

# ------------------------------------------------------------------

# Show Summary – Main tests

# Buttons: OK | Advanced | Test Again | Finished

# ------------------------------------------------------------------

while true; do

yad --text-info --title="Benchmark Results – Quick Summary" \

--width=700 --height=500 --fontname="Monospace 11" \

--filename="$SUMMARY_LOG" --center \

--button="Continue:0" \

--button="Advanced Summary:1" \

--button="Test Again:3" \

--button="Finished:2"

case $? in

0) # OK → continue to reverse

break

;;

yad --text-info --title="Full Detailed Log" \

--width=850 --height=650 --fontname="Monospace 10" \

--filename="$OUTPUT_LOG" --center \

--button="Back:0"

;;

3) # Test Again → restart script

exec bash "$0"

;;

2|*) # Finished

exit 0

;;

esac

done

# ------------------------------------------------------------------

# Step 5: Optional reverse test

# ------------------------------------------------------------------

yad --question \

--title="Reverse Path Test" \

--text="Run the REVERSE path test?\n\n(Target will upload back to you)" --center

if [ $? -eq 0 ]; then

(

echo -e "📥 <b>[STEP 4 of 4] REVERSE PATH</b>"

{

echo

echo "=========================================================================="

echo " REVERSE PATH TEST EXECUTION"

echo "=========================================================================="

echo "Target ($TARGET_IP) is UPLOADING to you on port $TARGET_PORT"

echo "--------------------------------------------------------------------------"

} >> "$OUTPUT_LOG"

iperf3 -c "$TARGET_IP" -p "$TARGET_PORT" -P 4 -t 20 -R -i 1 > "$TMP_IPERF" 2>&1

cat "$TMP_IPERF" >> "$OUTPUT_LOG"

echo "--------------------------------------------------------------------------" >> "$OUTPUT_LOG"

) | yad --progress --title="Running Reverse Benchmarks" --text="Initializing reverse path..." \

--pulsate --progress-text=" " --auto-close --width=520 --height=140 --center

REVERSE_RESULTS=$(extract_final_bitrates "$TMP_IPERF")

{

echo

echo "----- Reverse Path (-P 4, 20 seconds) -----"

echo "$REVERSE_RESULTS"

echo "========================================================="

} >> "$SUMMARY_LOG"

echo >> "$OUTPUT_LOG"

cat "$SUMMARY_LOG" >> "$OUTPUT_LOG"

# ------------------------------------------------------------------

# Final Summary after Reverse

# Buttons: Test Again | Advanced | Finished

# ------------------------------------------------------------------

while true; do

yad --text-info --title="Reverse + Full Summary" \

--width=700 --height=540 --fontname="Monospace 11" \

--filename="$SUMMARY_LOG" --center \

--button="Test Again:3" \

--button="Advanced Summary:1" \

--button="Finished:2"

case $? in

3) # Test Again

exec bash "$0"

;;

yad --text-info --title="Full Detailed Log" \

--width=850 --height=650 --fontname="Monospace 10" \

--filename="$OUTPUT_LOG" --center \

--button="Back:0"

;;

2|*) # Finished

exit 0

;;

esac

done

fi

exit 0

0 Upvotes

1 comment sorted by

1

u/MrMotofy 20d ago edited 20d ago

I just updated this script with some additional buttons. I also added a quick summary that makes the speed review simpler, yet the full info is available from the Advanced button. In case a user isn't as familiar with the info