| ALTQ.CONF(5) | File Formats Manual | ALTQ.CONF(5) | 
altq.conf —
altq.conf file contains a number of lines specifying
  the behavior of queueing disciplines. Comments start with a # and extend to
  the end of the line.
The altqd(8) program reads /etc/altq.conf at startup and sets up queueing disciplines. BLUE, CBQ (Class-Based Queueing), FIFOQ (First-In First-Out Queue), HFSC (Hierarchical Fair Service Curve), PRIQ (Priority Queueing), RED (Random Early Detection), RIO (RED with IN/OUT), WFQ (Weighted Fair Queueing), JoBS (Joint Buffer Management and Scheduling) and CDNR (Diffserv Traffic Conditioner) can be configured in this file.
interfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [discipline-specific-options]The interface command specifies a network
    interface to be under control of ALTQ. One interface specification is
    provided for each network interface under control of ALTQ. A system
    configured as a router may have multiple interface specifications.
bandwidthtbrsizetbrsize is omitted, the system automatically sets
      the bucket size using heuristics. The token rate is set to the interface
      bandwidth specified by the interface command.blue, cbq,
      fifoq, hfsc,
      jobs, priq,
      red, rio, or
      wfq. If the interface has only traffic
      conditioners and no queueing discipline, sched_type
      can be omitted.classred|rio] [ecn]
      [cleardscp]
      [discipline-specific-options]The class command specifies a packet
    scheduling class for CBQ, HFSC, JoBS or PRIQ. A class specifier must be
    provided for each packet scheduling class.
NULL for PRIQ
      and JoBS classes.redrioecncleardscpfiltername fltr_name]
      [ruleno num]
      filter_valuesThe filter command specifies a filter to
    classify packets into a scheduling class. A filter specifier determines any
    statically-defined packet classification rules.
namerulenofilter_values should be in the following format:
netmask
      mask] dport
      src_addr [netmask
      mask] sport
      proto [tos
      value [tosmask
      value]] [gpi
      value]Here dst_addr and
    src_addr are dotted-decimal addresses of the
    destination and the source respectively. An address may be followed by
    netmask keyword. dport and
    sport are port numbers of the destination and the
    source respectively. proto is a protocol number
    defined for IP packets (e.g. 6 for TCP). tos keyword
    can be used to specify the type of service field value.
    gpi keyword can be used to specify the Security
    Parameter Index value for IPsec.
When filter value 0 is used, it is taken as a wildcard.
filter6name fltr_name]
      [ruleno num]
      filter6_valuesThe filter6 command is for IPv6.
    filter6_value should be in the following format:
flowlabel
      value] [tclass
      value [tclassmask
      value]] [gpi
      value]Here dst_addr and
    src_addr are IPv6 addresses of the destination and
    the source respectively. An address may be followed by an optional address
    prefix length. dport and sport
    are port numbers of the destination and the source respectively.
    proto is a protocol number defined for IPv6 packets
    (e.g. 6 for TCP). flowlabel keyword can be used to
    specify the flowlabel field value. tclass keyword
    can be used to specify the traffic class field value.
    gpi keyword can be used to specify the Security
    Parameter Index value for IPsec.
When filter value 0 is used, it is taken as a wildcard.
interfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [efficient] [no-control]
      [no-tbr]bandwidthtbrsizecbq,
      cbq-wrr (weighted-round robin) or
      cbq-prr (packet-by-packet round robin).
      cbq is equivalent to
      cbq-wrr.efficientefficient to the interface specification line,
      enables this mode.no-controlno-tbrclassadmission cntlload|none]
      [priority pri]
      [pbandwidth percent]
      [exactbandwidth bps]
      [borrow] [default]
      [control] [maxburst
      count] [minburst
      count]
      [maxdelay msec]
      [packetsize bytes]
      [maxpacketsize bytes]
      [red|rio] [ecn]
      [flowvalve]
    [cleardscp]The class command specifies a CBQ class.
    The classes are organized as a hierarchy, and every class, except for the
    root class, has a parent.
cbq for a CBQ class.ctl_class is a
      reserved class name.parent_nameNULL if this is the root class. Parent class must
      have been previously defined.admissioncntlload is controlled load service for RSVP,
      otherwise, it should be none. The default is
      none.prioritypbandwidthexactbandwidthpbandwidth. Note that the bandwidth allocation of
      CBQ is not so precise but this is just a way to pass a parameter to CBQ;
      the user is supposed to know the detailed internals of CBQ.
      pbandwidth is a preferred way to specify the
      bandwidth of a class.borrowdefaultcontrolmaxburstminburstmaxdelaypacketsizemaxpacketsizeredrioecnflowvalvecleardscpinterfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]classadmission cntlload|none]
      [[sc m1 d m2]]
      [[rt m1 d m2]]
      [[ls m1 d m2]]
      [[ul m1 d m2]]
      [pshare percent]
      [grate bps]
      [bandwidth bps]
      [ulimit bps]
      [default] [qlimit
      count] [red|rio]
      [ecn] [cleardscp]The class command specifies a HFSC class.
    The classes are organized as a hierarchy, and every class, except for the
    root class, has a parent.
Each HFSC class has 2 service curves, the real-time service curve
    and the link-sharing service curve. Service curves are specified by
    [type m1 d m2].
    type should be either sc,
    rt, ls, or
    ul. sc (service curve) is
    used to set the same values to both real-time and link-sharing service
    curves. rt (real-time) is used to specify the
    real-time service curve. ls (link-sharing) is used
    to specify the link-sharing service curve. ul
    (upper-limit) is used to specify the upper-limit service curve for
    link-sharing. m1 is the slope of the first segment
    specified in bits-per-second. d is the x-projection of
    the intersection point of the 2 segments specified in milliseconds.
    m2 is the slope of the second segment specified in
    bits-per-second.
hfsc for a HFSC class.root is a reserved
      class name for the root class. The root class for the interface is
      automatically created by the interface
    command.root is used when the parent is the root class.
      Parent class must have been previously defined.admissioncntlload is controlled load service for RSVP,
      otherwise, it should be none. The default is
      none.pshare[ls 0 0 (link-bandwidth * percent / 100)].grate[rt 0 0 bps].bandwidth[sc 0 0 bps].ulimit[ul 0 0 bps].defaultqlimitredrioecncleardscpinterfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]classpriority pri]
      [default] [qlimit
      count] [red|rio]
      [ecn] [cleardscp]priq for a PRIQ class.NULL for PRIQ.prioritydefaultqlimitredrioecncleardscpinterfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [nqueues count]
      [qsize bytes]
      [hash policy]if_namebandwidthtbrsizewfq for WFQ.nqueuesqsizehashdstaddr
      specifies a hashing policy by IP destination address.
      full specifies a hashing policy by IP addresses
      and ports. srcport specifies a hashing policy by
      IP source port number. srcaddr specifies a hashing
      policy by IP source address. Default is
    dstaddrinterfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [qlimit count]bandwidthtbrsizefifoq for FIFOQ.qlimitredThe red command sets the default RED
    parameters. min_th and max_th
    are the minimum and the maximum threshold values.
    inv_pmax is the inverse (reciprocal) of the maximum
    drop probability. For example, 10 means the maximum drop probability of
    1/10.
interfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [qlimit count]
      [packetsize bytes]
      [weight n]
      [thmin n]
      [thmax n]
      [invpmax n]
      [ecn] [flowvalve]bandwidthtbrsizered for RED.qlimitpacketsizeweightthminthmaxinvpmaxecnflowvalveThe original RIO has 2 sets of RED parameters; one for in-profile packets and the other for out-of-profile packets. At the ingress of the network, profile meters tag packets as IN or OUT based on contracted profiles for customers. Inside the network, IN packets receive preferential treatment by the RIO dropper. It is possible to provision the network not to drop IN packets at all by providing enough capacity for the total volume of IN packets. Thus, RIO can be used to provide a service that statistically assures capacity allocated for users. This mechanism can be extended to support an arbitrary number of drop precedence levels. ALTQ supports 3 drop precedence levels.
rioThe rio command sets the default RIO
    parameters. The parameters are RED parameters for 3 (low, medium, high) drop
    precedence.
interfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [qlimit count]
      [packetsize bytes]
      [weight n]
      [lo_thmin n]
      [lo_thmax n]
      [lo_invpmax n]
      [med_thmin n]
      [med_thmax n]
      [med_invpmax n]
      [hi_thmin n]
      [hi_thmax n]
      [hi_invpmax n]
      [ecn]bandwidthtbrsizerio for RIO.qlimitpacketsizeweightlo_thminlo_thmaxlo_invpmaxmed_thminmed_thmaxmed_invpmaxhi_thminhi_thmaxhi_invpmaxecninterfacebandwidth
      bps] [tbrsize
      bytes] [sched_type]
      [qlimit count]
      [packetsize bytes]
      [maxpmark n]
      [holdtime usec]
      [ecn]bandwidthtbrsizeblue for BLUE.qlimitpacketsizemaxpmarkholdtimeecnconditioner command specifies a diffserv traffic
  conditioner. A traffic conditioner is not a queueing discipline but a
  component to meter, mark or drop incoming packets according to some rules.
As opposed to a queueing discipline, a traffic conditioner handles incoming packets at an input interface. If no queueing discipline (e.g., CBQ) is used for the interface, a null interface command should be used to specify an input network interface.
interfacebandwidth
      bps] [tbrsize
      bytes]The conditioner command has the following
    syntax.
conditionerAn action can be a recursively defined action. The following actions are defined.
tbmetertbmetertrtcmcoloraware|colorblind]
    trtcmtswtcmtswtcminterfacebandwidth
      bps] [qlimit
      count] [separate]
      [tbrsize bytes]
      [sched_type]bandwidthqlimitseparatetbrsizejobs for JoBS.classpriority pri]
      [default] [adc
      microsecs] [alc
      fraction] [arc
      bps] [rdc
      prop] [rlc
      prop]jobs for a JoBS class.NULL for JoBS.prioritydefaultadcalcarcrdcrlc
#
# cbq configuration for vx0 (10Mbps ether)
# give at least 40% to TCP
# limit HTTP from network 133.138.1.0 up to 10%, use RED.
# other traffic goes into default class
#
interface vx0 bandwidth 10M cbq
#
class cbq vx0 root_class NULL priority 0 pbandwidth 100
class cbq vx0 def_class root_class borrow pbandwidth 95 default
class cbq vx0 tcp_class def_class borrow pbandwidth  40
        filter vx0 tcp_class 0 0 0 0 6
class cbq vx0 csl_class tcp_class pbandwidth  10   red
        filter vx0 csl_class 0 0 133.138.1.0 netmask 0xffffff00 80 6
        filter vx0 csl_class 133.138.1.0 netmask 0xffffff00 0 0 80 6
#
# sample filter6 command
#
                filter6 vx0 csl_class ::0 0 2001:db8:0:123::/64 80 6
#
# hfsc configuration for hierarchical sharing
#
interface pvc0 bandwidth 45M hfsc
#
# (10% of the bandwidth share goes to the default class)
class hfsc pvc0 def_class root pshare 10 default
#
#          bandwidth share    guaranteed rate
#    CMU:       45%             15Mbps
#    PITT:      45%             15Mbps
#
class hfsc pvc0 cmu  root pshare 45 grate 15M
class hfsc pvc0 pitt root pshare 45 grate 15M
#
# CMU      bandwidth share    guaranteed rate
#    CS:        20%             10Mbps
#    other:     20%              5Mbps
#
class hfsc pvc0 cmu_other cmu  pshare 20 grate 10M
        filter pvc0 cmu_other   0 0 128.2.0.0   netmask 0xffff0000 0 0
class hfsc pvc0 cmu_cs    cmu  pshare 20 grate  5M
        filter pvc0 cmu_cs      0 0 128.2.242.0 netmask 0xffffff00 0 0
#
# PITT     bandwidth share    guaranteed rate
#    CS:        20%             10Mbps
#    other:     20%              5Mbps
#
class hfsc pvc0 pitt_other pitt  pshare 20 grate 10M
        filter pvc0 pitt_other  0 0 136.142.0.0  netmask 0xffff0000 0 0
class hfsc pvc0 pitt_cs    pitt  pshare 20 grate  5M
        filter pvc0 pitt_cs     0 0 136.142.79.0 netmask 0xffffff00 0 0
# interface fxp0 bandwidth 90M hfsc # reserve 20% for default class class hfsc fxp0 def_class root pshare 20 default # shared class for TCP and UDP class hfsc fxp0 shared_class root bandwidth 72M # shared class for all TCP class hfsc fxp0 tcp_shared shared_class bandwidth 40M ulimit 60M # generic tcp class hfsc fxp0 tcp_class tcp_shared bandwidth 15M ulimit 50M filter fxp0 tcp_class 0 0 0 0 6 # http class hfsc fxp0 http_class tcp_shared bandwidth 25M ulimit 40M filter fxp0 http_class 0 80 0 0 6 filter fxp0 http_class 0 0 0 80 6 # udp class hfsc fxp0 udp_class shared_class bandwidth 15M ulimit 20M filter fxp0 udp_class 0 0 0 0 17
#
# priq configuration for fxp0 (100Mbps ether)
#     icmp: high priority
#     tcp:  medium priority
#     others: low priority
#
interface fxp0 bandwidth 100M priq
#
class priq fxp0 high_class NULL priority 2
        filter fxp0 high_class 0 0 0 0 1
class priq fxp0 med_class NULL priority 1
        filter fxp0 med_class 0 0 0 0 6
class priq fxp0 low_class NULL priority 0 default
interface pvc0 bandwidth 134000000 wfq
interface rl0 bandwidth 10M fifoq
#
interface fxp0
#
# a simple dropper
# discard all packets from 192.168.0.83
#
conditioner fxp0 dropper <drop>
        filter fxp0 dropper 0 0 192.168.0.83 0 0
#
# EF conditioner
# mark EF to all packets from 192.168.0.117
#
conditioner pvc1 ef_cdnr <tbmeter 6M 64K <mark 0xb8><drop>>
        filter fxp0 ef_cdnr 0 0 192.168.0.117 0 0
#
# AF1x conditioner
# mark AF1x to packets from 192.168.0.178
#       AF11 (low drop precedence):    less than 3Mbps
#       AF12 (medium drop precedence): more than 3Mbps and less than 10Mbps
#       AF13 (high drop precedence):   more than 10Mbps
#
conditioner fxp0 af1x_cdnr <trtcm 3M 32K 10M 64K <mark 0x28><mark 0x30><mark 0x38>>
        filter fxp0 af1x_cdnr 0 0 192.168.0.178 0 0
| July 14, 2021 | NetBSD 10.0 |