Created
April 24, 2018 08:24
-
-
Save nolash/3a0294d7722cb89120757c473f2be026 to your computer and use it in GitHub Desktop.
swarm throttling with iptables + tc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
UID=$1 | |
iptables -A OUTPUT -t mangle -m owner --uid-owner $UID -j MARK --set-mark 6 | |
tc qdisc add dev enp2s0 root handle 1: htb default 30 | |
tc class add dev enp2s0 parent 1: classid 1:1 htb rate 6mbit burst 15k | |
tc class add dev enp2s0 parent 1: classid 1:2 htb rate 1mbit burst 15k | |
tc filter add dev enp2s0 protocol ip parent 1:0 prio 1 handle 6 fw flowid 1:2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment