AKZN Notes

Archives for My Lazy and Forgetful Mind

iPerf3 on Windows 11 with Docker

# iPerf3 on Windows 11 with Docker

This guide explains how to install Docker Desktop on Windows 11, run iPerf3 for network performance testing, and use a single .bat script for quick local, remote, and dual-direction tests.

---

## 1. Install Docker Desktop

1. Download Docker Desktop:
   - [https://www.docker.com/products/docker-desktop/](https://www.docker.com/products/docker-desktop/)

2. Install it with **WSL 2 backend** enabled.
   - During setup, check **Use the WSL 2 based engine**.
   - Ensure you have WSL 2 installed (Windows 11 has it by default).

3. **Start Docker Desktop** after installation.
   - Search for "Docker Desktop" in Start Menu.
   - Wait until the whale icon in the taskbar stops animating.

4. Verify Docker is running:
   ```powershell
   docker version

You should see both Client and Server sections.


2. Download the iPerf3 Docker Image

In PowerShell, Command Prompt, or Windows Terminal, run:

docker pull networkstatic/iperf3

3. Run iPerf3 in Server Mode

On the device you want to act as the server:

docker run -it --rm --name iperf3-server -p 5201:5201 networkstatic/iperf3 -s
  • -p 5201:5201 → Exposes the default iPerf3 port.
  • -s → Server mode.

4. Run iPerf3 in Client Mode

On the device you want to test from:

docker run -it --rm networkstatic/iperf3 -c <server-ip>

Example:

docker run -it --rm networkstatic/iperf3 -c 192.168.1.10

If the server is on the same Windows PC:

docker run -it --rm networkstatic/iperf3 -c host.docker.internal

5. Quick Local Test (Same PC)

If you just want to test iPerf3 locally without another device:

Step 1 – Open Terminal 1 and start the server:

docker run -it --rm -p 5201:5201 networkstatic/iperf3 -s

Step 2 – Open Terminal 2 and run the client:

docker run -it --rm networkstatic/iperf3 -c host.docker.internal

6. Useful Options

  • Test both directions:

    docker run -it --rm networkstatic/iperf3 -c  -d
  • Change duration (default is 10 seconds):

    docker run -it --rm networkstatic/iperf3 -c  -t 30
  • Set parallel streams:

    docker run -it --rm networkstatic/iperf3 -c  -P 4

7. All-in-One .bat Script

Save the following as iperf3_test.bat:

@echo off
REM ========================================================
REM iPerf3 Test Menu (Docker)
REM Allows selection of Local, Remote, and Dual-Direction tests
REM ========================================================

:check_docker
docker version >nul 2>&1
if %errorlevel% neq 0 (
    echo [ERROR] Docker is not running. Please start Docker Desktop first.
    pause
    exit /b
)

:menu
cls
echo =======================================
echo iPerf3 Test Menu (Docker on Windows 11)
echo =======================================
echo [1] Local Test (same PC)
echo [2] Remote Test (enter server IP)
echo [3] Remote Dual-Direction Test (-d)
echo [4] Exit
echo =======================================
set /p choice=Choose an option: 

if "%choice%"=="1" goto local_test
if "%choice%"=="2" goto remote_test
if "%choice%"=="3" goto remote_dual
if "%choice%"=="4" exit
goto menu

:local_test
echo.
echo [INFO] Starting local test...
start "iPerf3 Server" cmd /k docker run -it --rm -p 5201:5201 networkstatic/iperf3 -s
timeout /t 3 /nobreak >nul
start "iPerf3 Client" cmd /k docker run -it --rm networkstatic/iperf3 -c host.docker.internal
goto end

:remote_test
set /p SERVER_IP=Enter iPerf3 server IP address: 
echo.
echo [INFO] Running iPerf3 client test to %SERVER_IP%...
docker run -it --rm networkstatic/iperf3 -c %SERVER_IP%
pause
goto end

:remote_dual
set /p SERVER_IP=Enter iPerf3 server IP address: 
echo.
echo [INFO] Running iPerf3 dual-direction test to %SERVER_IP%...
docker run -it --rm networkstatic/iperf3 -c %SERVER_IP% -d
pause
goto end

:end
echo.
echo Test finished.
pause

8. Tips

  • Docker Desktop must be running before using docker commands.
  • Make sure your firewall allows port 5201.
  • For WAN tests, ensure your router forwards port 5201 to your iPerf3 server.

Leave a Reply

Your email address will not be published.