对接口GE3/1/1入方向源IP为1.1.1.1的数据流进行流量统计,包括报文字节数和包数。
图1 Accounting配置组网图
l 配置acl 2000,匹配源IP为1.1.1.1的数据流
l
配置流分类accounting_class,匹配acl 2000
l
配置流行为accounting_behavior,动作为accounting
l
配置QoS策略accounting_policy,绑定流分类和流行为
l
将QoS策略下发到端口g3/1/1
#
定义ACL 2000,匹配源IP为1.1.1.1的数据流
[H3C]
acl number 2000
[H3C-acl-basic-2000]
rule 0 permit source 1.1.1.1 0
#
定义流分类accounting_class,匹配acl 2000
[H3C]
traffic classifier accounting_class
[H3C-classifier-accounting_class]
if-match acl 2000
#
定义流行为accounting_behavior,动作为accounting
[H3C]
traffic behavior accounting_behavior
[H3C-behavior-accounting_behavior]
accounting
#定义QoS策略accounting_policy,绑定流行为和流动作
[H3C]
qos policy accounting_policy
[H3C-qospolicy-accounting_policy]
classifier accounting_class behavior accounting_behavior
#
将QoS策略下发到接口g3/1/1入方向
[H3C]
interface GigabitEthernet 3/1/1
[H3C-GigabitEthernet3/1/1]
qos apply policy accounting_policy inbound
#
验证配置信息
[H3C-GigabitEthernet3/1/1]
display qos policy interface GigabitEthernet 3/1/1
Interface:
GigabitEthernet3/1/1
Direction: Inbound
Policy:
accounting_policy
Classifier:
accounting_class
Operator:
AND
Rule(s) : If-match acl
2000
Behavior:
accounting_behavior
Accounting
Enable:
0
(Packets)
0
(Bytes)
& 说明:
accounting动作与聚合car动作冲突,同时存在于一个流行为中时,策略下发端口后,该流行为不生效。
本文档不严格与具体软、硬件版本对应。