Iperf3 UDP Reliability Issues with Iptables Drop Random

iperfiptableslinux-networkingnetworkingperformance-monitoring

I'm performing some local test on my network with iperf3 using UDP connections between 2 Ubuntu 18.04 hosts. But it seems that the UDP iperf3 connections it is not robust to support a random packet drop of 0.1?
When executing the iperf3 tests, the server hangs (i need to restart the server to allow connecting again) and I'm seeing this errors:

At the server:

iperf3: the client has unexpectedly closed the connection

At the client:

error – unable to write to stream socket: Operation not permitted

To simulate/test a bad hop on my network I'm using iptables to generate random packet drops with this command (executed at the host A):

sudo iptables -A OUTPUT -p udp -d HOSTB -m statistic --mode random --probability 0.01 -j DROP

And the iperf3 executed at the host A:

iperf3 --version4 --udp --client 10.0.3.10 --port 4000 --bind 10.0.1.10 --cport 12346 --json --zerocopy --verbose --bandwidth 300M --debug

At the host B i'm using:

iperf3 --verbose --server --port 4000 --version4 --debug

As far as documentation goes, iperf3 can work with very bad networks, what can be happening here?

Best Answer

By the helpful comments from @Appleoddity I found where I now think the error was. Dropping the packets at the output can trigger errors at the application level, instead of only simulating a noisy channel.

By running the iptables drop against the input at the host B the problem is gone:

sudo iptables -A INPUT -p udp -s 10.0.1.10 -m statistic --mode random --probability 0.1 -j DROP

Related Topic