Skip to content

Instantly share code, notes, and snippets.

@ggiraldez
Last active August 29, 2015 13:57
Show Gist options
  • Save ggiraldez/9919551 to your computer and use it in GitHub Desktop.
Save ggiraldez/9919551 to your computer and use it in GitHub Desktop.
Configure a Linux network interface to emulate low-bandwidth WAN connection
#!/bin/sh
# clear the previous discipline
tc qdisc del dev eth1 root
# latency 200ms with 20ms variation
# optional: loss 0.1%
tc qdisc add dev eth1 root handle 1:0 netem delay 200ms 20ms
# 256kbit bandwidth
# mtu parameter is very important; http://timesinker.blogspot.com.ar/2011/02/using-linux-tbf-qdisc-for-rate-limiting.html
# 12k for external interfaces, 100k for loopback
tc qdisc add dev eth1 parent 1:1 handle 10: tbf rate 256kbit burst 10kb latency 8ms mtu 12000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment