> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man4/altq.4.md).

# altq.4

`ALTQ` — 网络数据包的交替排队

## 名称

`ALTQ`

## 概要

`options ALTQ`

`options ALTQ_CBQ options ALTQ_CODEL options ALTQ_RED options ALTQ_RIO options ALTQ_HFSC options ALTQ_CDNR options ALTQ_PRIQ options ALTQ_FAIRQ`

## 描述

`ALTQ` 系统是一个框架，提供多种排队规则用于对发出的网络数据包进行排队。这是通过对接口数据包队列的修改来实现的。详见 [altq(9)](/man/man9/altq.9.md)。

`ALTQ` 的用户界面由 pfctl(8) 工具实现，因此关于 `ALTQ` 能力的完整描述及使用方法，请参阅 pfctl(8) 和 [pf.conf(5)](/man/man5/pf.conf.5.md) 手册页。

### 内核选项

内核配置文件中与 `ALTQ` 操作相关的选项如下：

**`ALTQ`** 启用 `ALTQ`。 **`ALTQ_CBQ`** 构建“基于类的排队”（Class Based Queuing）规则。 **`ALTQ_CODEL`** 构建“受控延迟”（Controlled Delay）规则。 **`ALTQ_RED`** 构建“随机早期检测”（Random Early Detection）扩展。 **`ALTQ_RIO`** 为输入和输出构建“随机早期丢弃”（Random Early Drop）。 **`ALTQ_HFSC`** 构建“分层包调度器”（Hierarchical Packet Scheduler）规则。 **`ALTQ_CDNR`** 构建流量调节器。此选项目前无意义，因为该调节器未被任何可用的规则或使用者使用。 **`ALTQ_PRIQ`** 构建“优先级排队”（Priority Queuing）规则。 **`ALTQ_FAIRQ`** 构建“公平排队”（Fair Queuing）规则。 **`ALTQ_NOPCC`** 当 TSC 不可用时必需。 **`ALTQ_DEBUG`** 启用额外的调试功能。

注意，`ALTQ` 规则不能作为内核模块加载。要使用某种规则，必须将其构建进自定义内核。`ALTQ` 配置过程所必需的 [pf(4)](/man/man4/pf.4.md) 接口可以作为模块加载。

## 支持的设备

要将某块网卡与 `ALTQ` 配合使用，需要 [altq(9)](/man/man9/altq.9.md) 中描述的驱动修改。这些修改已应用于以下硬件驱动：[ae(4)](/man/man4/ae.4.md), [age(4)](/man/man4/age.4.md), [alc(4)](/man/man4/alc.4.md), [ale(4)](/man/man4/ale.4.md), [aue(4)](/man/man4/aue.4.md), [axe(4)](/man/man4/axe.4.md), [bce(4)](/man/man4/bce.4.md), [bfe(4)](/man/man4/bfe.4.md), [bge(4)](/man/man4/bge.4.md), [bxe(4)](/man/man4/bxe.4.md), [cas(4)](/man/man4/cas.4.md), [dc(4)](/man/man4/dc.4.md), [em(4)](/man/man4/em.4.md), [epair(4)](/man/man4/epair.4.md), [et(4)](/man/man4/et.4.md), [fxp(4)](/man/man4/fxp.4.md), [gem(4)](/man/man4/gem.4.md), igb(4), [ix(4)](/man/man4/ix.4.md), [jme(4)](/man/man4/jme.4.md), le(4), [liquidio(4)](/man/man4/liquidio.4.md), [msk(4)](/man/man4/msk.4.md), [mxge(4)](/man/man4/mxge.4.md), [my(4)](/man/man4/my.4.md), [nfe(4)](/man/man4/nfe.4.md), [nge(4)](/man/man4/nge.4.md), [qlxgb(4)](/man/man4/qlxgb.4.md), [re(4)](/man/man4/re.4.md), [rl(4)](/man/man4/rl.4.md), [sge(4)](/man/man4/sge.4.md), [sis(4)](/man/man4/sis.4.md), [sk(4)](/man/man4/sk.4.md), [ste(4)](/man/man4/ste.4.md), [stge(4)](/man/man4/stge.4.md), [ti(4)](/man/man4/ti.4.md), [udav(4)](/man/man4/udav.4.md), [vge(4)](/man/man4/vge.4.md), [vr(4)](/man/man4/vr.4.md), [vte(4)](/man/man4/vte.4.md), 和 [xl(4)](/man/man4/xl.4.md)。

[tun(4)](/man/man4/tun.4.md), if\_bridge(4), if\_vlan(4), 和 [ng\_iface(4)](/man/man4/ng_iface.4.md) 伪驱动也支持 `ALTQ`。

示例：

```sh
altq on igb0 cbq queue { def aq }
queue def bandwidth 90% cbq (default borrow)
queue aq bandwidth 10Mb cbq
pass in on igb0.10 proto udp all queue aq keep state
```

## 参见

[pf(4)](/man/man4/pf.4.md), [pf.conf(5)](/man/man5/pf.conf.5.md), [ipfw(8)](/man/man8/ipfw.8.md), pfctl(8), [altq(9)](/man/man9/altq.9.md)

## 历史

`ALTQ` 系统首次出现于 1997 年 3 月，并成为 KAME 项目（<https://www.kame.net）的一部分。它在> FreeBSD 5.3 中被引入。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man4/altq.4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
