I can never remember how to set it up, so here for my own sake:
First setup a virtual "pipe", for example one like this limiting whatever we put through it to 800Kbit per second:
ipfw pipe 1 config bw 800Kbit
You could also use say bw 70KB
to limit to 70KByte per second. There are also a bunch of other parameters for the pipes, but the bandwidth limiter is the most useful for everyday use.
Now setup rules to push traffic through the pipe. For example right now I wanted to limit bittorrent traffic, so I made port 6881 to 6885 go through the pipe:
ipfw add 10 pipe 1 tcp from any to me 6881-6890
ipfw add 11 pipe 1 tcp from any 6881-6890 to me
You can see your pipes with ipfw pipe show
(just as you see the regular rules with ipfw show
.
Another example, limit the bandwidth from us to another host 10Kbit/sec:
ipfw pipe 2 config bw 10Kbit
ipfw add 15 pipe 2 ip from me to 64.81.84.114
With this then we can download however fast we want from 64.81.84.114, but they can only use 10Kbit of our outgoing bandwidth.
Pretty neat, huh?
update: many more examples on Luigi Rizzo's dummynet page...