Why isn’t ipfw correctly limiting the bandwidth

bandwidth-controlipfwosx-lion

I've played around with the ipfw command on a Mac and tried to limit the bandwidth to 1MBit/s.

sudo ipfw add pipe 1 ip from any to me
sudo ipfw pipe 1 config bw 1MBit/s

These are the statements I'm using. ipfw indeed limits the bandwidth drastically but according to speedtest.net only to ~7.7 Mbps on a 100 Mbps line. With a restriction to 3MBit/s the effective download is ~23.13 Mbps. Apparently the ipfw always uses a factor ~7.7 of the given limit. With a limit of 4 Mbps the effective speed is ~30,84 Mbps, with 8 Mbps it's ~61.6 Mbps and so on…

Anyone knows why this is the reason? Is it a bug or do I use the statement wrong?

Thank you

Best Answer

Seems like your IPFW treat bw xMBits as xMBytes by first significant letters in the units :) Just lowercase to xMbits and probably you'll get what you want.

man ipfw

bw bandwidth | device
             Bandwidth, measured in [K|M]{bit/s|Byte/s}.