Simulating (emulating?) bad network conditions

Erik Auerswald <[email protected]> Sat, 23 May 2020 20:22:40 +0000
Newsgroups org.kernel.vger.lartc
Message-ID <[email protected]>
Hi,

recently someone asked about a script for simulating or emulating degraded
network conditions.  I could not provide an answer, because I do not have
something like that available, yet.

But I have just read about "Comcast" which seems to do just that:
https://github.com/tylertreat/Comcast

The README.md contains information on how to use iptables and/or tc
directly instead of through Comcast as well:

"""
Linux

On Linux, you can use iptables to drop incoming and outgoing packets.

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

Alternatively, you can use tc which supports some additional options.

    $ tc qdisc add dev eth0 root netem delay 50ms 20ms distribution normal
    $ tc qdisc change dev eth0 root netem reorder 0.02 duplicate 0.05 corrupt 0.01

To reset:

    $ tc qdisc del dev eth0 root netem
"""
                -- https://github.com/tylertreat/Comcast#linux

I have not tested this, but it seems to provide a starting point for
experimentation.

HTH,
Erik
-- 
To a first approximation, we can say that accidents are almost always
the result of incorrect estimates of the likelihood of one or more things.
                        -- C. Michael Holloway, NASA