0

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?

user886869
  • 245
  • 1
  • 2
  • 10
  • Have you tried running the tests without iptables dropping packets? What exactly are you trying to accomplish? Iperf3 is a great network testing tool but I’m not sure what he purpose of artificially introducing packet loss is for. You know what you’re going to see - dropped packets. If you want to see dropped packets just increase the bandwidth. Which, btw, 300Mbps for UDP is very high even for a gigabit network. Likely that’s your problem. Start at a lower bandwidth and stop introducing packet loss artificially. It will happen naturally just by increasing the speed. – Appleoddity Aug 18 '18 at 06:29
  • @Appleoddity, yes without the iptables UDP worked fine. With the iptables and TCP it also worked fine. I'm testing a system to detect bad links, so I want to simulate a "bad network" to be able to test my algorithms. I wanted to see packet loss %, and what I'm seeing are some iperf errors. Is iperf using UDP not robust enough for this scenario with random packet drop? – user886869 Aug 18 '18 at 13:28
  • 1
    I have used UDP tests quite frequently and it works fine. Try dropping the packets on host B input chain. Something you are doing is messing things up. I found info suggesting dropping packets on the output side is reported to the upper level network stack. That doesn’t simulate a real world test anyways. Packets are not dropped before they hit the wire. They are dropped on the wire before they hit the target. – Appleoddity Aug 18 '18 at 15:18

1 Answers1

0

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

user886869
  • 245
  • 1
  • 2
  • 10