3

I am testing the resilience of one of our streaming applications to handle packet losses. On linux machines I normally use iptables to randomly drop packets like this:

iptables -A INPUT -m statistic --mode random --probability 0.1 -j DROP

I need to test this on a server that is currently running OSX. Any ideas how to randomly drop packets on an OSX Server or Mac computer?

/Andy

2 Answers 2

4

The tool you're looking for is dnctl. To quote from the manpage:

 plr packet-loss-rate
       Packet loss rate.  Argument packet-loss-rate is a floating-point number between 0 and 1, with 0 meaning no loss, 1 meaning 100% loss.  The loss rate is internally repre-
       sented on 31 bits.

And:

To drop random incoming IPv4 and IPv6 ICMP packets with a probability of 5%, create a pipe:

dnctl pipe 10 config plr 0.05
1
  • Thanks, this put me in the right direction, but as I haven't used dnctl and the related dummy net tools, it wasn't that wasn't straightforward to apply. It did help me solve the problem though, so thanks!
    – Andy
    Feb 3, 2016 at 18:04
3

The answer by Teun Vink to use dnctl works, but is a bit tweaky as it relies on a bit of other configuration. Looking into this tool, I found that Xcode has an extension called Network Link Conditioner that is more a GUI interface for this that works really great. See here for instructions.

For a scripted solution, Teun's is the way.

Thanks!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .