Subject: Re: traffic shaping with NetBSD?
To: None <netbsd-users@netbsd.org>
From: Michael Parson <mparson@bl.org>
List: netbsd-users
Date: 09/05/2005 10:36:10
On Mon, Sep 05, 2005 at 02:43:34PM +0200, Geert Hendrickx wrote:
> Hello guys, 
> 
> Thanks for the pointers to ALTQ and some of its documentation.  But it
> seems complex to me.  Can anyone show me an example altq.conf which
> resserves a minimum bandwidth for ssh connections?  I guess this can be
> done easily, but I don't know how.  

Here's my /etc/altq.conf, complete with comments:

==== cut here ====

# interface  if_name [bandwidth bps] [tbrsize bytes] [sched_type] [discipline-specific-options]
# borrowed heavily from:
# http://www.muine.org/~hoang/netnat.html

# limit fpx0 to 1.5m over all, set to int max if you want full bandwidth
interface fxp0 bandwidth 1.5m tbrsize 1500 cbq

class cbq fxp0 root NULL pbandwidth 100
#
# meta classes
#
class cbq fxp0 ctl_class root pbandwidth 4 control
class cbq fxp0 def_class root borrow pbandwidth 95 default
#
# Allocate bandwidth for:
# firstclass: 70%
# businessclass: 15%
# generalclass: 5%
#
class cbq fxp0 firstclass def_class borrow pbandwidth 70
class cbq fxp0 businessclass def_class borrow pbandwidth 15
class cbq fxp0 generalclass def_class borrow pbandwidth 5
#
# Allocate bandwidth for firstclass (tcp) data classes:
# tcp: 9%
# ssh: 9%
# smtp: 5%
# http: 45%
# dns: 2%
#
class cbq fxp0 tcp firstclass borrow pbandwidth 9 red
    filter fxp0 tcp 0 0 0 0 6    # other tcp
class cbq fxp0 ssh firstclass borrow pbandwidth 9 red
    filter fxp0 ssh 0 0 0 22 6  # ssh
    filter fxp0 ssh 0 22 0 0 6  # ssh
class cbq fxp0 smtp firstclass borrow pbandwidth 5 red
    filter fxp0 smtp 0 0 0 25 6  # smtp
    filter fxp0 smtp 0 25 0 0 6  # smtp
class cbq fxp0 http firstclass borrow pbandwidth 45 red
    filter fxp0 http 0 0 0 80 6  # http
    filter fxp0 http 0 80 0 0 6  # http
    filter fxp0 http 0 0 0 443 6  # https
    filter fxp0 http 0 443 0 0 6  # https
class cbq fxp0 dns firstclass borrow pbandwidth 2 red
    filter fxp0 dns 0 0 0 53 6   # dns
    filter fxp0 dns 0 53 0 0 6   # dns

#
# Allocate bandwidth for businessclass (udp) classes:
# udp: 10%
# dns: 5%
#
class cbq fxp0 udp businessclass borrow pbandwidth 10 red
    filter fxp0 udp 0 0 0 0 17   # udp
class cbq fxp0 dns businessclass borrow pbandwidth 5 red
    filter fxp0 dns 0 0 0 53 17  # dns
    filter fxp0 dns 0 53 0 0 17  # dns
#
# Allocate bandwidth for generalclass (icmp) classe:
# icmp: 5%
#
class cbq fxp0 icmp generalclass borrow pbandwidth 5 red
    filter fxp0 icmp 0 0 0 0 1   # icmp

==== end ====

-- 
Michael Parson
mparson@bl.org