Skip to content

Instantly share code, notes, and snippets.

Created December 26, 2012 23:04
Show Gist options
  • Save anonymous/4383811 to your computer and use it in GitHub Desktop.
Save anonymous/4383811 to your computer and use it in GitHub Desktop.
IPFirewall
you can run the command: "nettop -m tcp" in the terminal to show you all the tcp connections such as uploading and downloading. locate the host that is responsible for the bandwidth activity that is maxing out your internet, whether it be uploading or downloading then you can use the tool ipfw (ip firewall) to limit the bandwidth to that host. I'll use my scenario as an example. I was uploading to largedocument.com (discovered the host with nettop) I can run the following two commands to limit the upload speed to largedocument.com to 25Kbits/s by running:
sudo ipfw pipe 1 config bw 25KByte/s
sudo ipfw add 1 pipe 1 dst-ip largedocument.com
this works great! upload to largedocument.com is reduced to 25 kb/s. And then to remove the bandwidth limitation later, just run the command:
sudo ipfw delete 1
There is a ton of stuff you can do with ipfw, check out the man page here: https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/ipfw.8.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment