xref: /netbsd-src/usr.sbin/altq/altqd/altq.conf.5 (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1.\"	$NetBSD: altq.conf.5,v 1.15 2013/09/08 19:12:18 jakllsch Exp $
2.\"	$KAME: altq.conf.5,v 1.15 2002/11/17 02:51:49 kjc Exp $
3.\"
4.\" Copyright (C) 2000
5.\" Sony Computer Science Laboratories Inc.  All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY SONY CSL AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL SONY CSL OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd September 10, 2008
29.Dt ALTQ.CONF 5
30.Os
31.\"
32.Sh NAME
33.Nm altq.conf
34.Nd ALTQ configuration file
35.\"
36.Sh DESCRIPTION
37The
38.Nm
39file contains a number of lines specifying the behavior of queueing
40disciplines.
41Comments start with a # and extend to the end of the line.
42.Pp
43The
44.Xr altqd 8
45program reads
46.Pa /etc/altq.conf
47at startup and sets up queueing disciplines.
48BLUE, CBQ (Class-Based Queueing), FIFOQ (First-In First-Out Queue),
49HFSC (Hierarchical Fair Service Curve), PRIQ (Priority Queueing),
50RED (Random Early Detection), RIO (RED with IN/OUT),
51WFQ (Weighted Fair Queueing), JoBS (Joint Buffer Management and
52Scheduling)
53and CDNR (Diffserv Traffic Conditioner) can be configured in this file.
54.Ss Interface Commands
55.Bl -tag -width interface -offset indent
56.It Cm interface
57.Ar if_name
58.Op Cm bandwidth Ar bps
59.Op Cm tbrsize Ar bytes
60.Op Ar sched_type
61.Op Ar discipline-specific-options
62.El
63.Pp
64The
65.Cm interface
66command specifies a network interface to be under control of ALTQ.
67One interface specification is provided for each network interface
68under control of ALTQ.
69A system configured as a router may have multiple interface
70specifications.
71.Bl -tag -width 8n -offset indent
72.It Ar if_name
73specifies the name of a network interface (e.g., fxp0).
74.It Cm bandwidth
75specifies the interface bandwidth in bits per second.
76This is the maximum rate that the queueing discipline will allow on this
77interface.
78.It Cm tbrsize
79specifies the bucket size of a token bucket regulator in bytes.
80When
81.Cm tbrsize
82is omitted, the system automatically sets the bucket size
83using heuristics.
84The token rate is set to the interface bandwidth specified by the
85.Cm interface
86command.
87.It Ar sched_type
88Type of a queueing discipline.
89It must be either
90.Cm blue ,
91.Cm cbq ,
92.Cm fifoq ,
93.Cm hfsc ,
94.Cm jobs ,
95.Cm priq ,
96.Cm red ,
97.Cm rio ,
98or
99.Cm wfq .
100If the interface has only traffic conditioners and no queueing
101discipline,
102.Ar sched_type
103can be omitted.
104.El
105.Ss Class Command
106.Bl -tag -width class -offset indent
107.It Cm class
108.Ar sched_type
109.Ar if_name
110.Ar class_name
111.Ar parent_name
112.Op Cm red|rio
113.Op Cm ecn
114.Op Cm cleardscp
115.Op Ar discipline-specific-options
116.El
117.Pp
118The
119.Cm class
120command specifies a packet scheduling class for CBQ, HFSC, JoBS or PRIQ.
121A class specifier must be provided for each packet scheduling class.
122.Bl -tag -width 8n -offset indent
123.It Ar sched_type
124Type of queueing discipline.
125Must correspond to the discipline name in interface specification.
126.It Ar if_name
127Interface name.
128Must correspond to name in interface specification.
129.It Ar class_name
130Arbitrary name for this class.
131Must be unique for this interface.
132.It Ar parent_name
133The name of the parent class for this class (for CBQ or HFSC).
134Parent class must have been previously defined.
135PRIQ and JoBS do not have class hierarchy and parent_name must be
136.Dv NULL
137for PRIQ and JoBS classes.
138.It Cm red
139Use RED (Random Early Detection) on this class queue.
140RED drops packets with the probability proportional to the average
141queue length.
142.It Cm rio
143Use RIO (RED with In/Out bit) on this class queue.
144RIO runs triple RED algorithms at the same time.
145.It Cm ecn
146Use RED/ECN (Explicit Congestion Notification) on this
147class queue (experimental implementation).
148ECN implies RED.
149.It Cm cleardscp
150Clear diffserv codepoint in the IP header.
151.El
152.Ss Filter Commands
153.Bl -tag -width filter -offset indent
154.It Cm filter
155.Ar if_name
156.Ar class_name
157.Op Cm name Ar fltr_name
158.Op Cm ruleno Ar num
159.Ar filter_values
160.El
161.Pp
162The
163.Cm filter
164command specifies a filter to classify packets into
165a scheduling class.
166A filter specifier determines any statically-defined packet
167classification rules.
168.Bl -tag -width 10n -offset indent
169.It Ar if_name
170Name of a network interface (e.g., fxp0).
171.It Ar class_name
172Name of a class or a conditioner to which matching packets are directed.
173.It Cm name
174Add an arbitrary name to the filter for a future reference.
175.It Cm ruleno
176Specifies explicit order of filter matching.
177Filter matching is performed from a filter with a larger ruleno.
178Default is 0.
179.El
180.Pp
181.Ar filter_values
182should be in the following format:
183.Bl -tag -width filter -offset indent
184.It Ar filter_values :
185.Ad dst_addr Op Cm netmask Ar mask
186.Ar dport
187.Ad src_addr Op Cm netmask Ar mask
188.Ar sport
189.Ar proto
190.Oo
191.Cm tos
192.Ar value
193.Op Cm tosmask Ar value
194.Oc
195.Op Cm gpi Ar value
196.El
197.Pp
198Here
199.Ad dst_addr
200and
201.Ad src_addr
202are dotted-decimal addresses of
203the destination and the source respectively.
204An address may be followed by
205.Cm netmask
206keyword.
207.Ar dport
208and
209.Ar sport
210are port numbers of the destination and the source respectively.
211.Ar proto
212is a protocol number defined for IP packets (e.g. 6 for TCP).
213.Cm tos
214keyword can be used to specify the type of service field value.
215.Cm gpi
216keyword can be used to specify the Security Parameter Index value for
217IPsec.
218.Pp
219When filter value 0 is used, it is taken as a wildcard.
220.Bl -tag -width filter6 -offset indent
221.It Cm filter6
222.Ar if_name
223.Ar class_name
224.Op Cm name Ar fltr_name
225.Op Cm ruleno Ar num
226.Ar filter6_values
227.El
228.Pp
229The
230.Cm filter6
231command is for IPv6.
232.Ar filter6_value
233should be in the following format:
234.Bl -tag -width filter6 -offset indent
235.It filter6_values :
236.Ad dst_addr Ns Op /prefix_len
237.Ar dport
238.Ad src_addr Ns Op /prefix_len
239.Ar sport
240.Ar proto
241.Op Cm flowlabel Ar value
242.Oo
243.Cm tclass
244.Ar value
245.Op Cm tclassmask Ar value
246.Oc
247.Op Cm gpi Ar value
248.El
249.Pp
250Here
251.Ad dst_addr
252and
253.Ad src_addr
254are IPv6 addresses of the destination and the source respectively.
255An address may be followed by an optional address prefix length.
256.Ar dport
257and
258.Ar sport
259are port numbers of the destination and the source respectively.
260.Ar proto
261is a protocol number defined for IPv6 packets (e.g. 6 for TCP).
262.Cm flowlabel
263keyword can be used to specify the flowlabel field value.
264.Cm tclass
265keyword can be used to specify the traffic class field value.
266.Cm gpi
267keyword can be used to specify the Security Parameter Index value for
268IPsec.
269.Pp
270When filter value 0 is used, it is taken as a wildcard.
271.Ss CBQ Commands
272CBQ (Class Based Queueing) achieves both partitioning and sharing of
273link bandwidth by hierarchically structured classes.
274Each class has its own queue and is assigned its share of bandwidth.
275A child class can borrow bandwidth from its parent class as long as
276excess bandwidth is available.
277.Bl -tag -width interface -offset indent
278.It Cm interface
279.Ar if_name
280.Op Cm bandwidth Ar bps
281.Op Cm tbrsize Ar bytes
282.Op Ar sched_type
283.Op Cm efficient
284.El
285.Pp
286.Bl -tag -width 8n -offset indent
287.It Ar if_name
288specifies the name of a network interface (e.g., fxp0).
289.It Cm bandwidth
290specifies the interface bandwidth in bits per second.
291.It Cm tbrsize
292specifies the bucket size of a token bucket regulator in bytes.
293.It Ar sched_type
294must be either
295.Cm cbq ,
296.Cm cbq-wrr
297(weighted-round robin) or
298.Cm cbq-prr
299(packet-by-packet round robin).
300.Cm cbq
301is equivalent to
302.Cm cbq-wrr .
303.It Cm efficient
304Enables CBQ's link efficiency mode.
305This means that the scheduler will send a packet from the first
306overlimit class it encounters of all classes of the link-sharing
307structure when all classes are overlimit.
308This will also cause the scheduler to use greater than its assigned
309bandwidth, if the link is capable of more than the assigned bandwidth.
310By default, this mode is turned off.
311By adding the keyword
312.Cm efficient
313to the interface specification line, enables this mode.
314.El
315.Pp
316.Bl -tag -width class -offset indent
317.It Cm class
318.Ar sched_type
319.Ar if_name
320.Ar class_name
321.Ar parent_name
322.Op Cm admission cntlload|none
323.Op Cm priority Ar pri
324.Op Cm pbandwidth Ar percent
325.Op Cm exactbandwidth Ar bps
326.Op Cm borrow
327.Op Cm default
328.Op Cm control
329.Op Cm maxburst Ar count
330.Op Cm minburst Ar count
331.Bk -words
332.Op Cm maxdelay Ar msec
333.Ek
334.Op Cm packetsize Ar bytes
335.Op Cm maxpacketsize Ar bytes
336.Op Cm red|rio
337.Op Cm ecn
338.Op Cm flowvalve
339.Op Cm cleardscp
340.El
341.Pp
342The
343.Cm class
344command specifies a CBQ class.
345The classes are organized as a hierarchy, and every class, except
346for the root class, has a parent.
347.Bl -tag -width 8n -offset indent
348.It Ar sched_type
349must be
350.Cm cbq
351for a CBQ class.
352.It Ar if_name
353Interface name.
354Must correspond to name in interface specification.
355.It Ar class_name
356Arbitrary name for this class.
357Must be unique within the class
358hierarchy for this interface.
359The name
360.Cm ctl_class
361is a reserved class name.
362.It Cm parent_name
363The name of the parent class for this class or
364.Dv NULL
365if this is the root class.
366Parent class must have been previously defined.
367.It Cm admission
368The type of admission control and QoS type.
369.Cm cntlload
370is controlled load service for RSVP, otherwise, it should be
371.Cm none .
372The default is
373.Cm none .
374.It Cm priority
375High numbers are higher priority.
376Max value is 7 and Min value is 0.
377Default is 1.
378.It Cm pbandwidth
379The percentage of the interface bandwidth allocated to this class.
380Generally should add up to 100 percent at each level of the class
381hierarchy, although other amounts can be specified for purposes of
382experimentation.
383.It Cm exactbandwidth
384Specify the bandwidth in bits-per-second instead of
385.Cm pbandwidth .
386Note that the bandwidth allocation of CBQ is not so precise but this
387is just a way to pass a parameter to CBQ; the user is supposed to know
388the detailed internals of CBQ.
389.Cm pbandwidth
390is a preferred way to specify the bandwidth of a class.
391.It Cm borrow
392The class can borrow bandwidth from its parent class when this class
393is overlimit.
394If this keyword is not present, then no borrowing is done, and the
395packet is delayed or dropped when the class is overlimit.
396.It Cm default
397Specify the default class.
398When this keyword is present, all packets that do not match some
399classification criteria are assigned to this class.
400Must be exactly one class on each interface defined as the default
401class.
402.It Cm control
403Specify the control class.
404When this keyword is present, the predefined control class packets
405(RSVP, IGMP, and ICMP) are assigned to this class.
406Note that when the control class is not specified by the time the
407default class is created, one is automatically created with default
408parameters.
409Thus, if the control class is specified, it must be listed before the
410default class.
411Must be exactly one class on each interface defined as the control
412class.
413.It Cm maxburst
414The maximum burst of back-to-back packets allowed in this class.
415Default is 16 but the default value is automatically reduced to 4 when
416the class bandwidth is small (about less than 1Mbps).
417.It Cm minburst
418The minimum burst is used to obtain the steady state burst size.
419It's the parameter to help compute offtime for the class.
420Offtime is the amount of time a class is to wait between packets.
421Default is 2.
422.It Cm maxdelay
423The maxdelay is specified in milliseconds and used to obtain the max
424queue size of the class.
425If not specified, the default max queue size (30 packets) is used.
426.It Cm packetsize
427The average packet size in bytes to be used in CBQ over-/under-limit
428computations.
429Default value is MTU of the interface.
430.It Cm maxpacketsize
431The maximum packet size in bytes for the class.
432Default value is MTU of the interface.
433.It Cm red
434enables RED on this class queue.
435.It Cm rio
436enables RIO on this class queue.
437.It Cm ecn
438enables RED/ECN on this class queue.
439.It Cm flowvalve
440enables RED/flow-valve (a.k.a. red-penalty-box) on this class queue.
441.It Cm cleardscp
442clears diffserv codepoint in the IP header.
443.El
444.Ss HFSC Commands
445HFSC (Hierarchical Fair Service Curve) supports both link-sharing and
446guaranteed real-time services.
447H-FSC employs a service curve based QoS model, and its unique feature
448is an ability to decouple delay and bandwidth allocation.
449HFSC has 2 independent scheduling mechanisms.
450Real-time scheduling is used to guarantee the delay and the
451bandwidth allocation at the same time.
452Hierarchical link-sharing is used to distribute the excess
453bandwidth.
454When dequeueing a packet, HFSC always tries real-time scheduling
455first.
456If no packet is eligible for real-time scheduling, link-sharing
457scheduling is performed.
458HFSC does not use class hierarchy for real-time scheduling.
459Additionally, an upper-limit service curve can be specified for
460link-sharing to set the upper limit allowed for the class.
461.Bl -tag -width interface -offset indent
462.It Cm interface
463.Ar if_name
464.Op Cm bandwidth Ar bps
465.Op Cm tbrsize Ar bytes
466.Op Ar sched_type
467.El
468.Pp
469.Bl -tag -width 8n -offset indent
470.It Ar if_name
471specifies the name of a network interface (e.g., fxp0).
472.It Cm bandwidth
473specifies the interface bandwidth in bits per second.
474.It Cm tbrsize
475specifies the bucket size of a token bucket regulator in bytes.
476.It Ar sched_type
477must be
478.Cm hfsc
479for HFSC.
480.El
481.Pp
482.Bl -tag -width class -offset indent
483.It Cm class
484.Ar sched_type
485.Ar if_name
486.Ar class_name
487.Ar parent_name
488.Op Cm admission cntlload|none
489.Op Bq Cm sc Ar m1 d m2
490.Op Bq Cm rt Ar m1 d m2
491.Op Bq Cm ls Ar m1 d m2
492.Op Bq Cm ul Ar m1 d m2
493.Op Cm pshare Ar percent
494.Op Cm grate Ar bps
495.Op Cm bandwidth Ar bps
496.Op Cm ulimit Ar bps
497.Op Cm default
498.Op Cm qlimit Ar count
499.Op Cm red|rio
500.Op Cm ecn
501.Op Cm cleardscp
502.El
503.Pp
504The
505.Cm class
506command specifies a HFSC class.
507The classes are organized as a hierarchy, and every class, except
508for the root class, has a parent.
509.Pp
510Each HFSC class has 2 service curves, the real-time service curve and
511the link-sharing service curve.
512Service curves are specified by
513.Bq Ar type Ar m1 d m2 .
514.Ar type
515should be either
516.Cm sc , rt , ls ,
517or
518.Cm ul .
519.Cm sc
520(service curve) is used to set the same values to both real-time and
521link-sharing service curves.
522.Cm rt
523(real-time) is used to specify the real-time service curve.
524.Cm ls
525(link-sharing) is used to specify the link-sharing service curve.
526.Cm ul
527(upper-limit) is used to specify the upper-limit service curve for
528link-sharing.
529.Ar m1
530is the slope of the first segment specified in bits-per-second.
531.Ar d
532is the x-projection of the intersection point of the 2 segments
533specified in milliseconds.
534.Ar m2
535is the slope of the second segment specified in bits-per-second.
536.Bl -tag -width 8n -offset indent
537.It Ar sched_type
538must be
539.Cm hfsc
540for a HFSC class.
541.It Ar if_name
542Interface name.
543Must correspond to name in interface specification.
544.It Ar class_name
545Arbitrary name for this class.
546Must be unique within the class hierarchy for this interface.
547The name
548.Cm root
549is a reserved class name for the root class.
550The root class for the interface is automatically created by the
551.Cm interface
552command.
553.It Ar parent_name
554The name of the parent class for this class.
555Keyword
556.Cm root
557is used when the parent is the root class.
558Parent class must have been previously defined.
559.It Cm admission
560The type of admission control and QoS type.
561.Cm cntlload
562is controlled load service for RSVP, otherwise, it should be
563.Cm none .
564The default is
565.Cm none .
566.It Cm pshare
567Percent of the link share.
568This specifies a linear link-sharing service curve as a fraction of
569the link bandwidth.
570It is a short hand of
571.Li [ls 0 0 (link-bandwidth * percent / 100)] .
572.It Cm grate
573Guaranteed rate.
574This specifies a linear real-time service curve.
575It is a short hand of
576.Li [rt 0 0 bps] .
577.It Cm bandwidth
578This is a short hand of
579.Li [sc 0 0 bps] .
580.It Cm ulimit
581Upper limit rate.
582This specifies a upper-limit service curve.
583It is a short hand of
584.Li [ul 0 0 bps] .
585.It Cm default
586Specify the default class.
587When this keyword is present, all packets that do not match some
588classification criteria are assigned to this class.
589Must be exactly one class on each interface defined as the default
590class.
591.It Cm qlimit
592The maximum queue size in number of packets.
593Default value is 50.
594.It Cm red
595enables RED on this class queue.
596.It Cm rio
597enables RIO on this class queue.
598.It Cm ecn
599enables RED/ECN on this class queue.
600.It Cm cleardscp
601clears diffserv codepoint in the IP header.
602.El
603.Ss PRIQ Commands
604PRIQ (Priority Queueing) implements a simple priority-based queueing.
605A higher priority class is always served first.
606Up to 16 priorities can be used with PRIQ.
607.Bl -tag -width interface -offset indent
608.It Cm interface
609.Ar if_name
610.Op Cm bandwidth Ar bps
611.Op Cm tbrsize Ar bytes
612.Op Ar sched_type
613.El
614.Pp
615.Bl -tag -width 8n -offset indent
616.It Ar if_name
617specifies the name of a network interface (e.g., fxp0).
618.It Cm bandwidth
619specifies the interface bandwidth in bits per second.
620.It Cm tbrsize
621specifies the bucket size of a token bucket regulator in bytes.
622.It Ar sched_type
623must be
624.Cm priq
625for PRIQ.
626.El
627.Pp
628.Bl -tag -width class -offset indent
629.It Cm class
630.Ar sched_type
631.Ar if_name
632.Ar class_name
633.Ar parent_name
634.Op Cm priority Ar pri
635.Op Cm default
636.Op Cm qlimit Ar count
637.Op Cm red|rio
638.Op Cm ecn
639.Op Cm cleardscp
640.El
641.Pp
642.Bl -tag -width 8n -offset indent
643.It Ar sched_type
644must be
645.Cm priq
646for a PRIQ class.
647.It Ar if_name
648Interface name.
649Must correspond to name in interface specification.
650.It Ar class_name
651Arbitrary name for this class.
652Must be unique for this interface.
653.It Ar parent_name
654Parent class must be
655.Dv NULL
656for PRIQ.
657.It Cm priority
658High numbers are higher priority.
659Max value is 15 and Min value is 0.
660Default is 0.
661A higher priority class is always served first in PRIQ.
662Priority must be unique for the interface.
663.It Cm default
664Specify the default class.
665When this keyword is present, all packets that do not match some
666classification criteria are assigned to this class.
667Must be exactly one class on each interface defined as the default
668class.
669.It Cm qlimit
670The maximum queue size in number of packets.
671Default value is 50.
672.It Cm red
673enables RED on this class queue.
674.It Cm rio
675enables RIO on this class queue.
676.It Cm ecn
677enables RED/ECN on this class queue.
678.It Cm cleardscp
679clears diffserv codepoint in the IP header.
680.El
681.Ss WFQ Commands
682WFQ (Weighted Fair Queueing) implements a weighted-round robin
683scheduler for a set of queue.
684A weight can be assigned to each queue to give a
685different proportion of the link capacity.
686A hash function is used to map a flow to one of a set of queues, and
687thus, it is possible for two different flows to be mapped into the same
688queue.
689.Bl -tag -width interface -offset indent
690.It Cm interface
691.Ar if_name
692.Op Cm bandwidth Ar bps
693.Op Cm tbrsize Ar bytes
694.Op Ar sched_type
695.Op Cm nqueues Ar count
696.Op Cm qsize Ar bytes
697.Op Cm hash Ar policy
698.El
699.Pp
700.Bl -tag -width 8n -offset indent
701.It Cm if_name
702specifies the name of a network interface (e.g., fxp0).
703.It Cm bandwidth
704specifies the interface bandwidth in bits per second.
705.It Cm tbrsize
706specifies the bucket size of a token bucket regulator in bytes.
707.It Ar sched_type
708must be
709.Cm wfq
710for WFQ.
711.It Cm nqueues
712The number of queues in WFQ.
713Default value is 256.
714.It Cm qsize
715The size of each queue in number of bytes.
716Default value is 64K bytes.
717.It Cm hash
718Type of hash policy to select a queue.
719.Cm dstaddr
720specifies a hashing policy by IP destination address.
721.Cm full
722specifies a hashing policy by IP addresses and ports.
723.Cm srcport
724specifies a hashing policy by IP source port number.
725.Cm srcaddr
726specifies a hashing policy by IP source address.
727Default is
728.Cm dstaddr
729.El
730.Ss FIFOQ Commands
731FIFOQ (First-In First-Out Queueing) is a simple tail-drop FIFO queue.
732FIFOQ is the simplest possible implementation of a queueing discipline
733in ALTQ, and can be used to compare with other queueing disciplines.
734FIFOQ can be also used as a template for those who want to write their
735own queueing disciplines.
736.Bl -tag -width interface -offset indent
737.It Cm interface
738.Ar if_name
739.Op Cm bandwidth Ar bps
740.Op Cm tbrsize Ar bytes
741.Op Ar sched_type
742.Op Cm qlimit Ar count
743.El
744.Pp
745.Bl -tag -width 8n -offset indent
746.It Ar if_name
747specifies the name of a network interface (e.g., fxp0).
748.It Cm bandwidth
749specifies the interface bandwidth in bits per second.
750.It Cm tbrsize
751specifies the bucket size of a token bucket regulator in bytes.
752.It Ar sched_type
753must be
754.Cm fifoq
755for FIFOQ.
756.It Cm qlimit
757The maximum queue size in number of packets.
758Default value is 50.
759.El
760.Ss RED Commands
761RED (Random Early Detection) is an implicit congestion notification
762mechanism that exercises packet dropping or packet marking
763stochastically according to the average queue length.
764RED can be viewed as a buffer management mechanism
765and can be integrated into other packet scheduling schemes.
766.Bl -tag -width red -offset indent
767.It Cm red
768.Ar min_th
769.Ar max_th
770.Ar inv_pmax
771.El
772.Pp
773The
774.Cm red
775command sets the default RED parameters.
776.Ar min_th
777and
778.Ar max_th
779are the minimum and the maximum threshold values.
780.Ar inv_pmax
781is the inverse (reciprocal) of the maximum drop probability.
782For example, 10 means the maximum drop probability of 1/10.
783.Bl -tag -width interface -offset indent
784.It Cm interface
785.Ar if_name
786.Op Cm bandwidth Ar bps
787.Op Cm tbrsize Ar bytes
788.Op Ar sched_type
789.Op Cm qlimit Ar count
790.Op Cm packetsize Ar bytes
791.Op Cm weight Ar n
792.Op Cm thmin Ar n
793.Op Cm thmax Ar n
794.Op Cm invpmax Ar n
795.Op Cm ecn
796.Op Cm flowvalve
797.El
798.Pp
799.Bl -tag -width 8n -offset indent
800.It Ar if_name
801specifies the name of a network interface (e.g., fxp0).
802.It Cm bandwidth
803specifies the interface bandwidth in bits per second.
804.It Cm tbrsize
805specifies the bucket size of a token bucket regulator in bytes.
806.It Ar sched_type
807must be
808.Cm red
809for RED.
810.It Cm qlimit
811The maximum queue size in number of packets.
812Default value is 60.
813.It Cm packetsize
814The average packet size in number of bytes.
815This parameter is used to calibrate the idle period.
816Default value is 1000.
817.It Cm weight
818The inverse of the weight of EWMA (exponentially weighted moving average).
819.It Cm thmin
820The minimum threshold.
821.It Cm thmax
822The maximum threshold.
823.It Cm invpmax
824The inverse of the maximum drop probability.
825.It Cm ecn
826enables ECN.
827.It Cm flowvalve
828enables flowvalve.
829.El
830.Ss RIO Commands
831ALTQ/RIO has 3 drop precedence levels defined for the Assured
832Forwarding of DiffServ (RFC2597).
833Since adaptive flows are likely to stay under the medium drop
834precedence level under congestion, the medium drop precedence would
835protect adaptive flows from unadaptive flows.
836.Pp
837The original RIO has 2 sets of RED parameters; one for in-profile
838packets and the other for out-of-profile packets.
839At the ingress of the network, profile meters tag packets as IN
840or OUT based on contracted profiles for customers.
841Inside the network, IN packets receive preferential treatment by
842the RIO dropper.
843It is possible to provision the network not to drop IN packets
844at all by providing enough capacity for the total volume of IN
845packets.
846Thus, RIO can be used to provide a service that statistically assures
847capacity allocated for users.
848This mechanism can be extended to support an arbitrary number of drop
849precedence levels.
850ALTQ supports 3 drop precedence levels.
851.Bl -tag -width rio -offset indent
852.It Cm rio
853.Ar low_min_th
854.Ar low_max_th
855.Ar low_inv_pmax
856.Ar medium_min_th
857.Ar medium_max_th
858.Ar medium_inv_pmax
859.Ar high_min_th
860.Ar high_max_th
861.Ar high_inv_pmax
862.El
863.Pp
864The
865.Cm rio
866command sets the default RIO parameters.
867The parameters are RED parameters for 3 (low, medium, high) drop
868precedence.
869.Bl -tag -width interface -offset indent
870.It Cm interface
871.Ar if_name
872.Op Cm bandwidth Ar bps
873.Op Cm tbrsize Ar bytes
874.Op Ar sched_type
875.Op Cm qlimit Ar count
876.Op Cm packetsize Ar bytes
877.Op Cm weight Ar n
878.Op Cm lo_thmin Ar n
879.Op Cm lo_thmax Ar n
880.Op Cm lo_invpmax Ar n
881.Op Cm med_thmin Ar n
882.Op Cm med_thmax Ar n
883.Op Cm med_invpmax Ar n
884.Op Cm hi_thmin Ar n
885.Op Cm hi_thmax Ar n
886.Op Cm hi_invpmax Ar n
887.Op Cm ecn
888.El
889.Pp
890.Bl -tag -width 8n -offset indent
891.It Ar if_name
892specifies the name of a network interface (e.g., fxp0).
893.It Cm bandwidth
894specifies the interface bandwidth in bits per second.
895.It Cm tbrsize
896specifies the bucket size of a token bucket regulator in bytes.
897.It Ar sched_type
898must be
899.Cm rio
900for RIO.
901.It Cm qlimit
902The maximum queue size in number of packets.
903Default value is 60.
904.It Cm packetsize
905The average packet size in number of bytes.
906This parameter is used to calibrate the idle period.
907Default value is 1000.
908.It Cm weight
909The inverse of the weight of EWMA (exponentially weighted moving average).
910.It Cm lo_thmin
911The minimum threshold for low drop precedence.
912.It Cm lo_thmax
913The maximum threshold for low drop precedence.
914.It Cm lo_invpmax
915The inverse of the maximum drop probability for low drop precedence.
916.It Cm med_thmin
917The minimum threshold for medium drop precedence.
918.It Cm med_thmax
919The maximum threshold for medium drop precedence.
920.It Cm med_invpmax
921The inverse of the maximum drop probability for medium drop precedence.
922.It Cm hi_thmin
923The minimum threshold for high drop precedence.
924.It Cm hi_thmax
925The maximum threshold for high drop precedence.
926.It Cm hi_invpmax
927The inverse of the maximum drop probability for high drop precedence.
928.It Cm ecn
929enables ECN.
930.El
931.Ss BLUE Commands
932.Bl -tag -width interface -offset indent
933.It Cm interface
934.Ar if_name
935.Op Cm bandwidth Ar bps
936.Op Cm tbrsize Ar bytes
937.Op Ar sched_type
938.Op Cm qlimit Ar count
939.Op Cm packetsize Ar bytes
940.Op Cm maxpmark Ar n
941.Op Cm holdtime Ar usec
942.Op Cm ecn
943.El
944.Pp
945.Bl -tag -width 8n -offset indent
946.It Ar if_name
947specifies the name of a network interface (e.g., fxp0).
948.It Cm bandwidth
949specifies the interface bandwidth in bits per second.
950.It Cm tbrsize
951specifies the bucket size of a token bucket regulator in bytes.
952.It Ar sched_type
953must be
954.Cm blue
955for BLUE.
956.It Cm qlimit
957The maximum queue size in number of packets.
958Default value is 60.
959.It Cm packetsize
960The average packet size in number of bytes.
961Default value is 1000.
962.It Cm maxpmark
963specifies the precision of marking probability.
964.It Cm holdtime
965specifies the hold time in usec.
966.It Cm ecn
967enables ECN.
968.El
969.Ss CDNR Commands
970The
971.Cm conditioner
972command specifies a diffserv traffic conditioner.
973A traffic conditioner is not a queueing discipline but a component to
974meter, mark or drop incoming packets according to some rules.
975.Pp
976As opposed to a queueing discipline, a traffic conditioner handles
977incoming packets at an input interface.
978If no queueing discipline (e.g., CBQ) is used for the interface,
979a null interface command should be used to specify an input network
980interface.
981.Bl -tag -width interface -offset indent
982.It Cm interface
983.Ar if_name
984.Op Cm bandwidth Ar bps
985.Op Cm tbrsize Ar bytes
986.El
987.Pp
988The
989.Cm conditioner
990command has the following syntax.
991.Bl -tag -width conditioner -offset indent
992.It Cm conditioner
993.Ar if_name
994.Ar cdnr_name
995.Aq action
996.El
997.Pp
998.Bl -tag -width 10n -offset indent
999.It Ar if_name
1000Interface name.
1001Must correspond to name in interface specification.
1002.It Ar cdnr_name
1003Arbitrary name for this conditioner.
1004Must be unique for this interface.
1005.It Ar action
1006Action of the conditioner.
1007.El
1008.Pp
1009An action can be a recursively defined action.
1010The following actions are defined.
1011.Bl -tag -width pass -offset indent
1012.It Cm pass
1013.Bl -inset -offset indent
1014.It Cm pass
1015allows the packet to go through without any modification to the packet.
1016.El
1017.El
1018.Pp
1019.Bl -tag -width drop -offset indent
1020.It Cm drop
1021.Bl -inset -offset indent
1022.It Cm drop
1023rejects the packet.
1024The packet is immediately discarded.
1025.El
1026.El
1027.Pp
1028.Bl -tag -width mark -offset indent
1029.It Cm mark
1030.Ar value
1031.Bl -inset -offset indent
1032.It Cm mark
1033sets the specified value to the ds field in the IP header.
1034Then, the packet is allowed to go through.
1035.El
1036.El
1037.Pp
1038.Bl -tag -width tbmeter -offset indent
1039.It Cm tbmeter
1040.Ar rate depth
1041.Aq in_action
1042.Aq out_action
1043.Pp
1044.Bl -inset -offset indent
1045.It Cm tbmeter
1046is a token bucket meter configured with rate and depth parameters.
1047Rate is token rate in bits-per-second.
1048Depth is bucket depth in KB.
1049When an incoming packet is in profile (available token is more than
1050the packet size), tbmeter takes in_action.
1051Otherwise, tbmeter takes out_action.
1052.El
1053.El
1054.Pp
1055.Bl -tag -width trtcm -offset indent
1056.It Cm trtcm
1057.Ar cmtd_rate cmtd_depth peak_rate peak_depth
1058.Aq green_action
1059.Aq yellow_action
1060.Aq red_action
1061.Op Cm coloraware|colorblind
1062.Bl -inset -offset indent
1063.It Cm trtcm
1064is a 2-rate 3 color marker for Assured Forwarding.
1065A trtcm consists of 2 token buckets, one for a committed rate and the
1066other for a peak rate.
1067When an incoming packet is in the committed profile, trtcm takes
1068green_action.
1069When the packet is out of the committed profile but in the peak
1070profile, trtcm takes yellow_action.
1071Otherwise, tbtcm takes red_action.
1072A trtcm is either color-aware or color-blind.
1073A color-aware trtcm do not raise the color (ds field value), that is,
1074a yellow packet can be yellow or red but can not be blue.
1075Default is color-blind.
1076.El
1077.El
1078.Pp
1079.Bl -tag -width tswtcm -offset indent
1080.It Cm tswtcm
1081.Ar cmtd_rate peak_rate avg_interval
1082.Aq green_action
1083.Aq yellow_action
1084.Aq red_action
1085.Bl -inset -offset indent
1086.It Cm tswtcm
1087is a time sliding window 3 color marker for Assured Forwarding.
1088A tswtcm differs from trtcm in that a tswtcm probabilistically marks
1089packets.
1090A tswtcm consists of 2 rates, one for a committed rate and the
1091other for a peak rate.
1092When an incoming packet is in the committed profile, tswtcm takes
1093green_action.
1094When the packet is out of the committed profile but in the peak
1095profile, tswtcm takes yellow_action.
1096Otherwise, tswtcm takes red_action.
1097cmtd_rate and peak_rate are specified in bits per second.
1098avg_interval provides the size of time window for averaging incoming
1099rate, and is specified in milliseconds.
1100500 msec is ok for normal settings.
1101.El
1102.El
1103.Ss JoBS Commands
1104JoBS (Joint Buffer Management and Scheduling) is a queuing discipline
1105that can enforce any feasible mix of absolute and proportional guarantees
1106on packet losses, packet delays, and throughput, for classes of traffic,
1107on a per-hop basis.
1108No admission control is performed, thus if the set of service
1109guarantees becomes infeasible, some service guarantees may be
1110relaxed.
1111.Bl -tag -width interface -offset indent
1112.It Cm interface
1113.Ar if_name
1114.Op Cm bandwidth Ar bps
1115.Op Cm qlimit Ar count
1116.Op Cm separate
1117.Op Cm tbrsize Ar bytes
1118.Op Ar sched_type
1119.El
1120.Pp
1121.Bl -tag -width 8n -offset indent
1122.It Ar if_name
1123specifies the name of a network interface (e.g., fxp0).
1124.It Cm bandwidth
1125specifies the interface bandwidth in bits per second.
1126.It Cm qlimit
1127specifies the maximum queue size in number of packets.
1128.It Cm separate
1129specifies that classes have independent buffers.
1130The default is to have a shared buffer for all classes.
1131If this option is specified, qlimit applies to each independent
1132buffer.
1133.It Cm tbrsize
1134specifies the bucket size of a token bucket regulator in bytes.
1135.It Ar sched_type
1136must be
1137.Cm jobs
1138for JoBS.
1139.El
1140.Pp
1141.Bl -tag -width class -offset indent
1142.It Cm class
1143.Ar sched_type
1144.Ar if_name
1145.Ar class_name
1146.Ar parent_name
1147.Op Cm priority Ar pri
1148.Op Cm default
1149.Op Cm adc Ar microsecs
1150.Op Cm alc Ar fraction
1151.Op Cm arc Ar bps
1152.Op Cm rdc Ar prop
1153.Op Cm rlc Ar prop
1154.El
1155.Pp
1156.Bl -tag -width 8n -offset indent
1157.It Ar sched_type
1158must be
1159.Cm jobs
1160for a JoBS class.
1161.It Ar if_name
1162Interface name.
1163Must correspond to name in interface specification.
1164.It Ar class_name
1165Arbitrary name for this class.
1166Must be unique for this interface.
1167.It Ar parent_name
1168Parent class must be
1169.Dv NULL
1170for JoBS.
1171.It Cm priority
1172Priority index used for proportional differentiation.
1173Max value is 15 and Min value is 0.
1174Default is 0.
1175Priority must be unique for the interface.
1176.It Cm default
1177Specify the default class.
1178When this keyword is present, all packets that do not match some
1179classification criteria are assigned to this class.
1180Must be exactly one class on each interface defined as the
1181default class.
1182.It Cm adc
1183Specifies an upper bound on delays for that class (in microseconds).
1184A value of \-1 will indicate the absence of delay bound.
1185By default, no delay bound is offered.
1186.It Cm alc
1187Specifies a upper bound on loss rate for that class (in fraction of 1,
1188for instance a 1% loss rate bound will be expressed as 0.01).
1189A value of \-1 will indicate the absence of loss rate bound.
1190By default, no loss rate bound is offered.
1191.It Cm arc
1192Specifies a lower bound
1193on the throughput received by that class (in bits per second).
1194A value of
1195\-1 will indicate the absence of throughput bound.
1196By default, no throughput bound is offered.
1197.It Cm rdc
1198Specifies a proportional delay differentiation factor between that class
1199and the class with the successive priority index.
1200For instance, for priority 1, an rdc of 2 specifies that the delays of
1201packets marked as class 2 will roughly be twice the delays of packets
1202marked as class 1.
1203A value of
1204\-1 indicates the absence of proportional differentiation on that class.
1205Note that class N if N is the maximum priority should have a dummy
1206coefficient different from \-1 if proportional delay differentiation is desired
1207on Class N.
1208By default, no proportional delay differentiation is offered.
1209.It Cm rlc
1210Specifies a proportional loss differentiation factor between that class
1211and the class with the successive priority index.
1212For instance, for priority 1, an rlc of 2 specifies that the loss rate of
1213packets marked as class 2 will roughly be twice the loss rate of packets
1214marked as class 1.
1215A value of
1216\-1 indicates the absence of proportional differentiation on that class.
1217Note that class N if N is the maximum priority should have a dummy
1218coefficient different from \-1 if proportional loss differentiation is desired
1219on Class N.
1220By default, no proportional loss differentiation is offered.
1221.El
1222.Sh EXAMPLES
1223.Ss CBQ Example
1224.Bd -literal
1225#
1226# cbq configuration for vx0 (10Mbps ether)
1227# give at least 40% to TCP
1228# limit HTTP from network 133.138.1.0 up to 10%, use RED.
1229# other traffic goes into default class
1230#
1231interface vx0 bandwidth 10M cbq
1232#
1233class cbq vx0 root_class NULL priority 0 pbandwidth 100
1234class cbq vx0 def_class root_class borrow pbandwidth 95 default
1235class cbq vx0 tcp_class def_class borrow pbandwidth  40
1236        filter vx0 tcp_class 0 0 0 0 6
1237class cbq vx0 csl_class tcp_class pbandwidth  10   red
1238        filter vx0 csl_class 0 0 133.138.1.0 netmask 0xffffff00 80 6
1239        filter vx0 csl_class 133.138.1.0 netmask 0xffffff00 0 0 80 6
1240#
1241# sample filter6 command
1242#
1243                filter6 vx0 csl_class ::0 0 2001:db8:0:123::/64 80 6
1244.Ed
1245.Ss HFSC Example
1246.Bd -literal
1247#
1248# hfsc configuration for hierarchical sharing
1249#
1250interface pvc0 bandwidth 45M hfsc
1251#
1252# (10% of the bandwidth share goes to the default class)
1253class hfsc pvc0 def_class root pshare 10 default
1254#
1255#          bandwidth share    guaranteed rate
1256#    CMU:       45%             15Mbps
1257#    PITT:      45%             15Mbps
1258#
1259class hfsc pvc0 cmu  root pshare 45 grate 15M
1260class hfsc pvc0 pitt root pshare 45 grate 15M
1261#
1262# CMU      bandwidth share    guaranteed rate
1263#    CS:        20%             10Mbps
1264#    other:     20%              5Mbps
1265#
1266class hfsc pvc0 cmu_other cmu  pshare 20 grate 10M
1267        filter pvc0 cmu_other   0 0 128.2.0.0   netmask 0xffff0000 0 0
1268class hfsc pvc0 cmu_cs    cmu  pshare 20 grate  5M
1269        filter pvc0 cmu_cs      0 0 128.2.242.0 netmask 0xffffff00 0 0
1270#
1271# PITT     bandwidth share    guaranteed rate
1272#    CS:        20%             10Mbps
1273#    other:     20%              5Mbps
1274#
1275class hfsc pvc0 pitt_other pitt  pshare 20 grate 10M
1276        filter pvc0 pitt_other  0 0 136.142.0.0  netmask 0xffff0000 0 0
1277class hfsc pvc0 pitt_cs    pitt  pshare 20 grate  5M
1278        filter pvc0 pitt_cs     0 0 136.142.79.0 netmask 0xffffff00 0 0
1279.Ed
1280.Ss HFSC Example (simpler one with ulimit)
1281.Bd -literal
1282#
1283interface fxp0 bandwidth 90M hfsc
1284# reserve 20% for default class
1285class hfsc fxp0 def_class root pshare 20 default
1286# shared class for TCP and UDP
1287class hfsc fxp0 shared_class root bandwidth 72M
1288# shared class for all TCP
1289class hfsc fxp0 tcp_shared shared_class bandwidth 40M ulimit 60M
1290# generic tcp
1291class hfsc fxp0 tcp_class tcp_shared bandwidth 15M ulimit 50M
1292	filter fxp0 tcp_class 0 0 0 0 6
1293# http
1294class hfsc fxp0 http_class tcp_shared bandwidth 25M ulimit 40M
1295	filter fxp0 http_class 0 80 0 0 6
1296	filter fxp0 http_class 0 0 0 80 6
1297# udp
1298class hfsc fxp0 udp_class shared_class bandwidth 15M ulimit 20M
1299	filter fxp0 udp_class 0 0 0 0 17
1300.Ed
1301.Ss PRIQ Example
1302.Bd -literal
1303#
1304# priq configuration for fxp0 (100Mbps ether)
1305#     icmp: high priority
1306#     tcp:  medium priority
1307#     others: low priority
1308#
1309interface fxp0 bandwidth 100M priq
1310#
1311class priq fxp0 high_class NULL priority 2
1312        filter fxp0 high_class 0 0 0 0 1
1313class priq fxp0 med_class NULL priority 1
1314        filter fxp0 med_class 0 0 0 0 6
1315class priq fxp0 low_class NULL priority 0 default
1316.Ed
1317.Ss WFQ Example
1318.Bd -literal
1319interface pvc0 bandwidth 134000000 wfq
1320.Ed
1321.Ss FIFOQ Example
1322.Bd -literal
1323interface rl0 bandwidth 10M fifoq
1324.Ed
1325.Ss Conditioner Example
1326.Bd -literal
1327#
1328interface fxp0
1329#
1330# a simple dropper
1331# discard all packets from 192.168.0.83
1332#
1333conditioner fxp0 dropper \*[Lt]drop\*[Gt]
1334        filter fxp0 dropper 0 0 192.168.0.83 0 0
1335
1336#
1337# EF conditioner
1338# mark EF to all packets from 192.168.0.117
1339#
1340conditioner pvc1 ef_cdnr \*[Lt]tbmeter 6M 64K \*[Lt]mark 0xb8\*[Gt]\*[Lt]drop\*[Gt]\*[Gt]
1341        filter fxp0 ef_cdnr 0 0 192.168.0.117 0 0
1342
1343#
1344# AF1x conditioner
1345# mark AF1x to packets from 192.168.0.178
1346#       AF11 (low drop precedence):    less than 3Mbps
1347#       AF12 (medium drop precedence): more than 3Mbps and less than 10Mbps
1348#       AF13 (high drop precedence):   more than 10Mbps
1349#
1350conditioner fxp0 af1x_cdnr \*[Lt]trtcm 3M 32K 10M 64K \*[Lt]mark 0x28\*[Gt]\*[Lt]mark 0x30\*[Gt]\*[Lt]mark 0x38\*[Gt]\*[Gt]
1351        filter fxp0 af1x_cdnr 0 0 192.168.0.178 0 0
1352.Ed
1353.Sh SEE ALSO
1354.Xr altqd 8
1355.Sh BUGS
1356This man page is incomplete.
1357For more information read the source.
1358