Skip to content

Instantly share code, notes, and snippets.

@SebastianEngel
Created September 24, 2014 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SebastianEngel/e069a21d6f971d896e89 to your computer and use it in GitHub Desktop.
Save SebastianEngel/e069a21d6f971d896e89 to your computer and use it in GitHub Desktop.
Throttle the bandwidth used by Google Drive. See http://dwipal.tumblr.com/post/33759562048/throttle-google-drive
#!/bin/bash
# Usage: throttle_google_drive.sh <start/stop>
function start_ipfw_throttle() {
sudo ipfw pipe 1 config bw 100KByte/s
sudo ipfw add 1 pipe 1 ip from me to 64.18.0.0/20
sudo ipfw add 1 pipe 1 ip from me to 64.233.160.0/19
sudo ipfw add 1 pipe 1 ip from me to 66.102.0.0/20
sudo ipfw add 1 pipe 1 ip from me to 66.249.80.0/20
sudo ipfw add 1 pipe 1 ip from me to 72.14.192.0/18
sudo ipfw add 1 pipe 1 ip from me to 74.125.0.0/16
sudo ipfw add 1 pipe 1 ip from me to 173.194.0.0/16
sudo ipfw add 1 pipe 1 ip from me to 207.126.144.0/20
sudo ipfw add 1 pipe 1 ip from me to 209.85.128.0/17
sudo ipfw add 1 pipe 1 ip from me to 216.239.32.0/19
}
function stop_ipfw_throttle() {
sudo ipfw delete 1
}
function show_ipfw_status() {
sudo ipfw show
}
case "$1" in
start)
stop_ipfw_throttle >/dev/null 2>&1
start_ipfw_throttle
;;
stop)
stop_ipfw_throttle
;;
*)
echo "Usage: `basename "$0"` <start/stop>"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment