3

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

EEAA
  • 108,414
  • 18
  • 172
  • 242
TheLostOne
  • 83
  • 1
  • 5
  • I'm also interested if anyone else can reproduce this or if it's an issue on my side. – TheLostOne Mar 30 '12 at 18:31
  • Can you `sudo ipfw show` here? – Kondybas Apr 02 '12 at 22:58
  • @Kondybas `radi:~ Phil$ sudo ipfw show` `00100 2046813 1042400871 pipe 1 ip from any to me` `00200 2223777 296348885 pipe 2 ip from me to any` `65535 7182907 2143167607 allow ip from any to any` aargh.. didn't manage to properly use the code tags – TheLostOne Apr 04 '12 at 11:08
  • other then creating a pipe itself you need to specify which traffic goes through that pipe – alexus Apr 04 '12 at 21:31

1 Answers1

0

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}.
Kondybas
  • 6,864
  • 2
  • 19
  • 24
  • Thank you @Kondybas! The big 'M' was the culprit. Now it's working correctly. Only the time to establish a connection is very long ;-) – TheLostOne Apr 11 '12 at 08:04
  • @TheLostOne Big "B" was a culprit. IPFW treats MB* as MBytes and Mb* as Mbits. So when you declare MBits, IPFW make a decision about units by two first letters. – Kondybas Apr 12 '12 at 08:55
  • Yeah, the big "B" was the reason. Sorry. Somehow mixed up 'M' and 'B' in the above comment :D – TheLostOne Apr 13 '12 at 09:26