iperf3 as a Service
To make sure that iperf is always running when you restart your machine you can set it to run as a service
first step is to make a nologin user for the service
useradd -M iperf
then build a service file, the location depends on the Linux OS.
- REDHAT/FEDORA create
/usr/lib/systemd/system/iperf3.service
- DEBIAN/UBUNTU create
/etc/systemd/system/iperf3.service
[Unit]
Description="iperf3 server"
After=network.target
[Service]
Type=simple
User=iperf
ExecStart=/usr/bin/iperf3 -s
KillMode=process
Restart=on-abort
[Install]
WantedBy=multi-user.target
enable and start the service
systemctl enable --now iperf3
now since it is a service, the logs could be picked up easily in a journal
journalctl -u iperf3
for more info on iperf3 parameters see the official documentation at the iperf homepage