title |
---|
iperf3 notes |
iperf3: https://software.es.net/iperf/
Current version as of these notes: 3.18
A FreeBSD jail runs iperf3 as a server so there is a consistent target to test against.
This is all basic FreeBSD stuff. The actual server command is:
/usr/local/bin/iperf3 -s -D --idle-timeout 60 --logfile /var/log/iperf3.log
Here is how that gets wrapped into /usr/local/etc/rc.d/iperf3
:
#!/bin/sh
#
# PROVIDE: iperf3
# REQUIRE: NETWORKING
# KEYWORD: shutdown
# SEE ALSO: https://gist.github.com/jg3/e65e79e2907f49612453ce36df19d433
. /etc/rc.subr
name="iperf3"
rcvar="iperf3_enable"
command="/usr/local/bin/iperf3"
command_args="-s -D --idle-timeout 60 --logfile /var/log/iperf3.log"
pidfile="/var/run/${name}.pid"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
iperf3_start() {
echo "Starting ${name}..."
${command} ${command_args}
sleep 1 # Allow time for the daemon to start
pgrep -x iperf3 > ${pidfile} # Capture the PID of the iperf3 process
}
iperf3_stop() {
echo "Stopping ${name}..."
if [ -f ${pidfile} ]; then
kill "$(cat ${pidfile})" && rm -f ${pidfile}
else
echo "${name} is not running (no pidfile found)."
fi
}
load_rc_config $name
: ${iperf3_enable:=NO}
run_rc_command "$1"
And to kick that off at boot there's a line in in /etc/rc.conf
there is a line:
iperf3_enable=YES
Also note that the server is logging output to /var/log/iperf3.log
, which could eventually fill up your disk, so
use newsyslog
(again, more FreeBSD basics) to rotate that log. Adding the following line to /etc/newsyslog.conf
will rotate the log every day at midnight and keep the last seven days of logs:
/var/log/iperf3.log root:wheel 644 7 * @T00 Z /var/run/iperf3.pid
And now, if you want to monitor what's happening on the server you can tail -F /var/log/iperf3.log
This is a collection of client invocations for iperf3
I liked for one reason or another:
iperf3 -c deathray.org --bytes 1024M --bidir
Wrapping this one with watch
runs it each time ... just make sure the -n <seconds>
you give to watch is longer
than the transfer will take.
watch -n 10 "iperf3 -c deathray.org --bytes 10M --bidir"