Back to blog

Limiting Bandwidth in OSX

October 6, 2008 - Posted in Operating Systems Posted by:

Tags: , , , , ,

Here is a neat trick to limit the amount of bandwidth you get from a specific IP or web address. I setup a box for my last company that used this technique to simulate sever and client being in different locations, great for performance testing. It uses a BSD command called ipfw or IP Firewall, which allows you to create pipes and queues to simulate any sort of network conditions. In a terminal type the following, replacing the x’s with an IP address:

ipfw add pipe 1 ip from xxx.xxx.xxx.xxx to any

ipfw pipe 1 config bw 5000kbit/s

Now you will get a maximum of 5000 Kbit/s form the IP address you entered. You don’t even have to be root to do this.

You can also use this to limit say the amount of bandwidth you give a particular IP address, great for when people are leeching off you, just swap from and to. This setup is an example of Dummynet.

One Comment

Kelly yturralde 15 years ago

Stephen! Dummynet will never fail j00! Sup yo? Found you online! long time no chat!

Leave a Reply

Your email address will not be published. Required fields are marked *