Last active
August 18, 2016 06:06
-
-
Save ffund/547e6257cb3a3f6c52d2885b30483fcc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
qdisc=$1 #pie or red | |
# Get the name of the interface on the router | |
# that connects to the client nodes. | |
# Store the name of the interface in the | |
# variable 'intf' | |
intf=$(route -n | grep "10.10.2.0" | awk '{print $8}') | |
sudo tc qdisc del dev $intf root | |
if [ $qdisc = "pie" ]; then | |
sudo tc qdisc replace dev $intf root handle 1: htb default 1 | |
sudo tc class add dev $intf parent 1:0 classid 1:1 htb rate 10mbit ceil 10mbit | |
sudo tc qdisc add dev $intf parent 1:1 handle 10: pie limit 2000 alpha 2 beta 20 | |
else | |
sudo tc qdisc replace dev $intf root handle 1: htb default 1 | |
sudo tc class add dev $intf parent 1:0 classid 1:1 htb rate 10mbit ceil 10mbit | |
sudo tc qdisc add dev $intf parent 1:1 handle 10: red min 0.4mb max 1.6mb probability 0.1 limit 2mb burst 800 avpkt 1kb bandwidth 10mbit | |
fi | |
sudo tc qdisc show dev $intf | |
sudo tc class show dev $intf | |
/usr/local/bin/queuemonitor $intf 250 0.1 > router_$qdisc.txt & | |
nload $intf | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment