From 75dac614166149b485040893dd841b4c57c53103 Mon Sep 17 00:00:00 2001 From: leif davisson Date: Sun, 15 Nov 2026 13:16:16 -0800 Subject: [PATCH] feat(ct): add iperf3 server LXC script --- ct/iperf3.sh | 72 +++++++++++++++++++++++++++++++++++++ install/iperf3-install.sh | 74 +++++++++++++++++++++++++++++++++++++++ json/iperf3.json | 62 ++++++++++++++++++++++++++++++++ 3 files changed, 208 insertions(+) create mode 100755 ct/iperf3.sh create mode 100755 install/iperf3-install.sh create mode 100644 json/iperf3.json diff --git a/ct/iperf3.sh b/ct/iperf3.sh new file mode 100755 index 0000000000..325b63878b --- /dev/null +++ b/ct/iperf3.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main" +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Leif Davisson (leifdavisson) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/esnet/iperf + +APP="iPerf3" +var_tags="${var_tags:-network;benchmark;iperf3}" +var_cpu="${var_cpu:-1}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then + var_os=$(msg_menu "Choose the container OS" \ + "debian" "Debian 13" \ + "alpine" "Alpine (smaller footprint)") +fi + +if [[ "${var_os:-}" == "alpine" ]]; then + var_ram="${var_ram:-256}" + var_disk="${var_disk:-1}" + var_version="${var_version:-3.24}" +else + var_os="${var_os:-debian}" + var_ram="${var_ram:-512}" + var_disk="${var_disk:-2}" + var_version="${var_version:-13}" +fi + +header_info "$APP" +variables +color +catch_errors + +update_deb_based() { + msg_info "Updating iPerf3" + $STD apt update + $STD apt upgrade -y + systemctl restart iperf3 + msg_ok "Updated iPerf3" +} + +update_alpine() { + msg_info "Updating iPerf3" + $STD apk -U upgrade + $STD rc-service iperf3 restart + msg_ok "Updated iPerf3" +} + +function update_script() { + header_info + check_container_storage + check_container_resources + if ! command -v iperf3 >/dev/null 2>&1; then + msg_error "No ${APP} Installation Found!" + exit + fi + run_os_update + exit +} + +start +build_container +description + +msg_ok "Completed successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW}iPerf3 server is listening on port 5201:${CL}" +echo -e "${GATEWAY}${BGN}iperf3 -c ${IP}${CL}" diff --git a/install/iperf3-install.sh b/install/iperf3-install.sh new file mode 100755 index 0000000000..798fdd7bf5 --- /dev/null +++ b/install/iperf3-install.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: Leif Davisson (leifdavisson) +# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE +# Source: https://github.com/esnet/iperf + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +setup_deb_based() { + msg_info "Installing iPerf3" + $STD apt install -y iperf3 + msg_ok "Installed iPerf3" + + msg_info "Creating Service" + cat <<'EOF' >/etc/systemd/system/iperf3.service +[Unit] +Description=iPerf3 Network Bandwidth Server +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +User=nobody +Group=nogroup +ExecStart=/usr/bin/iperf3 -s +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF + systemctl enable -q --now iperf3 + msg_ok "Created Service" +} + +setup_alpine() { + msg_info "Installing iPerf3" + $STD apk add --no-cache iperf3 + msg_ok "Installed iPerf3" + + msg_info "Creating Service" + cat <<'EOF' >/etc/init.d/iperf3 +#!/sbin/openrc-run +name="iPerf3" +description="iPerf3 Network Bandwidth Server" +command="/usr/bin/iperf3" +command_args="-s" +command_user="nobody:nobody" +command_background="yes" +pidfile="/run/iperf3.pid" + +depend() { + need net + after firewall +} +EOF + chmod +x /etc/init.d/iperf3 + $STD rc-update add iperf3 default + $STD rc-service iperf3 start + msg_ok "Created Service" +} + +run_os_setup + +motd_ssh +customize +cleanup_lxc diff --git a/json/iperf3.json b/json/iperf3.json new file mode 100644 index 0000000000..84a9ac8f00 --- /dev/null +++ b/json/iperf3.json @@ -0,0 +1,62 @@ +{ + "name": "iPerf3", + "slug": "iperf3", + "categories": [ + 4 + ], + "date_created": "2026-11-15", + "type": "ct", + "platforms": [ + "pve" + ], + "architectures": [ + "amd64", + "arm64" + ], + "updateable": true, + "privileged": false, + "interface_port": 5201, + "documentation": "https://software.es.net/iperf/", + "website": "https://software.es.net/iperf/", + "repository": "https://github.com/esnet/iperf", + "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/iperf3.webp", + "description": "iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks. This container runs an always-on iperf3 server on TCP/UDP port 5201 for local LAN and Wi-Fi throughput benchmarking.", + "install_methods": [ + { + "type": "default", + "script": "ct/iperf3.sh", + "resources": { + "cpu": 1, + "ram": 512, + "hdd": 2, + "os": "Debian", + "version": "13" + } + }, + { + "type": "alpine", + "script": "ct/iperf3.sh", + "resources": { + "cpu": 1, + "ram": 256, + "hdd": 1, + "os": "Alpine", + "version": "3.24" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "Test TCP throughput from any client on your network with: iperf3 -c ", + "type": "info" + }, + { + "text": "Test download (server-to-client) throughput with: iperf3 -c -R", + "type": "info" + } + ] +}