配置 ROS QOS 优化宽带资源

date
Dec 28, 2021
slug
ros-qos-configure
status
Published
tags
ros
firewall
qos
summary
type
Post
Finish Date
Types
development
优化家庭宽带 QOS 策略
限制上下行的最大带宽,保障基础带宽
PCQ
设置流量优先级
优先转发 ping dns 1 icmp udp 53
优先网页浏览下载 website 2 tcp 53 80 443 8080 1443
优先转发 小包 package 0 - 512
 
mark in firewall
notion image
notion image

firewall rule

/ip firewall filter
add action=accept chain=forward connection-state=established,related
add action=drop chain=forward connection-state=invalid
/ip firewall mangle
add action=mark-packet chain=prerouting comment="All download" in-interface=\
    pppoe-out1 new-packet-mark=download passthrough=yes
add action=mark-packet chain=prerouting comment="All upload" in-interface=lan \
    new-packet-mark=upload passthrough=yes
add action=mark-packet chain=forward comment=Ping new-packet-mark=ping \
    passthrough=yes protocol=icmp
add action=mark-packet chain=forward comment=DNS dst-port="" new-packet-mark=\
    dns passthrough=yes port=53 protocol=udp
add action=mark-packet chain=forward comment="Web browser download" dst-port=\
    "" new-packet-mark=website-download passthrough=yes port="" protocol=tcp \
    src-port=53,80,443,1443,8080
add action=mark-packet chain=forward comment="Web browser upload" dst-port=\
    80,443,1443,8080 new-packet-mark=website-upload passthrough=yes port="" \
    protocol=tcp src-port=""
add action=mark-packet chain=forward comment="Small Package" new-packet-mark=\
    small-package packet-size=0-512 passthrough=yes
 

queue tree

/queue tree
add name=bandwidth parent=global
add name=ensure parent=global priority=7
add name=website packet-mark=website-download parent=ensure priority=3
add name=dns packet-mark=dns parent=ensure priority=1
add name=ping packet-mark=ping parent=ensure priority=1
add name=small-package packet-mark=small-package parent=ensure priority=2
/queue type
add kind=pcq name=pcq-download pcq-classifier=dst-address pcq-rate=970M
add kind=pcq name=pcq-upload pcq-classifier=src-address pcq-rate=100M
/queue tree
add limit-at=100M max-limit=110M name=upload packet-mark=\
    upload,website-upload parent=bandwidth queue=pcq-upload
add limit-at=940M max-limit=970M name=download packet-mark=download parent=\
    bandwidth queue=pcq-download

© wtser 2021 - 2022