Re: How to shape VoIP traffic on FreeBSD 4.8 router?

From: Jed Clear (clear_at_alum.mit.edu)
Date: 09/20/03


Date: Sat, 20 Sep 2003 18:05:05 GMT

Rob Levandowski wrote:
>
> I have a FreeBSD 4.8 system that acts as the router between my cable
> modem connection and my internal network. I recently purchased VoIP
> service from Vonage. My cable connection has a fairly limited upstream
> -- somewhere between 256Kbps and 300Kbps, depending on the phase of the
> moon -- and it's easy to congest it.
>
> I'd like to configure my router box so that traffic from the VoIP
> adapter has priority over, say, FTP traffic.
>
> Ideally, I'd also like to give TCP ACK packets a priority boost.
>
> Although I'm quite familiar with UNIX, I'm not a TCP/IP guru. The
> documentation out there for dummynet isn't exactly up to O'Reilly
> standards. In fact, from what I can find on the 'net and the man pages,
> I'm not sure if dummynet can even do what I want. (That is, prioritize
> traffic without assimilating bandwidth. I do NOT want to dedicate
> 160Kbps to the Vonage box and have it sit idle when I'm off the phone; I
> simply want the Vonage box to always get 160Kbps of the bandwidth when
> the pipe is full.)
>
> Is there a way to do this in FreeBSD?

If you had fixed upstream bandwidth, you could do it with dummynet
easily. Define 1 pipe for the entire upstream bandwidth. Then define
two queues on that pipe one with higher priority. Then add the packets
to the appropriate queues using normal ipfw expressions on packets going
out your outside interface. IPFW example (not VoIP, but hopefully you
can adapt):

// Setup DummyNet
disable one_pass // packets exiting pipe resume rule
checking
pipe 1 config bw 128Kbits/s // DSL uplink
queue 1 config pipe 1 weight 20 // fast track for lowdelay packets
queue 2 config pipe 1 weight 1 // normal track
[other rules including natd divert]
// traffic shaping
add queue 1 ip from any to any ssh,telnet,ntp out via oif
add queue 2 ip from any to any not ssh,telnet,ntp out via oif
// end example

"oif" should be replaced by your outside network device (e.g. rl0). You
may need add some more options to the pipe or queue to keep the VoIP
latency down. You could even put the VoIP in a 3rd, higher priority
queue. Your biggest problem is creating an artificial upper bound on
your total uplink bandwidth. It might work if you over specify the
uplink b/w slightly in the pipe command. But you'll never go faster
than that. Not a problem with my DSL line, but might be on a shared
medium like Cable.

-Jed



Relevant Pages

  • wierd output from pfctl -vvsq
    ... queue tcp_ack bandwidth 44Kb priority 7 cbq(borrow) ...
    (freebsd-questions)
  • cbq not borrowing fully from parent queue
    ... I'm running 6-STABLE using pf and altq/cbq to manage bandwidth on my ... queue internal bandwidth 53104Kb priority 7 cbq ... so it can't borrow from the root queue. ...
    (freebsd-questions)
  • Re: pf traffic shaping and perfomance
    ... I would like to implement traffic shaping using pf. ... #queue def bandwidth 13% cbq ... #queue ssh_bulk priority 0 ...
    (freebsd-questions)
  • Re: Stop one user from using all Bandwidth? Traffic Shape?
    ... when there is congestion, but allow it to use as much bandwidth as it can ... QoS will start to drop packets from the lower queues before the pipe is ... WFQ is just one of several queue management methods that you can also use ...
    (comp.dcom.sys.cisco)
  • Re: [ckrm-tech] [RFC 3/5] sched: Add CPU rate hard caps
    ... select the "next request queue to service" based on its I/O bandwidth...if a queue exceeds its allocation (as calculated ... So this did not use the CFQ priority scheme as such and only implemented the "limit" part. ... bandwidth differential between those prio levels. ...
    (Linux-Kernel)