【记录】OpenWrt配置QoS规则
Last updated on December 20, 2024 am
在宿舍环境下,QoS可以帮助优化带宽使用,确保关键应用(如视频通话、在线游戏等)获得足够的带宽支持,减少延迟和卡顿现象。其次,QoS还可以通过限制非关键应用的数据流,防止它们占用过多的带宽资源,从而保障其他重要服务的正常运行。此外,QoS还可以实现公平的带宽分配,避免单一用户过度占用资源,影响其他用户的网络体验。因此,尽管会损失硬件转发性能, OpenWrt 仍然是非常有必要开启 QoS 的。
更新 kernel
- 根据版本打开对应的包下载地址:ImmortalWrt 和 OpenWrt
- 找到对应的 kernel 更新包下载,比如
kernel_5.15.171-1-dae069da9eaf18cbc98c1b58b15dc5c9_aarch64_cortex-a53.ipk - OpenWrt 的
系统-软件包-操作-上传软件包上传更新包并安装
安装 QoS
- OpenWrt 的
系统-软件包-筛选器搜索并安装luci-app-qos和luci-app-statistics
关闭硬件加速
- OpenWrt 的
网络-防火墙-常用设置-路由/NAT 分载关闭软件流量分载和硬件流量分载 - OpenWrt 的
网络-接口-全局网络选项开启数据包引导 - OpenWrt 的
系统-重启执行重启
初步配置
- ssh 登录后台执行下面的命令
- 其中
85000和4000分别表示下行和上行带宽,一般写真实带宽的 85%
1 | |
wiki: Another biggie was the exact meaning of each type. Types are necessary for connection tracking. By default, Classify is not run on a connection that had already been assigned a traffic class, so it is the initial connection-tracked classification. Reclassify can override the traffic class per packet, without altering the connection tracking mark. Default is a fall-back for everything that has not been marked by Classify/Reclassify. Rules get processed by type first (Classify gets processed first, then Reclassify and finally Default) and then based on the order in the configuration file (top to bottom).
深入配置
- OpenWrt 的
状态-实时信息-连接里启用DNS查找后观察游戏所在的目标地址的特征 - OpenWrt 的
网络-QoS-分类规则里根据特征添加更细节的规则
观察配置
1 | |
附加 DSCP
- 手动给应用打上 DSCP 标记:Windows配置QoS
附加 Wireshark
- 下载 Wireshark
- 安装时勾选上插件里的
Sshdump - OpenWrt 的
系统-软件包-筛选器搜索并安装tcpdump(会同时捕获 udp) - 打开 Wireshark,选择
捕获—选项:

- 点击
SSH remote capture标签的前的图标,对远程抓包的参数进行配置

- 输入路由器的ip地址和ssh端口号

- 输入路由器用户名和密码

tcpdump设置,Remote capture filter写not (port 22)就好, 网卡写br-lan

- 选择
SSH remote capture,点击开始

- 捕获完成后点左上角的红色方块停止捕获
