set-networking 559 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. # cd into the directory containing this script (from the bash faq 028)
  3. if [[ $BASH_SOURCE = */* ]]; then
  4. cd -- "${BASH_SOURCE%/*}/" || exit
  5. fi
  6. latency=30ms
  7. bw=100mbit
  8. if [ "$1" != "" ]; then
  9. latency="$1"
  10. fi
  11. if [ "$2" != "" ]; then
  12. bw="$2"
  13. fi
  14. ./unset-networking
  15. docker exec --privileged ramen_p0 tc qdisc add dev eth0 root netem delay $latency rate $bw
  16. docker exec --privileged ramen_p1 tc qdisc add dev eth0 root netem delay $latency rate $bw
  17. docker exec --privileged ramen_p2 tc qdisc add dev eth0 root netem delay $latency rate $bw