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