8

I want headless server (running Ubuntu Server 19.10) to be listening for iperf3 request constantly, even after reboot. Currently, I can run it on the terminal using the -c and -d flags which runs it as a daemon (which I think just means in the background).

sudo iperf3 -s -D

But I want it start in this mode all the time on boot, so it is always listening in the background.

When I've done this kind of before, it's involved systemd, which I am not familiar with too much. Don't think there was mention of systemd when I read up on iperf3 program, so is it even compatible with it (or is that statement itself nonsensical?)

Only ever used systemd in very limited ways before when been instructed to in tutorials so not up to speed on its scope.

Artur Meinild
  • 31,035
exharris
  • 173

2 Answers2

14

Since Ubuntu doesn't seem to provide a systemd service for iperf3d, we'll have to write it ourselves.

See https://gist.github.com/auipga/64be019018ef311deba2211ced316f5e, and I'll quote it here as well.

[Unit]
Description=iperf3 server
After=syslog.target network.target auditd.service

[Service] ExecStart=/usr/bin/iperf3 -s

[Install] WantedBy=multi-user.target

put this file in /etc/systemd/system/iperf3.service and then sudo systemctl enable iperf3.

3

For the lazy people like me, here is an easier version of what is listed above. You just need to copy/paste to terminal and the server will be up.

apt-get -y install gdebi iperf3

cat <<- EOF > /etc/systemd/system/iperf3.service [Unit] Description=iperf3 server After=syslog.target network.target auditd.service

[Service] ExecStart=/usr/bin/iperf3 -s

[Install] WantedBy=multi-user.target EOF

sudo systemctl enable iperf3 service iperf3 start

adam p
  • 39