ALTQ.CONF(5) File Formats Manual ALTQ.CONF(5)

NAME

altq.confALTQ configuration file

DESCRIPTION

The altq.conf file contains a number of lines specifying the behavior of queueing disciplines. Comments start with a # and extend to the end of the line.

The altqd(8) program reads /etc/altq.conf at startup and sets up queueing disciplines. BLUE, CBQ (Class-Based Queueing), FIFOQ (First-In First-Out Queue), HFSC (Hierarchical Fair Service Curve), PRIQ (Priority Queueing), RED (Random Early Detection), RIO (RED with IN/OUT), WFQ (Weighted Fair Queueing), JoBS (Joint Buffer Management and Scheduling) and CDNR (Diffserv Traffic Conditioner) can be configured in this file.

Interface Commands

interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [discipline-specific-options]

The interface command specifies a network interface to be under control of ALTQ. One interface specification is provided for each network interface under control of ALTQ. A system configured as a router may have multiple interface specifications.

if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second. This is the maximum rate that the queueing discipline will allow on this interface.
tbrsize
specifies the bucket size of a token bucket regulator in bytes. When tbrsize is omitted, the system automatically sets the bucket size using heuristics. The token rate is set to the interface bandwidth specified by the interface command.
sched_type
Type of a queueing discipline. It must be either blue, cbq, fifoq, hfsc, jobs, priq, red, rio, or wfq. If the interface has only traffic conditioners and no queueing discipline, sched_type can be omitted.

Class Command

class
sched_type if_name class_name parent_name [red|rio] [ecn] [cleardscp] [discipline-specific-options]

The class command specifies a packet scheduling class for CBQ, HFSC, JoBS or PRIQ. A class specifier must be provided for each packet scheduling class.

sched_type
Type of queueing discipline. Must correspond to the discipline name in interface specification.
if_name
Interface name. Must correspond to name in interface specification.
class_name
Arbitrary name for this class. Must be unique for this interface.
parent_name
The name of the parent class for this class (for CBQ or HFSC). Parent class must have been previously defined. PRIQ and JoBS do not have class hierarchy and parent_name must be NULL for PRIQ and JoBS classes.
red
Use RED (Random Early Detection) on this class queue. RED drops packets with the probability proportional to the average queue length.
rio
Use RIO (RED with In/Out bit) on this class queue. RIO runs triple RED algorithms at the same time.
ecn
Use RED/ECN (Explicit Congestion Notification) on this class queue (experimental implementation). ECN implies RED.
cleardscp
Clear diffserv codepoint in the IP header.

Filter Commands

filter
if_name class_name [name fltr_name] [ruleno num] filter_values

The filter command specifies a filter to classify packets into a scheduling class. A filter specifier determines any statically-defined packet classification rules.

if_name
Name of a network interface (e.g., fxp0).
class_name
Name of a class or a conditioner to which matching packets are directed.
name
Add an arbitrary name to the filter for a future reference.
ruleno
Specifies explicit order of filter matching. Filter matching is performed from a filter with a larger ruleno. Default is 0.

filter_values should be in the following format:

filter_values:
dst_addr [netmask mask] dport src_addr [netmask mask] sport proto [tos value [tosmask value]] [gpi value]

Here dst_addr and src_addr are dotted-decimal addresses of the destination and the source respectively. An address may be followed by netmask keyword. dport and sport are port numbers of the destination and the source respectively. proto is a protocol number defined for IP packets (e.g. 6 for TCP). tos keyword can be used to specify the type of service field value. gpi keyword can be used to specify the Security Parameter Index value for IPsec.

When filter value 0 is used, it is taken as a wildcard.

filter6
if_name class_name [name fltr_name] [ruleno num] filter6_values

The filter6 command is for IPv6. filter6_value should be in the following format:

filter6_values:
dst_addr[/prefix_len] dport src_addr[/prefix_len] sport proto [flowlabel value] [tclass value [tclassmask value]] [gpi value]

Here dst_addr and src_addr are IPv6 addresses of the destination and the source respectively. An address may be followed by an optional address prefix length. dport and sport are port numbers of the destination and the source respectively. proto is a protocol number defined for IPv6 packets (e.g. 6 for TCP). flowlabel keyword can be used to specify the flowlabel field value. tclass keyword can be used to specify the traffic class field value. gpi keyword can be used to specify the Security Parameter Index value for IPsec.

When filter value 0 is used, it is taken as a wildcard.

CBQ Commands

CBQ (Class Based Queueing) achieves both partitioning and sharing of link bandwidth by hierarchically structured classes. Each class has its own queue and is assigned its share of bandwidth. A child class can borrow bandwidth from its parent class as long as excess bandwidth is available.
interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [efficient]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be either cbq, cbq-wrr (weighted-round robin) or cbq-prr (packet-by-packet round robin). cbq is equivalent to cbq-wrr.
efficient
Enables CBQ's link efficiency mode. This means that the scheduler will send a packet from the first overlimit class it encounters of all classes of the link-sharing structure when all classes are overlimit. This will also cause the scheduler to use greater than its assigned bandwidth, if the link is capable of more than the assigned bandwidth. By default, this mode is turned off. By adding the keyword efficient to the interface specification line, enables this mode.
class
sched_type if_name class_name parent_name [admission cntlload|none] [priority pri] [pbandwidth percent] [exactbandwidth bps] [borrow] [default] [control] [maxburst count] [minburst count] [maxdelay msec] [packetsize bytes] [maxpacketsize bytes] [red|rio] [ecn] [flowvalve] [cleardscp]

The class command specifies a CBQ class. The classes are organized as a hierarchy, and every class, except for the root class, has a parent.

sched_type
must be cbq for a CBQ class.
if_name
Interface name. Must correspond to name in interface specification.
class_name
Arbitrary name for this class. Must be unique within the class hierarchy for this interface. The name ctl_class is a reserved class name.
parent_name
The name of the parent class for this class or NULL if this is the root class. Parent class must have been previously defined.
admission
The type of admission control and QoS type. cntlload is controlled load service for RSVP, otherwise, it should be none. The default is none.
priority
High numbers are higher priority. Max value is 7 and Min value is 0. Default is 1.
pbandwidth
The percentage of the interface bandwidth allocated to this class. Generally should add up to 100 percent at each level of the class hierarchy, although other amounts can be specified for purposes of experimentation.
exactbandwidth
Specify the bandwidth in bits-per-second instead of pbandwidth. Note that the bandwidth allocation of CBQ is not so precise but this is just a way to pass a parameter to CBQ; the user is supposed to know the detailed internals of CBQ. pbandwidth is a preferred way to specify the bandwidth of a class.
borrow
The class can borrow bandwidth from its parent class when this class is overlimit. If this keyword is not present, then no borrowing is done, and the packet is delayed or dropped when the class is overlimit.
default
Specify the default class. When this keyword is present, all packets that do not match some classification criteria are assigned to this class. Must be exactly one class on each interface defined as the default class.
control
Specify the control class. When this keyword is present, the predefined control class packets (RSVP, IGMP, and ICMP) are assigned to this class. Note that when the control class is not specified by the time the default class is created, one is automatically created with default parameters. Thus, if the control class is specified, it must be listed before the default class. Must be exactly one class on each interface defined as the control class.
maxburst
The maximum burst of back-to-back packets allowed in this class. Default is 16 but the default value is automatically reduced to 4 when the class bandwidth is small (about less than 1Mbps).
minburst
The minimum burst is used to obtain the steady state burst size. It's the parameter to help compute offtime for the class. Offtime is the amount of time a class is to wait between packets. Default is 2.
maxdelay
The maxdelay is specified in milliseconds and used to obtain the max queue size of the class. If not specified, the default max queue size (30 packets) is used.
packetsize
The average packet size in bytes to be used in CBQ over-/under-limit computations. Default value is MTU of the interface.
maxpacketsize
The maximum packet size in bytes for the class. Default value is MTU of the interface.
red
enables RED on this class queue.
rio
enables RIO on this class queue.
ecn
enables RED/ECN on this class queue.
flowvalve
enables RED/flow-valve (a.k.a. red-penalty-box) on this class queue.
cleardscp
clears diffserv codepoint in the IP header.

HFSC Commands

HFSC (Hierarchical Fair Service Curve) supports both link-sharing and guaranteed real-time services. H-FSC employs a service curve based QoS model, and its unique feature is an ability to decouple delay and bandwidth allocation. HFSC has 2 independent scheduling mechanisms. Real-time scheduling is used to guarantee the delay and the bandwidth allocation at the same time. Hierarchical link-sharing is used to distribute the excess bandwidth. When dequeueing a packet, HFSC always tries real-time scheduling first. If no packet is eligible for real-time scheduling, link-sharing scheduling is performed. HFSC does not use class hierarchy for real-time scheduling. Additionally, an upper-limit service curve can be specified for link-sharing to set the upper limit allowed for the class.
interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be hfsc for HFSC.
class
sched_type if_name class_name parent_name [admission cntlload|none] [[sc m1 d m2]] [[rt m1 d m2]] [[ls m1 d m2]] [[ul m1 d m2]] [pshare percent] [grate bps] [bandwidth bps] [ulimit bps] [default] [qlimit count] [red|rio] [ecn] [cleardscp]

The class command specifies a HFSC class. The classes are organized as a hierarchy, and every class, except for the root class, has a parent.

Each HFSC class has 2 service curves, the real-time service curve and the link-sharing service curve. Service curves are specified by [type m1 d m2]. type should be either sc, rt, ls, or ul. sc (service curve) is used to set the same values to both real-time and link-sharing service curves. rt (real-time) is used to specify the real-time service curve. ls (link-sharing) is used to specify the link-sharing service curve. ul (upper-limit) is used to specify the upper-limit service curve for link-sharing. m1 is the slope of the first segment specified in bits-per-second. d is the x-projection of the intersection point of the 2 segments specified in milliseconds. m2 is the slope of the second segment specified in bits-per-second.

sched_type
must be hfsc for a HFSC class.
if_name
Interface name. Must correspond to name in interface specification.
class_name
Arbitrary name for this class. Must be unique within the class hierarchy for this interface. The name root is a reserved class name for the root class. The root class for the interface is automatically created by the interface command.
parent_name
The name of the parent class for this class. Keyword root is used when the parent is the root class. Parent class must have been previously defined.
admission
The type of admission control and QoS type. cntlload is controlled load service for RSVP, otherwise, it should be none. The default is none.
pshare
Percent of the link share. This specifies a linear link-sharing service curve as a fraction of the link bandwidth. It is a short hand of [ls 0 0 (link-bandwidth * percent / 100)].
grate
Guaranteed rate. This specifies a linear real-time service curve. It is a short hand of [rt 0 0 bps].
bandwidth
This is a short hand of [sc 0 0 bps].
ulimit
Upper limit rate. This specifies a upper-limit service curve. It is a short hand of [ul 0 0 bps].
default
Specify the default class. When this keyword is present, all packets that do not match some classification criteria are assigned to this class. Must be exactly one class on each interface defined as the default class.
qlimit
The maximum queue size in number of packets. Default value is 50.
red
enables RED on this class queue.
rio
enables RIO on this class queue.
ecn
enables RED/ECN on this class queue.
cleardscp
clears diffserv codepoint in the IP header.

PRIQ Commands

PRIQ (Priority Queueing) implements a simple priority-based queueing. A higher priority class is always served first. Up to 16 priorities can be used with PRIQ.
interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be priq for PRIQ.
class
sched_type if_name class_name parent_name [priority pri] [default] [qlimit count] [red|rio] [ecn] [cleardscp]
sched_type
must be priq for a PRIQ class.
if_name
Interface name. Must correspond to name in interface specification.
class_name
Arbitrary name for this class. Must be unique for this interface.
parent_name
Parent class must be NULL for PRIQ.
priority
High numbers are higher priority. Max value is 15 and Min value is 0. Default is 0. A higher priority class is always served first in PRIQ. Priority must be unique for the interface.
default
Specify the default class. When this keyword is present, all packets that do not match some classification criteria are assigned to this class. Must be exactly one class on each interface defined as the default class.
qlimit
The maximum queue size in number of packets. Default value is 50.
red
enables RED on this class queue.
rio
enables RIO on this class queue.
ecn
enables RED/ECN on this class queue.
cleardscp
clears diffserv codepoint in the IP header.

WFQ Commands

WFQ (Weighted Fair Queueing) implements a weighted-round robin scheduler for a set of queue. A weight can be assigned to each queue to give a different proportion of the link capacity. A hash function is used to map a flow to one of a set of queues, and thus, it is possible for two different flows to be mapped into the same queue.
interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [nqueues count] [qsize bytes] [hash policy]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be wfq for WFQ.
nqueues
The number of queues in WFQ. Default value is 256.
qsize
The size of each queue in number of bytes. Default value is 64K bytes.
hash
Type of hash policy to select a queue. dstaddr specifies a hashing policy by IP destination address. full specifies a hashing policy by IP addresses and ports. srcport specifies a hashing policy by IP source port number. srcaddr specifies a hashing policy by IP source address. Default is dstaddr

FIFOQ Commands

FIFOQ (First-In First-Out Queueing) is a simple tail-drop FIFO queue. FIFOQ is the simplest possible implementation of a queueing discipline in ALTQ, and can be used to compare with other queueing disciplines. FIFOQ can be also used as a template for those who want to write their own queueing disciplines.
interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [qlimit count]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be fifoq for FIFOQ.
qlimit
The maximum queue size in number of packets. Default value is 50.

RED Commands

RED (Random Early Detection) is an implicit congestion notification mechanism that exercises packet dropping or packet marking stochastically according to the average queue length. RED can be viewed as a buffer management mechanism and can be integrated into other packet scheduling schemes.
red
min_th max_th inv_pmax

The red command sets the default RED parameters. min_th and max_th are the minimum and the maximum threshold values. inv_pmax is the inverse (reciprocal) of the maximum drop probability. For example, 10 means the maximum drop probability of 1/10.

interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [qlimit count] [packetsize bytes] [weight n] [thmin n] [thmax n] [invpmax n] [ecn] [flowvalve]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be red for RED.
qlimit
The maximum queue size in number of packets. Default value is 60.
packetsize
The average packet size in number of bytes. This parameter is used to calibrate the idle period. Default value is 1000.
weight
The inverse of the weight of EWMA (exponentially weighted moving average).
thmin
The minimum threshold.
thmax
The maximum threshold.
invpmax
The inverse of the maximum drop probability.
ecn
enables ECN.
flowvalve
enables flowvalve.

RIO Commands

ALTQ/RIO has 3 drop precedence levels defined for the Assured Forwarding of DiffServ (RFC2597). Since adaptive flows are likely to stay under the medium drop precedence level under congestion, the medium drop precedence would protect adaptive flows from unadaptive flows.

The original RIO has 2 sets of RED parameters; one for in-profile packets and the other for out-of-profile packets. At the ingress of the network, profile meters tag packets as IN or OUT based on contracted profiles for customers. Inside the network, IN packets receive preferential treatment by the RIO dropper. It is possible to provision the network not to drop IN packets at all by providing enough capacity for the total volume of IN packets. Thus, RIO can be used to provide a service that statistically assures capacity allocated for users. This mechanism can be extended to support an arbitrary number of drop precedence levels. ALTQ supports 3 drop precedence levels.

rio
low_min_th low_max_th low_inv_pmax medium_min_th medium_max_th medium_inv_pmax high_min_th high_max_th high_inv_pmax

The rio command sets the default RIO parameters. The parameters are RED parameters for 3 (low, medium, high) drop precedence.

interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [qlimit count] [packetsize bytes] [weight n] [lo_thmin n] [lo_thmax n] [lo_invpmax n] [med_thmin n] [med_thmax n] [med_invpmax n] [hi_thmin n] [hi_thmax n] [hi_invpmax n] [ecn]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be rio for RIO.
qlimit
The maximum queue size in number of packets. Default value is 60.
packetsize
The average packet size in number of bytes. This parameter is used to calibrate the idle period. Default value is 1000.
weight
The inverse of the weight of EWMA (exponentially weighted moving average).
lo_thmin
The minimum threshold for low drop precedence.
lo_thmax
The maximum threshold for low drop precedence.
lo_invpmax
The inverse of the maximum drop probability for low drop precedence.
med_thmin
The minimum threshold for medium drop precedence.
med_thmax
The maximum threshold for medium drop precedence.
med_invpmax
The inverse of the maximum drop probability for medium drop precedence.
hi_thmin
The minimum threshold for high drop precedence.
hi_thmax
The maximum threshold for high drop precedence.
hi_invpmax
The inverse of the maximum drop probability for high drop precedence.
ecn
enables ECN.

BLUE Commands

interface
if_name [bandwidth bps] [tbrsize bytes] [sched_type] [qlimit count] [packetsize bytes] [maxpmark n] [holdtime usec] [ecn]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be blue for BLUE.
qlimit
The maximum queue size in number of packets. Default value is 60.
packetsize
The average packet size in number of bytes. Default value is 1000.
maxpmark
specifies the precision of marking probability.
holdtime
specifies the hold time in usec.
ecn
enables ECN.

CDNR Commands

The conditioner command specifies a diffserv traffic conditioner. A traffic conditioner is not a queueing discipline but a component to meter, mark or drop incoming packets according to some rules.

As opposed to a queueing discipline, a traffic conditioner handles incoming packets at an input interface. If no queueing discipline (e.g., CBQ) is used for the interface, a null interface command should be used to specify an input network interface.

interface
if_name [bandwidth bps] [tbrsize bytes]

The conditioner command has the following syntax.

conditioner
if_name cdnr_name <action>
if_name
Interface name. Must correspond to name in interface specification.
cdnr_name
Arbitrary name for this conditioner. Must be unique for this interface.
action
Action of the conditioner.

An action can be a recursively defined action. The following actions are defined.

pass
pass
allows the packet to go through without any modification to the packet.
drop
drop
rejects the packet. The packet is immediately discarded.
mark
value
mark
sets the specified value to the ds field in the IP header. Then, the packet is allowed to go through.
tbmeter
rate depth <in_action> <out_action>
tbmeter
is a token bucket meter configured with rate and depth parameters. Rate is token rate in bits-per-second. Depth is bucket depth in KB. When an incoming packet is in profile (available token is more than the packet size), tbmeter takes in_action. Otherwise, tbmeter takes out_action.
trtcm
cmtd_rate cmtd_depth peak_rate peak_depth <green_action> <yellow_action> <red_action> [coloraware|colorblind]
trtcm
is a 2-rate 3 color marker for Assured Forwarding. A trtcm consists of 2 token buckets, one for a committed rate and the other for a peak rate. When an incoming packet is in the committed profile, trtcm takes green_action. When the packet is out of the committed profile but in the peak profile, trtcm takes yellow_action. Otherwise, tbtcm takes red_action. A trtcm is either color-aware or color-blind. A color-aware trtcm do not raise the color (ds field value), that is, a yellow packet can be yellow or red but can not be blue. Default is color-blind.
tswtcm
cmtd_rate peak_rate avg_interval <green_action> <yellow_action> <red_action>
tswtcm
is a time sliding window 3 color marker for Assured Forwarding. A tswtcm differs from trtcm in that a tswtcm probabilistically marks packets. A tswtcm consists of 2 rates, one for a committed rate and the other for a peak rate. When an incoming packet is in the committed profile, tswtcm takes green_action. When the packet is out of the committed profile but in the peak profile, tswtcm takes yellow_action. Otherwise, tswtcm takes red_action. cmtd_rate and peak_rate are specified in bits per second. avg_interval provides the size of time window for averaging incoming rate, and is specified in milliseconds. 500 msec is ok for normal settings.

JoBS Commands

JoBS (Joint Buffer Management and Scheduling) is a queuing discipline that can enforce any feasible mix of absolute and proportional guarantees on packet losses, packet delays, and throughput, for classes of traffic, on a per-hop basis. No admission control is performed, thus if the set of service guarantees becomes infeasible, some service guarantees may be relaxed.
interface
if_name [bandwidth bps] [qlimit count] [separate] [tbrsize bytes] [sched_type]
if_name
specifies the name of a network interface (e.g., fxp0).
bandwidth
specifies the interface bandwidth in bits per second.
qlimit
specifies the maximum queue size in number of packets.
separate
specifies that classes have independent buffers. The default is to have a shared buffer for all classes. If this option is specified, qlimit applies to each independent buffer.
tbrsize
specifies the bucket size of a token bucket regulator in bytes.
sched_type
must be jobs for JoBS.
class
sched_type if_name class_name parent_name [priority pri] [default] [adc microsecs] [alc fraction] [arc bps] [rdc prop] [rlc prop]
sched_type
must be jobs for a JoBS class.
if_name
Interface name. Must correspond to name in interface specification.
class_name
Arbitrary name for this class. Must be unique for this interface.
parent_name
Parent class must be NULL for JoBS.
priority
Priority index used for proportional differentiation. Max value is 15 and Min value is 0. Default is 0. Priority must be unique for the interface.
default
Specify the default class. When this keyword is present, all packets that do not match some classification criteria are assigned to this class. Must be exactly one class on each interface defined as the default class.
adc
Specifies an upper bound on delays for that class (in microseconds). A value of -1 will indicate the absence of delay bound. By default, no delay bound is offered.
alc
Specifies a upper bound on loss rate for that class (in fraction of 1, for instance a 1% loss rate bound will be expressed as 0.01). A value of -1 will indicate the absence of loss rate bound. By default, no loss rate bound is offered.
arc
Specifies a lower bound on the throughput received by that class (in bits per second). A value of -1 will indicate the absence of throughput bound. By default, no throughput bound is offered.
rdc
Specifies a proportional delay differentiation factor between that class and the class with the successive priority index. For instance, for priority 1, an rdc of 2 specifies that the delays of packets marked as class 2 will roughly be twice the delays of packets marked as class 1. A value of -1 indicates the absence of proportional differentiation on that class. Note that class N if N is the maximum priority should have a dummy coefficient different from -1 if proportional delay differentiation is desired on Class N. By default, no proportional delay differentiation is offered.
rlc
Specifies a proportional loss differentiation factor between that class and the class with the successive priority index. For instance, for priority 1, an rlc of 2 specifies that the loss rate of packets marked as class 2 will roughly be twice the loss rate of packets marked as class 1. A value of -1 indicates the absence of proportional differentiation on that class. Note that class N if N is the maximum priority should have a dummy coefficient different from -1 if proportional loss differentiation is desired on Class N. By default, no proportional loss differentiation is offered.

EXAMPLES

CBQ Example

# 
# cbq configuration for vx0 (10Mbps ether) 
# give at least 40% to TCP 
# limit HTTP from network 133.138.1.0 up to 10%, use RED. 
# other traffic goes into default class 
# 
interface vx0 bandwidth 10M cbq 
# 
class cbq vx0 root_class NULL priority 0 pbandwidth 100 
class cbq vx0 def_class root_class borrow pbandwidth 95 default 
class cbq vx0 tcp_class def_class borrow pbandwidth  40 
        filter vx0 tcp_class 0 0 0 0 6 
class cbq vx0 csl_class tcp_class pbandwidth  10   red 
        filter vx0 csl_class 0 0 133.138.1.0 netmask 0xffffff00 80 6 
        filter vx0 csl_class 133.138.1.0 netmask 0xffffff00 0 0 80 6 
# 
# sample filter6 command 
# 
                filter6 vx0 csl_class ::0 0 d000:a:0:123::/64 80 6

HFSC Example

# 
# hfsc configuration for hierarchical sharing 
# 
interface pvc0 bandwidth 45M hfsc 
# 
# (10% of the bandwidth share goes to the default class) 
class hfsc pvc0 def_class root pshare 10 default 
# 
#          bandwidth share    guaranteed rate 
#    CMU:       45%             15Mbps 
#    PITT:      45%             15Mbps 
# 
class hfsc pvc0 cmu  root pshare 45 grate 15M 
class hfsc pvc0 pitt root pshare 45 grate 15M 
# 
# CMU      bandwidth share    guaranteed rate 
#    CS:        20%             10Mbps 
#    other:     20%              5Mbps 
# 
class hfsc pvc0 cmu_other cmu  pshare 20 grate 10M 
        filter pvc0 cmu_other   0 0 128.2.0.0   netmask 0xffff0000 0 0 
class hfsc pvc0 cmu_cs    cmu  pshare 20 grate  5M 
        filter pvc0 cmu_cs      0 0 128.2.242.0 netmask 0xffffff00 0 0 
# 
# PITT     bandwidth share    guaranteed rate 
#    CS:        20%             10Mbps 
#    other:     20%              5Mbps 
# 
class hfsc pvc0 pitt_other pitt  pshare 20 grate 10M 
        filter pvc0 pitt_other  0 0 136.142.0.0  netmask 0xffff0000 0 0 
class hfsc pvc0 pitt_cs    pitt  pshare 20 grate  5M 
        filter pvc0 pitt_cs     0 0 136.142.79.0 netmask 0xffffff00 0 0

HFSC Example (simpler one with ulimit)

# 
interface fxp0 bandwidth 90M hfsc 
# reserve 20% for default class 
class hfsc fxp0 def_class root pshare 20 default 
# shared class for TCP and UDP 
class hfsc fxp0 shared_class root bandwidth 72M 
# shared class for all TCP 
class hfsc fxp0 tcp_shared shared_class bandwidth 40M ulimit 60M 
# generic tcp 
class hfsc fxp0 tcp_class tcp_shared bandwidth 15M ulimit 50M 
	filter fxp0 tcp_class 0 0 0 0 6 
# http 
class hfsc fxp0 http_class tcp_shared bandwidth 25M ulimit 40M 
	filter fxp0 http_class 0 80 0 0 6 
	filter fxp0 http_class 0 0 0 80 6 
# udp 
class hfsc fxp0 udp_class shared_class bandwidth 15M ulimit 20M 
	filter fxp0 udp_class 0 0 0 0 17

PRIQ Example

# 
# priq configuration for fxp0 (100Mbps ether) 
#     icmp: high priority 
#     tcp:  medium priority 
#     others: low priority 
# 
interface fxp0 bandwidth 100M priq 
# 
class priq fxp0 high_class NULL priority 2 
        filter fxp0 high_class 0 0 0 0 1 
class priq fxp0 med_class NULL priority 1 
        filter fxp0 med_class 0 0 0 0 6 
class priq fxp0 low_class NULL priority 0 default

WFQ Example

interface pvc0 bandwidth 134000000 wfq

FIFOQ Example

interface rl0 bandwidth 10M fifoq

Conditioner Example

# 
interface fxp0 
# 
# a simple dropper 
# discard all packets from 192.168.0.83 
# 
conditioner fxp0 dropper <drop> 
        filter fxp0 dropper 0 0 192.168.0.83 0 0 
 
# 
# EF conditioner 
# mark EF to all packets from 192.168.0.117 
# 
conditioner pvc1 ef_cdnr <tbmeter 6M 64K <mark 0xb8><drop>> 
        filter fxp0 ef_cdnr 0 0 192.168.0.117 0 0 
 
# 
# AF1x conditioner 
# mark AF1x to packets from 192.168.0.178 
#       AF11 (low drop precedence):    less than 3Mbps 
#       AF12 (medium drop precedence): more than 3Mbps and less than 10Mbps 
#       AF13 (high drop precedence):   more than 10Mbps 
# 
conditioner fxp0 af1x_cdnr <trtcm 3M 32K 10M 64K <mark 0x28><mark 0x30><mark 0x38>> 
        filter fxp0 af1x_cdnr 0 0 192.168.0.178 0 0

SEE ALSO

altqd(8)

BUGS

This man page is incomplete. For more information read the source.
September 10, 2008 NetBSD 6.1