#!\/bin\/bash<\/p>\n
# Script to throttle uploads during the times when Virgin
# won’t allow unlimited uploads.
#
# Those times are between 1500 and 2000 no more than
# 1.5GB must be uploaded, so the upload speed needs to be
# capped at 83.3kB\/s.<\/p>\n
maxRate=83.3kbps
burstRate=100000kbps
interface=eth0<\/p>\n
clearRule(){
# First things first, clear the old rule
tc qdisc del dev eth0 root
}<\/p>\n
makeRule(){
# Now add the throttling rule
tc qdisc add dev $interface root handle 1:0 htb default 10
tc class add dev $interface parent 1:0 classid 1:10 htb rate $maxRate ceil $burstRate prio 0
}<\/p>\n
listRules(){
tc -s qdisc ls dev $interface
}<\/p>\n
case “$1” in
‘start’)
clearRule
makeRule
;;
‘stop’)
clearRule
;;
‘status’)
listRules
;;
*)
echo “Usage: $0 {start|stop|status}”
;;
esac<\/p><\/blockquote>\n
You’ll note I’ve set a $burstRat<\/span>e value of 100MB\/s. This is probably not necessary, but with the same $burstRate<\/span> value as used in $maxRate<\/span>, I was seeing significant slowdown in the responsiveness of the remote session; I hope this high burst rate will alleviate that slowdown.<\/p>\nI saved this script somewhere where root only could get it and then added the following cronjobs to root’s crontab:<\/p>\n
# Add networking throttling between 1500 and 2000<\/span>
00 15 * * * \/root\/throttle_uploads.sh start<\/span>
00 20 * * * \/root\/throttle_uploads.sh stop<\/span><\/p><\/blockquote>\nSo far, the process appears to be working, insofar as my daily uploads from home to work have slowed to approximately 80kB\/s during the times when Virgin monitor uploads.<\/p>\n","protected":false},"excerpt":{"rendered":"
As I’ve discussed before, the broadband service we receive from Virgin is subject to caps on the traffic on the line during certain times of day (see this post I wrote). Virgin have a relatively complex system for throttling your speed based on the amount you download and upload within certain times. I have a […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,13,12,14,11,7,9,16,8,15],"tags":[],"_links":{"self":[{"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/posts\/9"}],"collection":[{"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":0,"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/posts\/9\/revisions"}],"wp:attachment":[{"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/media?parent=9"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/categories?post=9"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cazenave.co.uk\/wp-json\/wp\/v2\/tags?post=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}