配置HQoS示例(基于ACL配置用户队列)

简介: 网络中有多个用户,每个用户都有语音,视频和数据三种不同的业务,其携带的802.1p优先级分别为6、5、2。现在需要优先保证语音业务的带宽,其次是视频业务,最后是数据业务。配置需求如表1和表2所述。由于带宽有限,除了需要区分不同业务的优先级之外还需要针对不同的用户进行流量整形,为多个用户提供不同的带宽,配置需求如表3所述。


配置HQoS示例(基于ACL配置用户队列)

组网图形

图1 配置HQoS组网图


表1 流队列拥塞避免配置参数

业务类型

颜色

阈值下限(%)

阈值上限(%)

丢弃概率

语音

绿

80

100

10

视频

黄

60

80

20

数据

红

40

60

40

表2 流队列拥塞管理配置参数

业务类型

服务等级

语音

EF

视频

AF3

数据

AF1

表3 用户队列流量整形配置参数

用户

峰值带宽

属于VLAN10的用户

8000kbit/s

属于VLAN20的用户

5000kbit/s

^^^


  • 组网需求
  • 配置思路
  • 操作步骤
  • 配置文件
  • 相关信息

组网需求

网络中有多个用户,每个用户都有语音,视频和数据三种不同的业务,其携带的802.1p优先级分别为6、5、2。现在需要优先保证语音业务的带宽,其次是视频业务,最后是数据业务。配置需求如表1和表2所述。

由于带宽有限,除了需要区分不同业务的优先级之外还需要针对不同的用户进行流量整形,为多个用户提供不同的带宽,配置需求如表3所述。

配置思路

采用如下的思路配置HQoS:

  1. 创建VLAN,并配置各接口,使用户能够通过Switch访问网络。
  2. 在Switch上配置创建并配置DiffServ域,将802.1p优先级映射为PHB行为并为报文着色,并在Switch入接口上绑定DiffServ域。
  3. 在Switch上配置流队列WRED模板和流队列模板及相关参数,以实现为不同的业务提供不同的调度优先级,丢弃参数及流量整形参数。
  4. 在Switch上配置ACL规则,通过VLAN区分来自不同用户的数据流量。
  5. 在Switch上配置用户队列及流量整形参数,通过引用流队列WRED模板和流队列模板实现HQoS。

操作步骤

  1. 创建VLAN并配置各接口# 在SwitchA上创建VLAN10,配置SwitchA上接口GE0/0/1、GE0/0/2的接口类型为Access,并加入VLAN10,配置接口GE0/0/3的接口类型为Trunk,并加入VLAN10。

<HUAWEI> system-view

[HUAWEI] sysname SwitchA

[SwitchA] vlan batch 10

[SwitchA] interface gigabitethernet 0/0/1

[SwitchA-GigabitEthernet0/0/1] port link-type access

[SwitchA-GigabitEthernet0/0/1] port default vlan 10

[SwitchA-GigabitEthernet0/0/1] quit

[SwitchA] interface gigabitethernet 0/0/2

[SwitchA-GigabitEthernet0/0/2] port link-type access

[SwitchA-GigabitEthernet0/0/2] port default vlan 10

[SwitchA-GigabitEthernet0/0/2] quit

[SwitchA] interface gigabitethernet 0/0/3

[SwitchA-GigabitEthernet0/0/3] port link-type trunk

[SwitchA-GigabitEthernet0/0/3] port trunk allow-pass vlan 10

[SwitchA-GigabitEthernet0/0/3] quit

  1. # 在SwitchB上创建VLAN20,配置SwitchB上接口GE0/0/1、GE0/0/2的接口类型为Access,并加入VLAN20,配置接口GE0/0/3的接口类型为Trunk,并加入VLAN20。

<HUAWEI> system-view

[HUAWEI] sysname SwitchB

[SwitchB] vlan batch 20

[SwitchB] interface gigabitethernet 0/0/1

[SwitchB-GigabitEthernet0/0/1] port link-type access

[SwitchB-GigabitEthernet0/0/1] port default vlan 20

[SwitchB-GigabitEthernet0/0/1] quit

[SwitchB] interface gigabitethernet 0/0/2

[SwitchB-GigabitEthernet0/0/2] port link-type access

[SwitchB-GigabitEthernet0/0/2] port default vlan 20

[SwitchB-GigabitEthernet0/0/2] quit

[SwitchB] interface gigabitethernet 0/0/3

[SwitchB-GigabitEthernet0/0/3] port link-type trunk

[SwitchB-GigabitEthernet0/0/3] port trunk allow-pass vlan 20

[SwitchB-GigabitEthernet0/0/3] quit

  1. # 在SwitchC上创建VLAN10和VLAN20,配置SwitchC上接口GE0/0/1的接口类型为Trunk,并加入VLAN10和VLAN20,配置接口GE0/0/2的接口类型为Trunk,并加入VLAN10和VLAN20。

<HUAWEI> system-view

[HUAWEI] sysname SwitchC

[SwitchC] vlan batch 10 20

[SwitchC] interface gigabitethernet 0/0/1

[SwitchC-GigabitEthernet0/0/1] port link-type trunk

[SwitchC-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20

[SwitchC-GigabitEthernet0/0/1] quit

[SwitchC] interface gigabitethernet 0/0/2

[SwitchC-GigabitEthernet0/0/2] port link-type trunk

[SwitchC-GigabitEthernet0/0/2] port trunk allow-pass vlan 10 20

[SwitchC-GigabitEthernet0/0/2] quit

  1. # 在Switch上创建VLAN10和VLAN20,将接口GE0/0/1、GE0/0/2和GE0/0/3的接入类型分别配置为trunk,并分别将接口GE0/0/1加入VLAN10,GE0/0/2加入VLAN20,GE0/0/3加入VLAN 10、VLAN 20。

<HUAWEI> system-view

[HUAWEI] sysname Switch

[Switch] vlan batch 10 20

[Switch] interface gigabitethernet 0/0/1

[Switch-GigabitEthernet0/0/1] port link-type trunk

[Switch-GigabitEthernet0/0/1] port trunk allow-pass vlan 10

[Switch-GigabitEthernet0/0/1] quit

[Switch] interface gigabitethernet 0/0/2

[Switch-GigabitEthernet0/0/2] port link-type trunk

[Switch-GigabitEthernet0/0/2] port trunk allow-pass vlan 20

[Switch-GigabitEthernet0/0/2] quit

[Switch] interface gigabitethernet 0/0/3

[Switch-GigabitEthernet0/0/3] port link-type trunk

[Switch-GigabitEthernet0/0/3] port trunk allow-pass vlan 10 20

[Switch-GigabitEthernet0/0/3] quit

  1. 配置优先级映射# 创建DiffServ域ds1,将802.1p优先级6、5、2分别映射为服务等级EF、AF3、AF1,并分别将报文标记为绿色,黄色和红色。

[Switch] diffserv domain ds1

[Switch-dsdomain-ds1] 8021p-inbound 6 phb ef green

[Switch-dsdomain-ds1] 8021p-inbound 5 phb af3 yellow

[Switch-dsdomain-ds1] 8021p-inbound 2 phb af1 red

[Switch-dsdomain-ds1] quit

  1. # 在Switch入接口GE0/0/1和GE0/0/2上绑定DiffServ域。

[Switch] interface gigabitethernet 0/0/1

[Switch-GigabitEthernet0/0/1] trust upstream ds1

[Switch-GigabitEthernet0/0/1] trust 8021p inner

[Switch-GigabitEthernet0/0/1] quit

[Switch] interface gigabitethernet 0/0/2

[Switch-GigabitEthernet0/0/2] trust upstream ds1

[Switch-GigabitEthernet0/0/2] trust 8021p inner

[Switch-GigabitEthernet0/0/2] quit

  1. 配置流队列WRED模板及参数# 在Switch上配置流队列WRED模板wred1,并配置wred1的三色报文参数。

[Switch] flow-wred-profile wred1

[Switch-flow-wred-wred1] color green low-limit 80 high-limit 100 discard-percentage 10

[Switch-flow-wred-wred1] color yellow low-limit 60 high-limit 80 discard-percentage 20

[Switch-flow-wred-wred1] color red low-limit 40 high-limit 60 discard-percentage 40

[Switch-flow-wred-wred1] quit

  1. 配置流队列模板及参数# 在Switch上配置流队列模板flow1引用流队列WRED模板wred1,并配置各服务等级的调度参数。

[Switch] flow-queue-profile flow1

[Switch-flow-queue-flow1] qos queue 5 pq flow-wred-profile wred1

[Switch-flow-queue-flow1] qos queue 3 wfq weight 20 flow-wred-profile wred1

[Switch-flow-queue-flow1] qos queue 1 wfq weight 10 flow-wred-profile wred1

[Switch-flow-queue-flow1] quit

  1. 配置ACL规则# 在Switch上配置ACL4001和ACL4002,并分别配置匹配VLAN10和VLAN20的rule规则。

[Switch] acl number 4001

[Switch-acl-L2-4001] rule 1 permit vlan-id 10

[Switch-acl-L2-4001] quit

[Switch] acl number 4002

[Switch-acl-L2-4002] rule 1 permit vlan-id 20

[Switch-acl-L2-4002] quit

  1. 配置用户队列及参数# 在Switch上配置基于ACL4001和ACL4002的用户队列,并引用流队列模板flow1。

[Switch] interface gigabitethernet 0/0/3

[Switch-GigabitEthernet0/0/3] traffic-user-queue outbound acl 4001 pir 8000 flow-queue-profile flow1

[Switch-GigabitEthernet0/0/3] traffic-user-queue outbound acl 4002 pir 5000 flow-queue-profile flow1

[Switch-GigabitEthernet0/0/3] quit

[Switch] quit

  1. 验证配置结果# 查看流队列WRED模板的配置信息,包括流队列WRED模板名称以及红、黄、绿三色报文的丢弃上下限和最大丢弃概率。

<Switch> display flow-wred-profile name wred1

Flow-wred-profile[1]: wred1                                                    

Queue depth         : 1048576                                                  

Color     Low-limit   High-limit  Discard-percentage                            

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -              

Green     80          100         10                                            

Yellow    60          80          20                                            

Red       40          60          40                                            

-----------------------------------------------------------------

  1. # 查看流队列模板的配置信息,包括流队列模板名称以及WFQ调度的权重。

<Switch> display flow-queue-profile name flow1

Flow-queue-profile[1]: flow1                                                    

Queue Schedule(Weight) Shaping         flow-wred-profile                        

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -        

0     PQ               None            default                                  

1     WFQ(10)          None            wred1                                    

2     PQ               None            default                                  

3     WFQ(20)          None            wred1                                    

4     PQ               None            default                                  

5     PQ               None            wred1                                    

6     PQ               None            default                                  

7     PQ               None            default                                  

-----------------------------------------------------------------------

  1. # 查看用户队列的流量统计信息。

<Switch> display traffic-user-queue statistics interface gigabitethernet 0/0/3 outbound acl 4001

--------------------------------------------------------------------------------

Interface: GigabitEthernet0/0/3                                                

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        0         |          packets: pass:                       4,127                                                            

                  |                   drop:               2,798,787,076                                                            

                  |          bytes:   pass:                     610,796                                                            

                  |                   drop:             414,220,487,248                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        1         |          packets: pass:                       4,127                                                            

                  |                   drop:               5,597,436,717                                                            

                  |          bytes:   pass:                     610,796                                                            

                  |                   drop:             828,420,634,116                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        2         |          packets: pass:                           0                                                            

                  |                   drop:                           0                                                            

                  |          bytes:   pass:                           0                                                            

                  |                   drop:                           0                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        3         |          packets: pass:                       4,127                                                            

                  |                   drop:               5,597,436,713                                                            

                  |          bytes:   pass:                     610,796                                                            

                  |                   drop:             828,420,633,524                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        4         |          packets: pass:                       4,127                                                            

                  |                   drop:               2,798,716,293                                                            

                  |          bytes:   pass:                     610,796                                                            

                  |                   drop:             414,210,011,364                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        5         |          packets: pass:                       4,127                                                            

                  |                   drop:               2,798,716,294                                                            

                  |          bytes:   pass:                     610,796                                                            

                  |                   drop:             414,210,011,512                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        6         |          packets: pass:                           0                                                            

                  |                   drop:                           0                                                            

                  |          bytes:   pass:                           0                                                            

                  |                   drop:                           0                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        7         |          packets: pass:               1,119,509,460                                                            

                  |                   drop:               1,679,210,961                                                            

                  |          bytes:   pass:             165,687,400,080                                                            

                  |                   drop:             248,523,222,228                                                            

--------------------------------------------------------------------------------                                                    


<Switch> display traffic-user-queue statistics interface gigabitethernet 0/0/3 outbound acl 4002

--------------------------------------------------------------------------------

Interface: GigabitEthernet0/0/3                                                

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        0         |          packets: pass:                       4,125                                                            

                  |                   drop:                   5,218,026                                                            

                  |          bytes:   pass:                     610,500                                                            

                  |                   drop:                 772,267,848                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        1         |          packets: pass:                       4,125                                                            

                  |                   drop:                  10,440,178                                                            

                  |          bytes:   pass:                     610,500                                                            

                  |                   drop:               1,545,146,344                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        2         |          packets: pass:                           0                                                            

                  |                   drop:                           0                                                            

                  |          bytes:   pass:                           0                                                            

                  |                   drop:                           0                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        3         |          packets: pass:                       4,125                                                            

                  |                   drop:                  10,440,178                                                            

                  |          bytes:   pass:                     610,500                                                            

                  |                   drop:               1,545,146,344                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        4         |          packets: pass:                       4,125                                                            

                  |                   drop:                   5,218,027                                                            

                  |          bytes:   pass:                     610,500                                                            

                  |                   drop:                 772,267,996                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        5         |          packets: pass:                       4,125                                                            

                  |                   drop:                   5,218,027                                                            

                  |          bytes:   pass:                     610,500                                                            

                  |                   drop:                 772,267,996                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        6         |          packets: pass:                           0                                                            

                  |                   drop:                           0                                                            

                  |          bytes:   pass:                           0                                                            

                  |                   drop:                           0                                                            

--------------------------------------------------------------------------------                                                    

    Queue ID      |                   Statistics information                                                                      

--------------------------------------------------------------------------------                                                    

        7         |          packets: pass:                   2,092,988                                                            

                  |                   drop:                   3,129,165                                                            

                  |          bytes:   pass:                 309,762,224                                                            

                  |                   drop:                 463,116,420                                                            

--------------------------------------------------------------------------------

配置文件

  • SwitchA的配置文件

#

sysname SwitchA

#                                                                              

vlan batch 10                                                                  

#                                                                              

interface GigabitEthernet0/0/1                                                  

port link-type access                                                          

port default vlan 10                                                          

#                                                                              

interface GigabitEthernet0/0/2                                                  

port link-type access                                                          

port default vlan 10                                                          

#                                                                              

interface GigabitEthernet0/0/3                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 10                                                  

#                                                                                

return

  • SwitchB的配置文件

#

sysname SwitchB

#                                                                              

vlan batch 20                                                                  

#                                                                              

interface GigabitEthernet0/0/1                                                  

port link-type access                                                          

port default vlan 20                                                          

#                                                                              

interface GigabitEthernet0/0/2                                                  

port link-type access                                                          

port default vlan 20                                                          

#                                                                              

interface GigabitEthernet0/0/3                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 20                                                  

#                                                                              

return

  • SwitchC的配置文件

#

sysname SwitchC

#                                                                              

vlan batch 10 20                                                                  

#                                                                              

interface GigabitEthernet0/0/1                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 10 20                                              

#                                                                              

interface GigabitEthernet0/0/2                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 10 20                                              

#

return

  • Switch的配置文件

#

sysname Switch

#

vlan batch 10 20

#

diffserv domain ds1

8021p-inbound 2 phb af1 red

8021p-inbound 5 phb af3 yellow

8021p-inbound 6 phb ef green

#

acl number 4001  

rule 1 permit vlan-id 10

acl number 4002  

rule 1 permit vlan-id 20

#

flow-wred-profile wred1

color green low-limit 80 high-limit 100 discard-percentage 10

color yellow low-limit 60 high-limit 80 discard-percentage 20

color red low-limit 40 high-limit 60 discard-percentage 40

#

flow-queue-profile flow1

qos queue 1 wfq weight 10 flow-wred-profile wred1

qos queue 3 wfq weight 20 flow-wred-profile wred1

qos queue 5 flow-wred-profile wred1              

#

interface GigabitEthernet0/0/1                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 10                                                  

trust upstream ds1                                                            

trust 8021p inner                                                              

#

interface GigabitEthernet0/0/2                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 20                                                  

trust upstream ds1                                                            

trust 8021p inner                                                              

#                                                                              

interface GigabitEthernet0/0/3                                                  

port link-type trunk                                                          

port trunk allow-pass vlan 10 20                                              

traffic-user-queue outbound acl 4001 pir 8000 flow-queue-profile flow1

traffic-user-queue outbound acl 4002 pir 5000 flow-queue-profile flow1

#                                                                              

return


相关文章
|
Linux Shell Windows
Linux如何检查文件夹的大小?
在Linux中查看文件夹大小,可使用`du`(如`du -sh *`)、`df`(如`df -h /home`)查看磁盘使用情况,`ncdu`提供交互式浏览,`ls -lh`显示当前目录文件大小,`find`与`du`结合找大文件夹,`tree --du -h`展示目录结构及大小,或用`awk`与`du`组合按大小排序。不同场景下,这些命令各有优势。
1920 1
Linux如何检查文件夹的大小?
|
2月前
|
域名解析 人工智能 网络协议
cloudflared,不需要服务器和公网 IP 的免费内网穿透,一条命令上手
本文详解 Cloudflare 官方内网穿透工具 `cloudflared`:零配置快速开通公网 HTTPS 地址(如 `xxx.trycloudflare.com`),支持临时隧道(免账号)与正式隧道(绑定自定义域名)。对比 ngrok、frp,突出其免运维、自动证书、全球边缘网络等优势,涵盖安装、实操及常见场景(Webhook 联调、AI Agent 对接、真机预览等),助开发者高效解决本地服务对外访问难题。
3358 0
cloudflared,不需要服务器和公网 IP 的免费内网穿透,一条命令上手
|
12月前
|
人工智能 自然语言处理 数据可视化
2025年适合大型企业的BI产品及企业高效运用BI工具指南
本文将聚焦适合大型企业的BI产品选型,深入解析主流产品优势,并结合实践经验探讨企业如何用好BI工具,为各行业企业提供专业参考。
|
运维 安全 网络安全
等保测评全面解析
等保测评是依据国家信息安全等级保护制度,对信息系统安全保护状况进行检测评估的活动。其目标是确保信息系统在各阶段符合安全等级要求,保障系统保密性、完整性和可用性。测评涵盖技术与管理两方面:技术层面包括物理环境、网络通信、设备计算及应用数据安全;管理层面涉及制度、机构、人员及建设运维管理。测评流程分为准备、方案设计、现场测评和报告编制四个阶段。实践中需做好测评前准备、测评中配合以及测评后整改优化,以持续提升信息安全水平。
1958 0
|
网络协议 Ubuntu Linux
在Linux中, 如何配置网络接口?
在Linux中, 如何配置网络接口?
|
算法 搜索推荐 网络性能优化
|
机器学习/深度学习 自然语言处理
彻底改变语言模型:全新架构TTT超越Transformer,ML模型代替RNN隐藏状态
【7月更文挑战第25天】近年来,NLP领域取得显著进展但也面临挑战,如长上下文建模与计算效率的平衡。为此,研究人员提出Test-Time Training (TTT) 模型架构。TTT由多机构合作开发,旨在解决长上下文建模难题及提高计算效率。通过将隐藏状态视为可学习更新的模型,TTT能随输入增长提升表示能力;采用自监督学习更新规则确保线性计算复杂度的同时保持高性能。实验显示TTT在多种NLP任务中表现优秀,尤其在长上下文处理方面超越Transformer。尽管如此,TTT仍面临训练资源需求高及自监督学习鲁棒性等挑战。[论文](https://arxiv.org/abs/2407.04620)
1074 5
|
存储 关系型数据库 MySQL
深度评测:PolarDB-X 开源分布式数据库的优势与实践
本文对阿里云开源分布式数据库 PolarDB-X 进行了详细评测。PolarDB-X 以其高性能、强可用性和出色的扩展能力在云原生数据库市场中脱颖而出。文章首先介绍了 PolarDB-X 的核心产品优势,包括金融级高可靠性、海量数据处理能力和高效的混合负载处理能力。随后,分析了其分布式架构设计,包括计算节点、存储节点、元数据服务和日志节点的功能分工。评测还涵盖了在 Windows 平台通过 WSL 环境部署 PolarDB-X 的过程,强调了环境准备和工具安装的关键步骤。使用体验方面,PolarDB-X 在处理分布式事务和实时分析时表现稳定,但在网络问题和性能瓶颈上仍需优化。最后,提出了改进建
|
XML JSON API
⚡REST 和 SOAP 协议有什么区别?
这篇文章对比了 REST 和 SOAP 两种常见的 Web API 规范。REST 是一种 API 架构风格,遵循客户端-服务器、无状态和缓存等原则,使用 HTTP 协议和 JSON 格式,适合轻量级、高兼容性的场景。SOAP 是一种基于 XML 的网络服务访问协议,提供消息级安全性和 ACID 合规性,适用于企业级应用。REST 的优点包括前后端分离、浏览器兼容和带宽效率,而 SOAP 适用于需要高级安全特性的应用。除了 REST 和 SOAP,还有 gRPC 和 GraphQL 等其他选择。

热门文章

最新文章