I haven't attempted to impliment it as of yet, however, the iproute2 utility "tc" is located in "/bin" - this is the Linux traffic control tool used for traffic shaping.
I would recommend all to read the Linux 2.4 Advanced Routing HOWTO.
If the Astaro Admins have any input on how to best integrate traffic shaping into a stock Astaro install, please contribute!
Yes, aparently all the needed traffic control (QoS - Advanced routing) stuff has been compiled into the kernel leaving us with an operable platform for traffic control.
The following (basic) script divides up a 512Kbit connection into a 160Kbit connection from internal computer 10.0.0.151 and a 80Kbit connection from 10.0.0.203 - any other computer using the Astaro box as the gateway is unaffected by the traffic control...
Save the following into an executable script file and run it. (Directly taken from the Linux 2.4 Advanced Routing HOWTO)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Divide the upstream bandwidth
# Setup traffic control - queueing disciplin of eth0 # we denote that this is the root discipline, given the handle of 10 # we denote that CBQ is to be used # Tell the kernel that it can allocate 10Mbit # The average packet is somewhere around 1000 octets
Another note about the script that I pointed earlier, if you need to RESET the traffic control, you have two options, reboot the machine (We run Linux, not Windows - we shouldn't NEED to reboot for a config change) -OR- run a script to delete each of the items that my original script created - I haven't found a command to zero the settings out. So I use the following script to delete the traffic control items:
(I've simply reversed the order of the original script and replaced "add" with "del" - this works fine, however it's a hefty way to make changes. - I've been using the echos for brief runtime debug - nothing elaborate)
Thanks Jake
#### Remove the traffic control settings ### echo "#1 " tc filter del dev eth0 parent 10:0 protocol ip prio 25 u32 match ip dst \ 10.0.0.151 flowid 10:100
echo "#2 " tc filter del dev eth0 parent 10:0 protocol ip prio 100 u32 match ip dst \ 10.0.1.3 flowid 10:200
echo "#3 " tc qdisc del dev eth0 parent 10:100 sfq quantum 1514b perturb 15 tc qdisc del dev eth0 parent 10:200 sfq quantum 1514b perturb 15
echo "#4 " tc class del dev eth0 parent 10:1 classid 10:200 cbq bandwidth 512Kbit rate \ 80Kbit allot 1514 weight 8Kbit prio 5 maxburst 20 avpkt 1000 \ bounded
echo "#5 " tc class del dev eth0 parent 10:1 classid 10:100 cbq bandwidth 512Kbit rate \ 160Kbit allot 1514 weight 16Kbit prio 5 maxburst 20 avpkt 1000 \ bounded
echo "#6 " tc class del dev eth0 parent 10:0 classid 10:1 cbq bandwidth 512Kbit rate \ 512Kbit allot 1514 weight 51Kbit prio 8 maxburst 20 avpkt 1000
echo "#7 " tc qdisc del dev eth0 root handle 10: cbq bandwidth 512Kbit avpkt 1000
Another note about the script that I pointed earlier, if you need to RESET the traffic control, you have two options, reboot the machine (We run Linux, not Windows - we shouldn't NEED to reboot for a config change) -OR- run a script to delete each of the items that my original script created - I haven't found a command to zero the settings out. So I use the following script to delete the traffic control items:
(I've simply reversed the order of the original script and replaced "add" with "del" - this works fine, however it's a hefty way to make changes. - I've been using the echos for brief runtime debug - nothing elaborate)
Thanks Jake
#### Remove the traffic control settings ### echo "#1 " tc filter del dev eth0 parent 10:0 protocol ip prio 25 u32 match ip dst \ 10.0.0.151 flowid 10:100
echo "#2 " tc filter del dev eth0 parent 10:0 protocol ip prio 100 u32 match ip dst \ 10.0.1.3 flowid 10:200
echo "#3 " tc qdisc del dev eth0 parent 10:100 sfq quantum 1514b perturb 15 tc qdisc del dev eth0 parent 10:200 sfq quantum 1514b perturb 15
echo "#4 " tc class del dev eth0 parent 10:1 classid 10:200 cbq bandwidth 512Kbit rate \ 80Kbit allot 1514 weight 8Kbit prio 5 maxburst 20 avpkt 1000 \ bounded
echo "#5 " tc class del dev eth0 parent 10:1 classid 10:100 cbq bandwidth 512Kbit rate \ 160Kbit allot 1514 weight 16Kbit prio 5 maxburst 20 avpkt 1000 \ bounded
echo "#6 " tc class del dev eth0 parent 10:0 classid 10:1 cbq bandwidth 512Kbit rate \ 512Kbit allot 1514 weight 51Kbit prio 8 maxburst 20 avpkt 1000
echo "#7 " tc qdisc del dev eth0 root handle 10: cbq bandwidth 512Kbit avpkt 1000