xref: /netbsd-src/usr.sbin/altq/altqd/altq.conf.5 (revision 1fa2b30b264d0810d8d569a0c8605e08dfa636d0)
1.\"	$NetBSD: altq.conf.5,v 1.19 2021/07/14 08:32:13 ozaki-r 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 July 14, 2021
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.Op Cm no-control
285.Op Cm no-tbr
286.El
287.Bl -tag -width 8n -offset indent
288.It Ar if_name
289specifies the name of a network interface (e.g., fxp0).
290.It Cm bandwidth
291specifies the interface bandwidth in bits per second.
292.It Cm tbrsize
293specifies the bucket size of a token bucket regulator in bytes.
294.It Ar sched_type
295must be either
296.Cm cbq ,
297.Cm cbq-wrr
298(weighted-round robin) or
299.Cm cbq-prr
300(packet-by-packet round robin).
301.Cm cbq
302is equivalent to
303.Cm cbq-wrr .
304.It Cm efficient
305Enables CBQ's link efficiency mode.
306This means that the scheduler will send a packet from the first
307overlimit class it encounters of all classes of the link-sharing
308structure when all classes are overlimit.
309This will also cause the scheduler to use greater than its assigned
310bandwidth, if the link is capable of more than the assigned bandwidth.
311By default, this mode is turned off.
312By adding the keyword
313.Cm efficient
314to the interface specification line, enables this mode.
315.It Cm no-control
316By default, the control class is automatically created when default class is
317created and one doesn't exist yet.
318This option suppresses the behavior on the interface.
319.It Cm no-tbr
320By default, a token bucket regulator is automatically created on each interface.
321This option suppresses the behavior on the interface.
322.El
323.Bl -tag -width class -offset indent
324.It Cm class
325.Ar sched_type
326.Ar if_name
327.Ar class_name
328.Ar parent_name
329.Op Cm admission cntlload|none
330.Op Cm priority Ar pri
331.Op Cm pbandwidth Ar percent
332.Op Cm exactbandwidth Ar bps
333.Op Cm borrow
334.Op Cm default
335.Op Cm control
336.Op Cm maxburst Ar count
337.Op Cm minburst Ar count
338.Bk -words
339.Op Cm maxdelay Ar msec
340.Ek
341.Op Cm packetsize Ar bytes
342.Op Cm maxpacketsize Ar bytes
343.Op Cm red|rio
344.Op Cm ecn
345.Op Cm flowvalve
346.Op Cm cleardscp
347.El
348.Pp
349The
350.Cm class
351command specifies a CBQ class.
352The classes are organized as a hierarchy, and every class, except
353for the root class, has a parent.
354.Bl -tag -width 8n -offset indent
355.It Ar sched_type
356must be
357.Cm cbq
358for a CBQ class.
359.It Ar if_name
360Interface name.
361Must correspond to name in interface specification.
362.It Ar class_name
363Arbitrary name for this class.
364Must be unique within the class
365hierarchy for this interface.
366The name
367.Cm ctl_class
368is a reserved class name.
369.It Cm parent_name
370The name of the parent class for this class or
371.Dv NULL
372if this is the root class.
373Parent class must have been previously defined.
374.It Cm admission
375The type of admission control and QoS type.
376.Cm cntlload
377is controlled load service for RSVP, otherwise, it should be
378.Cm none .
379The default is
380.Cm none .
381.It Cm priority
382High numbers are higher priority.
383Max value is 7 and Min value is 0.
384Default is 1.
385.It Cm pbandwidth
386The percentage of the interface bandwidth allocated to this class.
387Generally should add up to 100 percent at each level of the class
388hierarchy, although other amounts can be specified for purposes of
389experimentation.
390.It Cm exactbandwidth
391Specify the bandwidth in bits-per-second instead of
392.Cm pbandwidth .
393Note that the bandwidth allocation of CBQ is not so precise but this
394is just a way to pass a parameter to CBQ; the user is supposed to know
395the detailed internals of CBQ.
396.Cm pbandwidth
397is a preferred way to specify the bandwidth of a class.
398.It Cm borrow
399The class can borrow bandwidth from its parent class when this class
400is overlimit.
401If this keyword is not present, then no borrowing is done, and the
402packet is delayed or dropped when the class is overlimit.
403.It Cm default
404Specify the default class.
405When this keyword is present, all packets that do not match some
406classification criteria are assigned to this class.
407Must be exactly one class on each interface defined as the default
408class.
409.It Cm control
410Specify the control class.
411When this keyword is present, the predefined control class packets
412(RSVP, IGMP, and ICMP) are assigned to this class.
413Note that when the control class is not specified by the time the
414default class is created, one is automatically created with default
415parameters.
416Thus, if the control class is specified, it must be listed before the
417default class.
418Must be exactly one class on each interface defined as the control
419class.
420.It Cm maxburst
421The maximum burst of back-to-back packets allowed in this class.
422Default is 16 but the default value is automatically reduced to 4 when
423the class bandwidth is small (about less than 1Mbps).
424.It Cm minburst
425The minimum burst is used to obtain the steady state burst size.
426It's the parameter to help compute offtime for the class.
427Offtime is the amount of time a class is to wait between packets.
428Default is 2.
429.It Cm maxdelay
430The maxdelay is specified in milliseconds and used to obtain the max
431queue size of the class.
432If not specified, the default max queue size (30 packets) is used.
433.It Cm packetsize
434The average packet size in bytes to be used in CBQ over-/under-limit
435computations.
436Default value is MTU of the interface.
437.It Cm maxpacketsize
438The maximum packet size in bytes for the class.
439Default value is MTU of the interface.
440.It Cm red
441enables RED on this class queue.
442.It Cm rio
443enables RIO on this class queue.
444.It Cm ecn
445enables RED/ECN on this class queue.
446.It Cm flowvalve
447enables RED/flow-valve (a.k.a. red-penalty-box) on this class queue.
448.It Cm cleardscp
449clears diffserv codepoint in the IP header.
450.El
451.Ss HFSC Commands
452HFSC (Hierarchical Fair Service Curve) supports both link-sharing and
453guaranteed real-time services.
454H-FSC employs a service curve based QoS model, and its unique feature
455is an ability to decouple delay and bandwidth allocation.
456HFSC has 2 independent scheduling mechanisms.
457Real-time scheduling is used to guarantee the delay and the
458bandwidth allocation at the same time.
459Hierarchical link-sharing is used to distribute the excess
460bandwidth.
461When dequeueing a packet, HFSC always tries real-time scheduling
462first.
463If no packet is eligible for real-time scheduling, link-sharing
464scheduling is performed.
465HFSC does not use class hierarchy for real-time scheduling.
466Additionally, an upper-limit service curve can be specified for
467link-sharing to set the upper limit allowed for the class.
468.Bl -tag -width interface -offset indent
469.It Cm interface
470.Ar if_name
471.Op Cm bandwidth Ar bps
472.Op Cm tbrsize Ar bytes
473.Op Ar sched_type
474.El
475.Bl -tag -width 8n -offset indent
476.It Ar if_name
477specifies the name of a network interface (e.g., fxp0).
478.It Cm bandwidth
479specifies the interface bandwidth in bits per second.
480.It Cm tbrsize
481specifies the bucket size of a token bucket regulator in bytes.
482.It Ar sched_type
483must be
484.Cm hfsc
485for HFSC.
486.El
487.Bl -tag -width class -offset indent
488.It Cm class
489.Ar sched_type
490.Ar if_name
491.Ar class_name
492.Ar parent_name
493.Op Cm admission cntlload|none
494.Op Bq Cm sc Ar m1 d m2
495.Op Bq Cm rt Ar m1 d m2
496.Op Bq Cm ls Ar m1 d m2
497.Op Bq Cm ul Ar m1 d m2
498.Op Cm pshare Ar percent
499.Op Cm grate Ar bps
500.Op Cm bandwidth Ar bps
501.Op Cm ulimit Ar bps
502.Op Cm default
503.Op Cm qlimit Ar count
504.Op Cm red|rio
505.Op Cm ecn
506.Op Cm cleardscp
507.El
508.Pp
509The
510.Cm class
511command specifies a HFSC class.
512The classes are organized as a hierarchy, and every class, except
513for the root class, has a parent.
514.Pp
515Each HFSC class has 2 service curves, the real-time service curve and
516the link-sharing service curve.
517Service curves are specified by
518.Bq Ar type Ar m1 d m2 .
519.Ar type
520should be either
521.Cm sc , rt , ls ,
522or
523.Cm ul .
524.Cm sc
525(service curve) is used to set the same values to both real-time and
526link-sharing service curves.
527.Cm rt
528(real-time) is used to specify the real-time service curve.
529.Cm ls
530(link-sharing) is used to specify the link-sharing service curve.
531.Cm ul
532(upper-limit) is used to specify the upper-limit service curve for
533link-sharing.
534.Ar m1
535is the slope of the first segment specified in bits-per-second.
536.Ar d
537is the x-projection of the intersection point of the 2 segments
538specified in milliseconds.
539.Ar m2
540is the slope of the second segment specified in bits-per-second.
541.Bl -tag -width 8n -offset indent
542.It Ar sched_type
543must be
544.Cm hfsc
545for a HFSC class.
546.It Ar if_name
547Interface name.
548Must correspond to name in interface specification.
549.It Ar class_name
550Arbitrary name for this class.
551Must be unique within the class hierarchy for this interface.
552The name
553.Cm root
554is a reserved class name for the root class.
555The root class for the interface is automatically created by the
556.Cm interface
557command.
558.It Ar parent_name
559The name of the parent class for this class.
560Keyword
561.Cm root
562is used when the parent is the root class.
563Parent class must have been previously defined.
564.It Cm admission
565The type of admission control and QoS type.
566.Cm cntlload
567is controlled load service for RSVP, otherwise, it should be
568.Cm none .
569The default is
570.Cm none .
571.It Cm pshare
572Percent of the link share.
573This specifies a linear link-sharing service curve as a fraction of
574the link bandwidth.
575It is a short hand of
576.Li [ls 0 0 (link-bandwidth * percent / 100)] .
577.It Cm grate
578Guaranteed rate.
579This specifies a linear real-time service curve.
580It is a short hand of
581.Li [rt 0 0 bps] .
582.It Cm bandwidth
583This is a short hand of
584.Li [sc 0 0 bps] .
585.It Cm ulimit
586Upper limit rate.
587This specifies a upper-limit service curve.
588It is a short hand of
589.Li [ul 0 0 bps] .
590.It Cm default
591Specify the default class.
592When this keyword is present, all packets that do not match some
593classification criteria are assigned to this class.
594Must be exactly one class on each interface defined as the default
595class.
596.It Cm qlimit
597The maximum queue size in number of packets.
598Default value is 50.
599.It Cm red
600enables RED on this class queue.
601.It Cm rio
602enables RIO on this class queue.
603.It Cm ecn
604enables RED/ECN on this class queue.
605.It Cm cleardscp
606clears diffserv codepoint in the IP header.
607.El
608.Ss PRIQ Commands
609PRIQ (Priority Queueing) implements a simple priority-based queueing.
610A higher priority class is always served first.
611Up to 16 priorities can be used with PRIQ.
612.Bl -tag -width interface -offset indent
613.It Cm interface
614.Ar if_name
615.Op Cm bandwidth Ar bps
616.Op Cm tbrsize Ar bytes
617.Op Ar sched_type
618.El
619.Bl -tag -width 8n -offset indent
620.It Ar if_name
621specifies the name of a network interface (e.g., fxp0).
622.It Cm bandwidth
623specifies the interface bandwidth in bits per second.
624.It Cm tbrsize
625specifies the bucket size of a token bucket regulator in bytes.
626.It Ar sched_type
627must be
628.Cm priq
629for PRIQ.
630.El
631.Bl -tag -width class -offset indent
632.It Cm class
633.Ar sched_type
634.Ar if_name
635.Ar class_name
636.Ar parent_name
637.Op Cm priority Ar pri
638.Op Cm default
639.Op Cm qlimit Ar count
640.Op Cm red|rio
641.Op Cm ecn
642.Op Cm cleardscp
643.El
644.Bl -tag -width 8n -offset indent
645.It Ar sched_type
646must be
647.Cm priq
648for a PRIQ class.
649.It Ar if_name
650Interface name.
651Must correspond to name in interface specification.
652.It Ar class_name
653Arbitrary name for this class.
654Must be unique for this interface.
655.It Ar parent_name
656Parent class must be
657.Dv NULL
658for PRIQ.
659.It Cm priority
660High numbers are higher priority.
661Max value is 15 and Min value is 0.
662Default is 0.
663A higher priority class is always served first in PRIQ.
664Priority must be unique for the interface.
665.It Cm default
666Specify the default class.
667When this keyword is present, all packets that do not match some
668classification criteria are assigned to this class.
669Must be exactly one class on each interface defined as the default
670class.
671.It Cm qlimit
672The maximum queue size in number of packets.
673Default value is 50.
674.It Cm red
675enables RED on this class queue.
676.It Cm rio
677enables RIO on this class queue.
678.It Cm ecn
679enables RED/ECN on this class queue.
680.It Cm cleardscp
681clears diffserv codepoint in the IP header.
682.El
683.Ss WFQ Commands
684WFQ (Weighted Fair Queueing) implements a weighted-round robin
685scheduler for a set of queue.
686A weight can be assigned to each queue to give a
687different proportion of the link capacity.
688A hash function is used to map a flow to one of a set of queues, and
689thus, it is possible for two different flows to be mapped into the same
690queue.
691.Bl -tag -width interface -offset indent
692.It Cm interface
693.Ar if_name
694.Op Cm bandwidth Ar bps
695.Op Cm tbrsize Ar bytes
696.Op Ar sched_type
697.Op Cm nqueues Ar count
698.Op Cm qsize Ar bytes
699.Op Cm hash Ar policy
700.El
701.Bl -tag -width 8n -offset indent
702.It Cm if_name
703specifies the name of a network interface (e.g., fxp0).
704.It Cm bandwidth
705specifies the interface bandwidth in bits per second.
706.It Cm tbrsize
707specifies the bucket size of a token bucket regulator in bytes.
708.It Ar sched_type
709must be
710.Cm wfq
711for WFQ.
712.It Cm nqueues
713The number of queues in WFQ.
714Default value is 256.
715.It Cm qsize
716The size of each queue in number of bytes.
717Default value is 64K bytes.
718.It Cm hash
719Type of hash policy to select a queue.
720.Cm dstaddr
721specifies a hashing policy by IP destination address.
722.Cm full
723specifies a hashing policy by IP addresses and ports.
724.Cm srcport
725specifies a hashing policy by IP source port number.
726.Cm srcaddr
727specifies a hashing policy by IP source address.
728Default is
729.Cm dstaddr
730.El
731.Ss FIFOQ Commands
732FIFOQ (First-In First-Out Queueing) is a simple tail-drop FIFO queue.
733FIFOQ is the simplest possible implementation of a queueing discipline
734in ALTQ, and can be used to compare with other queueing disciplines.
735FIFOQ can be also used as a template for those who want to write their
736own queueing disciplines.
737.Bl -tag -width interface -offset indent
738.It Cm interface
739.Ar if_name
740.Op Cm bandwidth Ar bps
741.Op Cm tbrsize Ar bytes
742.Op Ar sched_type
743.Op Cm qlimit Ar count
744.El
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.Bl -tag -width 8n -offset indent
799.It Ar if_name
800specifies the name of a network interface (e.g., fxp0).
801.It Cm bandwidth
802specifies the interface bandwidth in bits per second.
803.It Cm tbrsize
804specifies the bucket size of a token bucket regulator in bytes.
805.It Ar sched_type
806must be
807.Cm red
808for RED.
809.It Cm qlimit
810The maximum queue size in number of packets.
811Default value is 60.
812.It Cm packetsize
813The average packet size in number of bytes.
814This parameter is used to calibrate the idle period.
815Default value is 1000.
816.It Cm weight
817The inverse of the weight of EWMA (exponentially weighted moving average).
818.It Cm thmin
819The minimum threshold.
820.It Cm thmax
821The maximum threshold.
822.It Cm invpmax
823The inverse of the maximum drop probability.
824.It Cm ecn
825enables ECN.
826.It Cm flowvalve
827enables flowvalve.
828.El
829.Ss RIO Commands
830ALTQ/RIO has 3 drop precedence levels defined for the Assured
831Forwarding of DiffServ (RFC2597).
832Since adaptive flows are likely to stay under the medium drop
833precedence level under congestion, the medium drop precedence would
834protect adaptive flows from unadaptive flows.
835.Pp
836The original RIO has 2 sets of RED parameters; one for in-profile
837packets and the other for out-of-profile packets.
838At the ingress of the network, profile meters tag packets as IN
839or OUT based on contracted profiles for customers.
840Inside the network, IN packets receive preferential treatment by
841the RIO dropper.
842It is possible to provision the network not to drop IN packets
843at all by providing enough capacity for the total volume of IN
844packets.
845Thus, RIO can be used to provide a service that statistically assures
846capacity allocated for users.
847This mechanism can be extended to support an arbitrary number of drop
848precedence levels.
849ALTQ supports 3 drop precedence levels.
850.Bl -tag -width rio -offset indent
851.It Cm rio
852.Ar low_min_th
853.Ar low_max_th
854.Ar low_inv_pmax
855.Ar medium_min_th
856.Ar medium_max_th
857.Ar medium_inv_pmax
858.Ar high_min_th
859.Ar high_max_th
860.Ar high_inv_pmax
861.El
862.Pp
863The
864.Cm rio
865command sets the default RIO parameters.
866The parameters are RED parameters for 3 (low, medium, high) drop
867precedence.
868.Bl -tag -width interface -offset indent
869.It Cm interface
870.Ar if_name
871.Op Cm bandwidth Ar bps
872.Op Cm tbrsize Ar bytes
873.Op Ar sched_type
874.Op Cm qlimit Ar count
875.Op Cm packetsize Ar bytes
876.Op Cm weight Ar n
877.Op Cm lo_thmin Ar n
878.Op Cm lo_thmax Ar n
879.Op Cm lo_invpmax Ar n
880.Op Cm med_thmin Ar n
881.Op Cm med_thmax Ar n
882.Op Cm med_invpmax Ar n
883.Op Cm hi_thmin Ar n
884.Op Cm hi_thmax Ar n
885.Op Cm hi_invpmax Ar n
886.Op Cm ecn
887.El
888.Bl -tag -width 8n -offset indent
889.It Ar if_name
890specifies the name of a network interface (e.g., fxp0).
891.It Cm bandwidth
892specifies the interface bandwidth in bits per second.
893.It Cm tbrsize
894specifies the bucket size of a token bucket regulator in bytes.
895.It Ar sched_type
896must be
897.Cm rio
898for RIO.
899.It Cm qlimit
900The maximum queue size in number of packets.
901Default value is 60.
902.It Cm packetsize
903The average packet size in number of bytes.
904This parameter is used to calibrate the idle period.
905Default value is 1000.
906.It Cm weight
907The inverse of the weight of EWMA (exponentially weighted moving average).
908.It Cm lo_thmin
909The minimum threshold for low drop precedence.
910.It Cm lo_thmax
911The maximum threshold for low drop precedence.
912.It Cm lo_invpmax
913The inverse of the maximum drop probability for low drop precedence.
914.It Cm med_thmin
915The minimum threshold for medium drop precedence.
916.It Cm med_thmax
917The maximum threshold for medium drop precedence.
918.It Cm med_invpmax
919The inverse of the maximum drop probability for medium drop precedence.
920.It Cm hi_thmin
921The minimum threshold for high drop precedence.
922.It Cm hi_thmax
923The maximum threshold for high drop precedence.
924.It Cm hi_invpmax
925The inverse of the maximum drop probability for high drop precedence.
926.It Cm ecn
927enables ECN.
928.El
929.Ss BLUE Commands
930.Bl -tag -width interface -offset indent
931.It Cm interface
932.Ar if_name
933.Op Cm bandwidth Ar bps
934.Op Cm tbrsize Ar bytes
935.Op Ar sched_type
936.Op Cm qlimit Ar count
937.Op Cm packetsize Ar bytes
938.Op Cm maxpmark Ar n
939.Op Cm holdtime Ar usec
940.Op Cm ecn
941.El
942.Bl -tag -width 8n -offset indent
943.It Ar if_name
944specifies the name of a network interface (e.g., fxp0).
945.It Cm bandwidth
946specifies the interface bandwidth in bits per second.
947.It Cm tbrsize
948specifies the bucket size of a token bucket regulator in bytes.
949.It Ar sched_type
950must be
951.Cm blue
952for BLUE.
953.It Cm qlimit
954The maximum queue size in number of packets.
955Default value is 60.
956.It Cm packetsize
957The average packet size in number of bytes.
958Default value is 1000.
959.It Cm maxpmark
960specifies the precision of marking probability.
961.It Cm holdtime
962specifies the hold time in usec.
963.It Cm ecn
964enables ECN.
965.El
966.Ss CDNR Commands
967The
968.Cm conditioner
969command specifies a diffserv traffic conditioner.
970A traffic conditioner is not a queueing discipline but a component to
971meter, mark or drop incoming packets according to some rules.
972.Pp
973As opposed to a queueing discipline, a traffic conditioner handles
974incoming packets at an input interface.
975If no queueing discipline (e.g., CBQ) is used for the interface,
976a null interface command should be used to specify an input network
977interface.
978.Bl -tag -width interface -offset indent
979.It Cm interface
980.Ar if_name
981.Op Cm bandwidth Ar bps
982.Op Cm tbrsize Ar bytes
983.El
984.Pp
985The
986.Cm conditioner
987command has the following syntax.
988.Bl -tag -width conditioner -offset indent
989.It Cm conditioner
990.Ar if_name
991.Ar cdnr_name
992.Aq action
993.El
994.Bl -tag -width 10n -offset indent
995.It Ar if_name
996Interface name.
997Must correspond to name in interface specification.
998.It Ar cdnr_name
999Arbitrary name for this conditioner.
1000Must be unique for this interface.
1001.It Ar action
1002Action of the conditioner.
1003.El
1004.Pp
1005An action can be a recursively defined action.
1006The following actions are defined.
1007.Bl -tag -width pass -offset indent
1008.It Cm pass
1009.Bl -inset -offset indent
1010.It Cm pass
1011allows the packet to go through without any modification to the packet.
1012.El
1013.El
1014.Bl -tag -width drop -offset indent
1015.It Cm drop
1016.Bl -inset -offset indent
1017.It Cm drop
1018rejects the packet.
1019The packet is immediately discarded.
1020.El
1021.El
1022.Bl -tag -width mark -offset indent
1023.It Cm mark
1024.Ar value
1025.Bl -inset -offset indent
1026.It Cm mark
1027sets the specified value to the ds field in the IP header.
1028Then, the packet is allowed to go through.
1029.El
1030.El
1031.Bl -tag -width tbmeter -offset indent
1032.It Cm tbmeter
1033.Ar rate depth
1034.Aq in_action
1035.Aq out_action
1036.Bl -inset -offset indent
1037.It Cm tbmeter
1038is a token bucket meter configured with rate and depth parameters.
1039Rate is token rate in bits-per-second.
1040Depth is bucket depth in KB.
1041When an incoming packet is in profile (available token is more than
1042the packet size), tbmeter takes in_action.
1043Otherwise, tbmeter takes out_action.
1044.El
1045.El
1046.Bl -tag -width trtcm -offset indent
1047.It Cm trtcm
1048.Ar cmtd_rate cmtd_depth peak_rate peak_depth
1049.Aq green_action
1050.Aq yellow_action
1051.Aq red_action
1052.Op Cm coloraware|colorblind
1053.Bl -inset -offset indent
1054.It Cm trtcm
1055is a 2-rate 3 color marker for Assured Forwarding.
1056A trtcm consists of 2 token buckets, one for a committed rate and the
1057other for a peak rate.
1058When an incoming packet is in the committed profile, trtcm takes
1059green_action.
1060When the packet is out of the committed profile but in the peak
1061profile, trtcm takes yellow_action.
1062Otherwise, tbtcm takes red_action.
1063A trtcm is either color-aware or color-blind.
1064A color-aware trtcm do not raise the color (ds field value), that is,
1065a yellow packet can be yellow or red but can not be blue.
1066Default is color-blind.
1067.El
1068.El
1069.Bl -tag -width tswtcm -offset indent
1070.It Cm tswtcm
1071.Ar cmtd_rate peak_rate avg_interval
1072.Aq green_action
1073.Aq yellow_action
1074.Aq red_action
1075.Bl -inset -offset indent
1076.It Cm tswtcm
1077is a time sliding window 3 color marker for Assured Forwarding.
1078A tswtcm differs from trtcm in that a tswtcm probabilistically marks
1079packets.
1080A tswtcm consists of 2 rates, one for a committed rate and the
1081other for a peak rate.
1082When an incoming packet is in the committed profile, tswtcm takes
1083green_action.
1084When the packet is out of the committed profile but in the peak
1085profile, tswtcm takes yellow_action.
1086Otherwise, tswtcm takes red_action.
1087cmtd_rate and peak_rate are specified in bits per second.
1088avg_interval provides the size of time window for averaging incoming
1089rate, and is specified in milliseconds.
1090500 msec is ok for normal settings.
1091.El
1092.El
1093.Ss JoBS Commands
1094JoBS (Joint Buffer Management and Scheduling) is a queuing discipline
1095that can enforce any feasible mix of absolute and proportional guarantees
1096on packet losses, packet delays, and throughput, for classes of traffic,
1097on a per-hop basis.
1098No admission control is performed, thus if the set of service
1099guarantees becomes infeasible, some service guarantees may be
1100relaxed.
1101.Bl -tag -width interface -offset indent
1102.It Cm interface
1103.Ar if_name
1104.Op Cm bandwidth Ar bps
1105.Op Cm qlimit Ar count
1106.Op Cm separate
1107.Op Cm tbrsize Ar bytes
1108.Op Ar sched_type
1109.El
1110.Bl -tag -width 8n -offset indent
1111.It Ar if_name
1112specifies the name of a network interface (e.g., fxp0).
1113.It Cm bandwidth
1114specifies the interface bandwidth in bits per second.
1115.It Cm qlimit
1116specifies the maximum queue size in number of packets.
1117.It Cm separate
1118specifies that classes have independent buffers.
1119The default is to have a shared buffer for all classes.
1120If this option is specified, qlimit applies to each independent
1121buffer.
1122.It Cm tbrsize
1123specifies the bucket size of a token bucket regulator in bytes.
1124.It Ar sched_type
1125must be
1126.Cm jobs
1127for JoBS.
1128.El
1129.Bl -tag -width class -offset indent
1130.It Cm class
1131.Ar sched_type
1132.Ar if_name
1133.Ar class_name
1134.Ar parent_name
1135.Op Cm priority Ar pri
1136.Op Cm default
1137.Op Cm adc Ar microsecs
1138.Op Cm alc Ar fraction
1139.Op Cm arc Ar bps
1140.Op Cm rdc Ar prop
1141.Op Cm rlc Ar prop
1142.El
1143.Bl -tag -width 8n -offset indent
1144.It Ar sched_type
1145must be
1146.Cm jobs
1147for a JoBS class.
1148.It Ar if_name
1149Interface name.
1150Must correspond to name in interface specification.
1151.It Ar class_name
1152Arbitrary name for this class.
1153Must be unique for this interface.
1154.It Ar parent_name
1155Parent class must be
1156.Dv NULL
1157for JoBS.
1158.It Cm priority
1159Priority index used for proportional differentiation.
1160Max value is 15 and Min value is 0.
1161Default is 0.
1162Priority must be unique for the interface.
1163.It Cm default
1164Specify the default class.
1165When this keyword is present, all packets that do not match some
1166classification criteria are assigned to this class.
1167Must be exactly one class on each interface defined as the
1168default class.
1169.It Cm adc
1170Specifies an upper bound on delays for that class (in microseconds).
1171A value of \-1 will indicate the absence of delay bound.
1172By default, no delay bound is offered.
1173.It Cm alc
1174Specifies a upper bound on loss rate for that class (in fraction of 1,
1175for instance a 1% loss rate bound will be expressed as 0.01).
1176A value of \-1 will indicate the absence of loss rate bound.
1177By default, no loss rate bound is offered.
1178.It Cm arc
1179Specifies a lower bound
1180on the throughput received by that class (in bits per second).
1181A value of
1182\-1 will indicate the absence of throughput bound.
1183By default, no throughput bound is offered.
1184.It Cm rdc
1185Specifies a proportional delay differentiation factor between that class
1186and the class with the successive priority index.
1187For instance, for priority 1, an rdc of 2 specifies that the delays of
1188packets marked as class 2 will roughly be twice the delays of packets
1189marked as class 1.
1190A value of
1191\-1 indicates the absence of proportional differentiation on that class.
1192Note that class N if N is the maximum priority should have a dummy
1193coefficient different from \-1 if proportional delay differentiation is desired
1194on Class N.
1195By default, no proportional delay differentiation is offered.
1196.It Cm rlc
1197Specifies a proportional loss differentiation factor between that class
1198and the class with the successive priority index.
1199For instance, for priority 1, an rlc of 2 specifies that the loss rate of
1200packets marked as class 2 will roughly be twice the loss rate of packets
1201marked as class 1.
1202A value of
1203\-1 indicates the absence of proportional differentiation on that class.
1204Note that class N if N is the maximum priority should have a dummy
1205coefficient different from \-1 if proportional loss differentiation is desired
1206on Class N.
1207By default, no proportional loss differentiation is offered.
1208.El
1209.Sh EXAMPLES
1210.Ss CBQ Example
1211.Bd -literal
1212#
1213# cbq configuration for vx0 (10Mbps ether)
1214# give at least 40% to TCP
1215# limit HTTP from network 133.138.1.0 up to 10%, use RED.
1216# other traffic goes into default class
1217#
1218interface vx0 bandwidth 10M cbq
1219#
1220class cbq vx0 root_class NULL priority 0 pbandwidth 100
1221class cbq vx0 def_class root_class borrow pbandwidth 95 default
1222class cbq vx0 tcp_class def_class borrow pbandwidth  40
1223        filter vx0 tcp_class 0 0 0 0 6
1224class cbq vx0 csl_class tcp_class pbandwidth  10   red
1225        filter vx0 csl_class 0 0 133.138.1.0 netmask 0xffffff00 80 6
1226        filter vx0 csl_class 133.138.1.0 netmask 0xffffff00 0 0 80 6
1227#
1228# sample filter6 command
1229#
1230                filter6 vx0 csl_class ::0 0 2001:db8:0:123::/64 80 6
1231.Ed
1232.Ss HFSC Example
1233.Bd -literal
1234#
1235# hfsc configuration for hierarchical sharing
1236#
1237interface pvc0 bandwidth 45M hfsc
1238#
1239# (10% of the bandwidth share goes to the default class)
1240class hfsc pvc0 def_class root pshare 10 default
1241#
1242#          bandwidth share    guaranteed rate
1243#    CMU:       45%             15Mbps
1244#    PITT:      45%             15Mbps
1245#
1246class hfsc pvc0 cmu  root pshare 45 grate 15M
1247class hfsc pvc0 pitt root pshare 45 grate 15M
1248#
1249# CMU      bandwidth share    guaranteed rate
1250#    CS:        20%             10Mbps
1251#    other:     20%              5Mbps
1252#
1253class hfsc pvc0 cmu_other cmu  pshare 20 grate 10M
1254        filter pvc0 cmu_other   0 0 128.2.0.0   netmask 0xffff0000 0 0
1255class hfsc pvc0 cmu_cs    cmu  pshare 20 grate  5M
1256        filter pvc0 cmu_cs      0 0 128.2.242.0 netmask 0xffffff00 0 0
1257#
1258# PITT     bandwidth share    guaranteed rate
1259#    CS:        20%             10Mbps
1260#    other:     20%              5Mbps
1261#
1262class hfsc pvc0 pitt_other pitt  pshare 20 grate 10M
1263        filter pvc0 pitt_other  0 0 136.142.0.0  netmask 0xffff0000 0 0
1264class hfsc pvc0 pitt_cs    pitt  pshare 20 grate  5M
1265        filter pvc0 pitt_cs     0 0 136.142.79.0 netmask 0xffffff00 0 0
1266.Ed
1267.Ss HFSC Example (simpler one with ulimit)
1268.Bd -literal
1269#
1270interface fxp0 bandwidth 90M hfsc
1271# reserve 20% for default class
1272class hfsc fxp0 def_class root pshare 20 default
1273# shared class for TCP and UDP
1274class hfsc fxp0 shared_class root bandwidth 72M
1275# shared class for all TCP
1276class hfsc fxp0 tcp_shared shared_class bandwidth 40M ulimit 60M
1277# generic tcp
1278class hfsc fxp0 tcp_class tcp_shared bandwidth 15M ulimit 50M
1279	filter fxp0 tcp_class 0 0 0 0 6
1280# http
1281class hfsc fxp0 http_class tcp_shared bandwidth 25M ulimit 40M
1282	filter fxp0 http_class 0 80 0 0 6
1283	filter fxp0 http_class 0 0 0 80 6
1284# udp
1285class hfsc fxp0 udp_class shared_class bandwidth 15M ulimit 20M
1286	filter fxp0 udp_class 0 0 0 0 17
1287.Ed
1288.Ss PRIQ Example
1289.Bd -literal
1290#
1291# priq configuration for fxp0 (100Mbps ether)
1292#     icmp: high priority
1293#     tcp:  medium priority
1294#     others: low priority
1295#
1296interface fxp0 bandwidth 100M priq
1297#
1298class priq fxp0 high_class NULL priority 2
1299        filter fxp0 high_class 0 0 0 0 1
1300class priq fxp0 med_class NULL priority 1
1301        filter fxp0 med_class 0 0 0 0 6
1302class priq fxp0 low_class NULL priority 0 default
1303.Ed
1304.Ss WFQ Example
1305.Bd -literal
1306interface pvc0 bandwidth 134000000 wfq
1307.Ed
1308.Ss FIFOQ Example
1309.Bd -literal
1310interface rl0 bandwidth 10M fifoq
1311.Ed
1312.Ss Conditioner Example
1313.Bd -literal
1314#
1315interface fxp0
1316#
1317# a simple dropper
1318# discard all packets from 192.168.0.83
1319#
1320conditioner fxp0 dropper <drop>
1321        filter fxp0 dropper 0 0 192.168.0.83 0 0
1322
1323#
1324# EF conditioner
1325# mark EF to all packets from 192.168.0.117
1326#
1327conditioner pvc1 ef_cdnr <tbmeter 6M 64K <mark 0xb8><drop>>
1328        filter fxp0 ef_cdnr 0 0 192.168.0.117 0 0
1329
1330#
1331# AF1x conditioner
1332# mark AF1x to packets from 192.168.0.178
1333#       AF11 (low drop precedence):    less than 3Mbps
1334#       AF12 (medium drop precedence): more than 3Mbps and less than 10Mbps
1335#       AF13 (high drop precedence):   more than 10Mbps
1336#
1337conditioner fxp0 af1x_cdnr <trtcm 3M 32K 10M 64K <mark 0x28><mark 0x30><mark 0x38>>
1338        filter fxp0 af1x_cdnr 0 0 192.168.0.178 0 0
1339.Ed
1340.Sh SEE ALSO
1341.Xr altqd 8
1342.Sh BUGS
1343This man page is incomplete.
1344For more information read the source.
1345