Changing Link Quality on Linux Router
Article based on Ubuntu 16.04 on ESXi 6.5
Applications used: netem (pre-installed on Ubuntu 16.04)
Pre-req: Linux Router
Using the netem feature you can set latency, Jitter, and Packet loss on a specific link/interface. netem uses multiple features and changes multiple files at the same time, so the tc qdis command needs to be used for this (Read more here).
These changes do not stay after a reboot, so you will have to save them in a rc.local script or in the /etc/network/interfaces or just run the command as needed.
Examples:
The command below will add an additional 100ms latency onto your link with a 20ms Jitter at a 10% random interval.
tc qdisc change dev ens192 root netem delay 100ms 20ms 10%
For more detailed information on use cases go to: https://wiki.linuxfoundation.org/networking/netem