Vyos流量限速
Qos简单限速
出方向配置策略
Note: 出方向策略只能配置shaper,否则报错:QoS policy eth0-out is type shaper and is only valid for out.
# 为匹配的所有流量设置最大限速带宽
set traffic-policy shaper eth0-out bandwidth '10Mbit'
# default默认流量包含任何不匹配任何已定义类的流量
# 为默认流量设置保证流量
set traffic-policy shaper eth0-out default bandwidth '50%'
# 为默认流量设置最大速率,上限为最大限速带宽
# 如果只配保证流量而不配最大速率,限速以保证流量为准
set traffic-policy shaper eth0-out default ceiling '100%'
# 接口出方向应用策略
set interfaces ethernet eth0 traffic-policy out 'eth0-out'
入方向配置策略
Note: 入方向策略只能配置limiter,否则报错:QoS policy eth1-in is type limiter and is only valid for in.
# 设置限速带宽
set traffic-policy limiter eth1-in default bandwidth '10Mbit'
# 设置突发流量(不配突发流量会导致限速不合理)
set traffic-policy limiter eth1-in default burst '1280kb'
# 接口入方向应用策略
set interfaces ethernet eth1 traffic-policy in 'eth1-in'
流量整形针对IP限速
The Shaper policy does not guarantee a low delay, but it does guarantee bandwidth to different traffic classes and also lets you decide how to allocate more traffic once the guarantees are met.
Each class can have a guaranteed part of the total bandwidth defined for the whole policy, so all those shares together should not be higher than the policy’s whole bandwidth.
If guaranteed traffic for a class is met and there is room for more traffic, the ceiling parameter can be used to set how much more bandwidth could be used. If guaranteed traffic is met and there are several classes willing to use their ceilings, the priority parameter will establish the order in which that additional traffic will be allocated. Priority can be any number from 0 to 7. The lower the number, the higher the priority. [4]
案例1:当接口因流量过大拥堵时,优先发送优先级高的默认流量,随后发送优先级低的目的IP为192.168.1.0/24的流量
# 为匹配的所有流量设置最大限速带宽
set traffic-policy shaper eth0-out-ip bandwidth '10Mbit'
# 为匹配到目的IP为192.168.1.0/24、192.168.3.0/24的流量,设置保证流量为最大限速带宽的90%,流量上限为100%,设置优先级为7
set traffic-policy shaper eth0-out-ip class 10 bandwidth '90%'
set traffic-policy shaper eth0-out-ip class 10 ceiling '100%'
set traffic-policy shaper eth0-out-ip class 10 match Class-IP1 ip destination address '192.168.1.0/24'
set traffic-policy shaper eth0-out-ip class 10 match Class-IP2 ip destination address '192.168.3.0/24'
set traffic-policy shaper eth0-out-ip class 10 priority '7'
# 为默认流量设置保证流量为最大限速带宽的10%,流量上限为100%,默认优先级为0
set traffic-policy shaper eth0-out-ip default bandwidth '10%'
set traffic-policy shaper eth0-out-ip default ceiling '100%'
set interfaces ethernet eth0 traffic-policy out 'eth0-out-ip'

浙公网安备 33010602011771号