08-H3C MSR系列路由器 流量统计典配举例
本章节下载 (347.32 KB)
H3C MSR系列路由器
流量统计典型配置举例
Copyright © 2022-2023 新华三技术有限公司 版权所有,保留一切权利。
非经本公司书面许可,任何单位和个人不得擅自摘抄、复制本文档内容的部分或全部,并不得以任何形式传播。
除新华三技术有限公司的商标外,本手册中出现的其它公司的商标、产品标识及商品名称,由各自权利人拥有。
本文档中的信息可能变动,恕不另行通知。
适用于8048、8062产品系列R6728版本。
· 在Router A和Router C之间使用LDP动态建立LSP,使11.1.1.0/24和21.1.1.0/24这两个网段中互访的报文通过MPLS进行标签转发。
· Router A、Router B和Router C上只允许目的地址为1.1.1.9/32、2.2.2.9/32、3.3.3.9/32、11.1.1.0/24和21.1.1.0/24的路由表项触发LDP建立LSP,其他路由表项不能触发LDP建立LSP。在Router B上配置倒数第二跳不弹出功能。
· 在Router A、Router B和Router C上对从源网段11.1.1.0/24到目的网段21.1.1.0/24的流量进行流量统计,以检查丢包的链路。
设备 |
接口 |
IP地址 |
设备 |
接口 |
IP地址 |
Router A |
Loop0 |
1.1.1.9/32 |
Router B |
Loop0 |
2.2.2.9/32 |
|
GE1/0/1 |
10.1.1.1/24 |
|
GE1/0/1 |
10.1.1.2/24 |
|
GE1/0/2 |
11.1.1.1/24 |
|
GE1/0/2 |
20.1.1.1/24 |
Router C |
Loop0 |
3.3.3.9/32 |
|
|
|
|
GE1/0/1 |
20.1.1.2/24 |
|
|
|
|
GE1/0/2 |
21.1.1.1/24 |
|
|
|
# 配置各接口的IP地址
按照图1-1配置各接口IP地址和掩码,包括Loopback接口,具体配置过程略。
# 配置OSPF,保证各路由器之间路由可达。
<RouterA> system-view
[RouterA] ospf
[RouterA-ospf-1] area 0
[RouterA-ospf-1-area-0.0.0.0] network 1.1.1.9 0.0.0.0
[RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] network 11.1.1.0 0.0.0.255
[RouterA-ospf-1-area-0.0.0.0] quit
[RouterA-ospf-1] quit
# 使能MPLS和LDP功能。
[RouterA] mpls lsr-id 1.1.1.9
[RouterA] mpls ldp
[RouterA-ldp] quit
[RouterA] interface gigabitethernet 1/0/1
[RouterA-GigabitEthernet1/0/1] mpls enable
[RouterA-GigabitEthernet1/0/1] mpls ldp enable
[RouterA-GigabitEthernet1/0/1] quit
# 创建IP地址前缀列表routera,并配置只有通过该列表过滤的路由表项能够触发LDP建立LSP。
[RouterA] ip prefix-list routera index 10 permit 1.1.1.9 32
[RouterA] ip prefix-list routera index 20 permit 2.2.2.9 32
[RouterA] ip prefix-list routera index 30 permit 3.3.3.9 32
[RouterA] ip prefix-list routera index 40 permit 11.1.1.0 24
[RouterA] ip prefix-list routera index 50 permit 21.1.1.0 24
[RouterA] mpls ldp
[RouterA-ldp] lsp-trigger prefix-list routera
[RouterA-ldp] quit
# 在Router A上配置流分类来匹配源网段为11.1.1.0/24,目的网段为21.1.1.0/24的IPv4报文流量。
[RouterA] acl advanced 3000
[RouterA-acl-ipv4-adv-3000] rule permit ip destination 21.1.1.0 0.0.0.255 source 11.1.1.0 0.0.0.255
[RouterA-acl-ipv4-adv-3000] quit
[RouterA] traffic classifier FEC
[RouterA-classifier-classifier_FEC] if-match acl 3000
[RouterA-classifier-classifier_FEC] quit
[RouterA] traffic classifier Other
[RouterA-classifier-classifier_Other] if-match any
[RouterA-classifier-classifier_Other] quit
# 在Router A上配置流行为来统计源网段为11.1.1.0/24,目的网段为21.1.1.0/24的IPv4报文流量。流行为中无需配置流量统计动作即可自动实现流量统计功能。
[RouterA] traffic behavior IP_statistic
[RouterA-behavior-behavior_IP_statistic] quit
# 定义QoS策略为类FEC指定流行为IP_statistic。
[RouterA] qos policy IP_statistic
[RouterA-qospolicy-IP_statistic] classifier FEC behavior IP_statistic
[RouterA-qospolicy-IP_statistic] quit
# 将策略IP_statistic应用到端口GigabitEthernet1/0/2的入方向上。
[RouterA] interface gigabitethernet 1/0/2
[RouterA-GigabitEthernet1/0/2] qos apply policy IP_statistic inbound
[RouterA-GigabitEthernet1/0/2] quit
# 在Router A上配置流行为重标记源网段为11.1.1.0/24,目的网段为21.1.1.0/24的MPLS报文流量的MPLS-EXP为7,其他流量的MPLS-EXP重标记为1。
[RouterA] traffic behavior MPLS_statistic
[RouterA-behavior-behavior_MPLS_statistic] remark mpls-exp 7
[RouterA-behavior-behavior_MPLS_statistic] quit
[RouterA] traffic behavior Other
[RouterA-behavior-behavior_Other] remark mpls-exp 1
[RouterA-behavior-behavior_Other] quit
# 定义QoS策略,为流分类FEC指定流行为MPLS_statistic。
[RouterA] qos policy MPLS_statistic
[RouterA-qospolicy-MPLS_statistic] classifier FEC behavior MPLS_statistic
[RouterA-qospolicy-MPLS_statistic] classifier Other behavior Other
[RouterA-qospolicy-MPLS_statistic] quit
# 将策略MPLS_statistic应用到端口GigabitEthernet1/0/1的出方向上。
[RouterA] interface gigabitethernet 1/0/1
[RouterA-GigabitEthernet1/0/1] qos apply policy MPLS_statistic outbound
[RouterA-GigabitEthernet1/0/1] quit
# 配置各接口的IP地址
按照图1-1配置各接口IP地址和掩码,包括Loopback接口,具体配置过程略。
# 配置OSPF,以保证各路由器之间路由可达
<RouterB> system-view
[RouterB] ospf
[RouterB-ospf-1] area 0
[RouterB-ospf-1-area-0.0.0.0] network 2.2.2.9 0.0.0.0
[RouterB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[RouterB-ospf-1-area-0.0.0.0] quit
[RouterB-ospf-1] quit
# 使能MPLS和LDP功能
[RouterB] mpls lsr-id 2.2.2.9
[RouterB] mpls ldp
[RouterB-ldp] quit
[RouterB] interface gigabitethernet 1/0/1
[RouterB-GigabitEthernet1/0/1] mpls enable
[RouterB-GigabitEthernet1/0/1] mpls ldp enable
[RouterB-GigabitEthernet1/0/1] quit
[RouterB] interface gigabitethernet 1/0/2
[RouterB-GigabitEthernet1/0/2] mpls enable
[RouterB-GigabitEthernet1/0/2] mpls ldp enable
[RouterB-GigabitEthernet1/0/2] quit
# 在Router B上创建IP地址前缀列表routerb,并配置只有通过该列表过滤的路由表项能够触发LDP建立LSP。
[RouterB] ip prefix-list routerb index 10 permit 1.1.1.9 32
[RouterB] ip prefix-list routerb index 20 permit 2.2.2.9 32
[RouterB] ip prefix-list routerb index 30 permit 3.3.3.9 32
[RouterB] ip prefix-list routerb index 40 permit 11.1.1.0 24
[RouterB] ip prefix-list routerb index 50 permit 21.1.1.0 24
[RouterB] mpls ldp
[RouterB-ldp] lsp-trigger prefix-list routerb
[RouterB-ldp] quit
# 在Router B上配置倒数第二跳仍携带非空显式标签。
[RouterB] mpls label advertise explicit-null
# 在Router B上配置流分类匹配MPLS-EXP为7的MPLS报文流量。
[RouterB] traffic classifier MPLS_statistic
[RouterB-classifier-classifier_MPLS_statistic] if-match mpls-exp 7
[RouterB-classifier-classifier_MPLS_statistic] quit
# 在Router B上配置流行为来统计MPLS-EXP为7的MPLS报文流量。流行为中无需配置流量统计动作即可自动实现流量统计功能。
[RouterB] traffic behavior MPLS_statistic_in
[RouterB-behavior-behavior_MPLS_statistic_in] quit
# 定义QoS策略,为流分类MPLS_statistic指定流行为MPLS_statistic。
[RouterB] qos policy MPLS_statistic_in
[RouterB-qospolicy-MPLS_statistic_in] classifier MPLS_statistic behavior MPLS_statistic_in
[RouterB-qospolicy-MPLS_statistic_in] quit
# 将策略MPLS_statistic应用到端口GigabitEthernet1/0/1的入方向上。
[RouterB] interface gigabitethernet 1/0/1
[RouterB-GigabitEthernet1/0/1] qos apply policy MPLS_statistic_in inbound
[RouterB-GigabitEthernet1/0/1] quit
# 在Router B上配置流行为来统计MPLS-EXP为7的流量。流行为中无需配置流量统计动作即可自动实现流量统计功能。
[RouterB] traffic behavior MPLS_statistic_out
[RouterB-behavior-behavior_MPLS_statistic_out] quit
# 定义QoS策略,为流分类MPLS_statistic指定流行为MPLS_statistic_out。
[RouterB] qos policy MPLS_statistic_out
[RouterB-qospolicy-MPLS_statistic] classifier MPLS_statistic behavior MPLS_statistic_out
[RouterB-qospolicy-MPLS_statistic] quit
# 将策略MPLS_statistic_out应用到端口GigabitEthernet1/0/2的出方向上。
[RouterB] interface gigabitethernet 1/0/2
[RouterB-GigabitEthernet1/0/2] qos apply policy MPLS_statistic_out outbound
[RouterB-GigabitEthernet1/0/2] quit
# 配置各接口的IP地址
按照图1-1配置各接口IP地址和掩码,包括Loopback接口,具体配置过程略。
# 配置OSPF,以保证各路由器之间路由可达
<RouterC> system-view
[RouterC] ospf
[RouterC-ospf-1] area 0
[RouterC-ospf-1-area-0.0.0.0] network 3.3.3.9 0.0.0.0
[RouterC-ospf-1-area-0.0.0.0] network 20.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] network 21.1.1.0 0.0.0.255
[RouterC-ospf-1-area-0.0.0.0] quit
[RouterC-ospf-1] quit
# 使能MPLS和LDP功能
[RouterC] mpls lsr-id 3.3.3.9
[RouterC] mpls ldp
[RouterC-ldp] quit
[RouterC] interface gigabitethernet 1/0/1
[RouterC-GigabitEthernet1/0/1] mpls enable
[RouterC-GigabitEthernet1/0/1] mpls ldp enable
[RouterC-GigabitEthernet1/0/1] quit
# 在Router C上创建IP地址前缀列表routerc,并配置只有通过该列表过滤的路由表项能够触发LDP建立LSP。
[RouterC] ip prefix-list routerc index 10 permit 1.1.1.9 32
[RouterC] ip prefix-list routerc index 20 permit 2.2.2.9 32
[RouterC] ip prefix-list routerc index 30 permit 3.3.3.9 32
[RouterC] ip prefix-list routerc index 40 permit 11.1.1.0 24
[RouterC] ip prefix-list routerc index 50 permit 21.1.1.0 24
[RouterC] mpls ldp
[RouterC-ldp] lsp-trigger prefix-list routerc
[RouterC-ldp] quit
# 在Router C上配置流分类匹配MPLS-EXP为7的MPLS报文流量。
[RouterB] traffic classifier MPLS_statistic
[RouterB-classifier-classifier_MPLS_statistic] if-match mpls-exp 7
[RouterB-classifier-classifier_MPLS_statistic] quit
# 在Router C上配置流行为来统计MPLS-EXP为7的流量。流行为中无需配置流量统计动作即可自动实现流量统计功能。
[RouterC] traffic behavior MPLS_statistic
[RouterC-behavior-behavior_MPLS_statistic] quit
# 定义QoS策略为类FEC指定流行为MPLS_statistic。
[RouterC] qos policy MPLS_statistic
[RouterC-qospolicy-MPLS_statistic] classifier MPLS_statistic behavior MPLS_statistic
[RouterC-qospolicy-MPLS_statistic] quit
# 将策略MPLS_statistic应用到端口GigabitEthernet1/0/1的入方向上。
[RouterC] interface gigabitethernet 1/0/1
[RouterC-GigabitEthernet1/0/1] qos apply policy MPLS_statistic inbound
[RouterC-GigabitEthernet1/0/1] quit
# 在Router C上配置流分类来匹配源网段为11.1.1.0/24,目的网段为21.1.1.0/24的IPv4报文流量。
[RouterC] acl advanced 3000
[RouterC-acl-ipv4-adv-3000] rule permit ip destination 21.1.1.0 0.0.0.255 source 11.1.1.0 0.0.0.255
[RouterC-acl-ipv4-adv-3000] quit
[RouterC] traffic classifier FEC operator and
[RouterC-classifier-classifier_FEC] if-match acl 3000
[RouterC-classifier-classifier_FEC] quit
# 在Router C上配置流行为来统计源网段为11.1.1.0/24,目的网段为21.1.1.0/24的IPv4报文流量。流行为中无需配置流量统计动作即可自动实现流量统计功能。
[RouterC] traffic behavior IP_statistic
[RouterC-behavior-behavior_IP_statistic] quit
# 定义QoS策略,为流分类FEC指定流行为IP_statistic。
[RouterC] qos policy IP_statistic
[RouterC-qospolicy-IP_statistic] classifier FEC behavior IP_statistic
[RouterC-qospolicy-IP_statistic] quit
# 将策略IP_statistic应用到端口GigabitEthernet1/0/2的出方向上。
[RouterC] interface gigabitethernet 1/0/2
[RouterC-GigabitEthernet1/0/2] qos apply policy IP_statistic outbound
[RouterC-GigabitEthernet1/0/2] quit
# 在Router A、Router B和Router C上执行display qos policy interface命令查看出入接口的流量统计信息,以Router A上流量入接口和出接口的显示信息为例,请检查Router A、Router B和Router C上出入接口的流量统计信息是否一致。
[RouterC-GigabitEthernet1/0/1] display qos policy interface
Interface: GigabitEthernet1/0/1
Direction: Inbound
Policy: IP_statistic
Classifier: default-class
Matched : 0 (Packets) 0 (Bytes)
5-minute statistics:
Forwarded: 0/0 (pps/bps)
Dropped : 0/0 (pps/bps)
Operator: AND
Rule(s) :
If-match any
Behavior: be
-none-
Classifier: FEC
Matched : 0 (Packets) 0 (Bytes)
5-minute statistics:
Forwarded: 123/41248 (pps/bps)
Dropped : 0/0 (pps/bps)
Operator: AND
Rule(s) :
If-match acl 3000
Behavior: IP_statistic
-none-
Interface: GigabitEthernet1/0/2
Direction: Outbound
Policy: MPLS_statistic
Classifier: default-class
Matched : 0 (Packets) 0 (Bytes)
5-minute statistics:
Forwarded: 123/41248 (pps/bps)
Dropped : 0/0 (pps/bps)
Operator: AND
Rule(s) :
If-match any
Behavior: be
-none-
Classifier: FEC
Matched : 123 (Packets) 41248 (Bytes)
5-minute statistics:
Forwarded: 123/41248 (pps/bps)
Dropped : 0/0 (pps/bps)
Operator: AND
Rule(s) :
If-match acl 3000
Behavior: MPLS_statistic
Marking:
Remark mpls-exp 7
· Router A:
#
ospf 1
area 0.0.0.0
network 1.1.1.9 0.0.0.0
network 10.1.1.0 0.0.0.255
network 11.1.1.0 0.0.0.255
#
mpls lsr-id 1.1.1.9
#
traffic classifier FEC operator and
if-match acl 3000
#
traffic classifier Other operator and
if-match any
#
traffic behavior IP_statistic
#
traffic behavior MPLS_statistic
remark mpls-exp 7
#
traffic behavior Other
remark mpls-exp 1
#
qos policy IP_statistic
classifier FEC behavior IP_statistic
#
qos policy MPLS_statistic
classifier FEC behavior MPLS_statistic
classifier Other behavior Other
#
mpls ldp
lsp-trigger prefix-list routera
#
#
interface LoopBack0
ip address 1.1.1.9 255.255.255.255
#
interface GigabitEthernet1/0/1
port link-mode route
combo enable copper
ip address 10.1.1.1 255.255.255.0
mpls enable
mpls ldp enable
qos apply policy MPLS_statistic outbound
#
interface GigabitEthernet1/0/2
port link-mode route
combo enable copper
ip address 11.1.1.1 255.255.255.0
qos apply policy IP_statistic inbound
#
ip prefix-list routera index 10 permit 1.1.1.9 32
ip prefix-list routera index 20 permit 2.2.2.9 32
ip prefix-list routera index 30 permit 3.3.3.9 32
ip prefix-list routera index 40 permit 11.1.1.0 24
ip prefix-list routera index 50 permit 21.1.1.0 24
#
acl advanced 3000
rule 5 permit ip source 11.1.1.0 0.0.0.255 destination 21.1.1.0 0.0.0.255
#
· Router B:
#
ospf 1
area 0.0.0.0
network 2.2.2.9 0.0.0.0
network 10.1.1.0 0.0.0.255
network 20.1.1.0 0.0.0.255
#
mpls lsr-id 2.2.2.9
mpls label advertise explicit-null
#
traffic classifier MPLS_statistic operator and
if-match mpls-exp 7
#
traffic behavior MPLS_statistic_in
#
traffic behavior MPLS_statistic_out
#
qos policy MPLS_statistic_in
classifier MPLS_statistic behavior MPLS_statistic_in
#
qos policy MPLS_statistic_out
classifier MPLS_statistic behavior MPLS_statistic_out
#
mpls ldp
lsp-trigger prefix-list routerb
#
#
interface LoopBack0
ip address 2.2.2.9 255.255.255.255
#
interface GigabitEthernet1/0/1
port link-mode route
combo enable copper
ip address 10.1.1.2 255.255.255.0
mpls enable
mpls ldp enable
qos apply policy MPLS_statistic_in inbound
#
interface GigabitEthernet1/0/2
port link-mode route
combo enable copper
ip address 20.1.1.1 255.255.255.0
qos apply policy MPLS_statistic_out outbound
#
ip prefix-list routerb index 10 permit 1.1.1.9 32
ip prefix-list routerb index 20 permit 2.2.2.9 32
ip prefix-list routerb index 30 permit 3.3.3.9 32
ip prefix-list routerb index 40 permit 11.1.1.0 24
ip prefix-list routerb index 50 permit 21.1.1.0 24
#
· Router C:
#
ospf 1
area 0.0.0.0
network 3.3.3.9 0.0.0.0
network 20.1.1.0 0.0.0.255
network 21.1.1.0 0.0.0.255
#
mpls lsr-id 3.3.3.9
#
traffic classifier FEC operator and
if-match acl 3000
#
traffic behavior IP_statistic
#
traffic behavior MPLS_statistic
#
qos policy IP_statistic
classifier FEC behavior IP_statistic
#
qos policy MPLS_statistic
classifier MPLS_statistic behavior MPLS_statistic
#
mpls ldp
lsp-trigger prefix-list routerc
#
#
interface LoopBack0
ip address 3.3.3.9 255.255.255.255
#
interface GigabitEthernet1/0/1
port link-mode route
combo enable copper
ip address 20.1.1.2 255.255.255.0
mpls enable
mpls ldp enable
qos apply policy MPLS_statistic inbound
#
interface GigabitEthernet1/0/2
port link-mode route
combo enable copper
ip address 21.1.1.1 255.255.255.0
qos apply policy IP_statistic outbound
#
ip prefix-list routerc index 10 permit 1.1.1.9 32
ip prefix-list routerc index 20 permit 2.2.2.9 32
ip prefix-list routerc index 30 permit 3.3.3.9 32
ip prefix-list routerc index 40 permit 11.1.1.0 24
ip prefix-list routerc index 50 permit 21.1.1.0 24
#
acl advanced 3000
rule 5 permit ip source 11.1.1.0 0.0.0.255 destination 21.1.1.0 0.0.0.255
#
不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!