Configiring iperf3 server on router

Hi, sorry for noob question.
How can I configure iperf3 server on OpenWRT with autorun after booting and make it accessible from "outside"?
I want to give ability to my ISP measure link speed to my router.
And can I automatically save the logs on the router with ISP's speed testing results?

A few thoughts (depends on your hardware):

  • Your results may not be representitive of your actual ISP speeds, depending on the router hardware and the nominal speed of your connection. Many all-in-one routers can route at high speeds, but may only source/sink packets at much slower rates due to the CPU (which is optimized for routing, not packet generation/termination).
  • Writing to your on board flash storage (if you've got an all-in-one device) will accelerate potential flash wear, which can end up damaging the flash memory which can render your device useless.
  • Do you really want to run an iPerf server that is accessable from the outside? Typically, if you want to run tests from your router, you'll want to operate it in client mode, and it doesn't need to be 'accessable' since it is the one that is initiating the connection.
  • Where is the other endpoint? Does your ISP have an iPerf endpoint that you can use?
1 Like

I want to give to my ISP ability to measure connection speed to my router. ISP will run "client-side" iperf3. Roter will run "server-side" iperf3.
I don't care about security reasons in this case.
I don't care about router's memory degradation too. I run OpenWRT from sd-card.
So I just want to know how to setup iperf3 server. Autorun it after booting. Make it accessible from WAN. Save the logs, if someone run iperf test.

Assuming you're going to use the default port:

uci add firewall rule
uci set firewall.@rule[-1].name="Allow-iperf3-from-WAN"
uci add_list firewall.@rule[-1].proto="tcp"
uci add_list firewall.@rule[-1].proto="udp"
uci set firewall.@rule[-1].src="wan"
uci set firewall.@rule[-1].dest_port="5201"
uci set firewall.@rule[-1].target="ACCEPT"
uci commit firewall
/etc/init.d/firewall restart

Insert the following into /etc/rc.local above exit 0.

/usr/bin/iperf3 -s --logfile /tmp/iperf3.log &

Change the log filename and location of your choice.

1 Like

Thank you for your help.

1 Like