赞
踩
组网图形
设备 | 接口 | 接口所属VLAN | 对应的三层接口 | |
---|---|---|---|---|
SwitchA | GigabitEthernet1/0/1 | VLAN 10 | - | - |
GigabitEthernet1/0/2 | VLAN 20 | - | - | |
GigabitEthernet1/0/3 | VLAN 10、VLAN 20 | - | - | |
Switch | GigabitEthernet1/0/1 | VLAN 10、VLAN 20 | VLANIF10、VLANIF20 | VLANIF10:192.168.1.1/24 VLANIF20:192.168.2.1/24 |
GigabitEthernet1/0/2 | VLAN 30 | VLANIF30 | 10.1.20.2/24 |
配置MQC实现流量统计后,设备将对符合流分类规则的报文进行报文数和字节数的统计,可以帮助用户了解应用流策略后流量通过和被丢弃的情况,由此分析和判断流策略的应用是否合理,也有助于进行相关的故障诊断与排查。
入方向与出方向的统计属于并列关系,用户可以根据需要同时配置,也可以单独配置,流量分开统计,互不影响。
-
- 本举例适用的产品包括:
- S2752EI、S2710-SI、S2720-EI、S2750-EI
- S3700-SI、S3700-EI、S3700-HI
- S5700-LI、S5700S-LI、S5700-SI、S5700-EI、S5700-HI、S5710-C-LI、S5710-X-LI、S5710-EI、S5710-HI、S5720-LI、S5720S-LI、S5720-SI、S5720S-SI、S5720I-SI、S5720-EI、S5720-HI、S5730-HI、S5730-SI、S5730S-EI、S5731-H、S5731-S、S5731S-S、S5731S-H、S5731-H-K、S5732-H、S5732-H-K、S2730S-S、S5735-L-I、S5735-L1、S300、S5735-L、S5735S-L1、S5735S-L、S5735S-L-M、S500、S5735-S、S5735S-S、S5735-S-I、S5735S-H、S5736-S
- S6700-EI、S6720-LI、S6720S-LI、S6720-SI、S6720S-SI、S6720-EI、S6720S-EI、S6720-HI、S6730-H、S6730-S、S6730S-S、S6730S-H、S6730-H-K
- S7703、S7706、S7712、S7710、S7703 PoE、S7706 PoE、S7905、S7908、S9703、S9706、S9712
-
-
如需了解交换机软件配套详细信息,请点击Info-Finder,在选择产品系列或产品型号后,在“硬件中心”进行查询。
S5731-L和S5731S-L属于远端模块,不支持Web管理、YANG和命令行,仅支持通过中心交换机对其下发配置,相关操作请参见《S300, S500, S2700, S5700, S6700 V200R022C00 配置指南-设备管理》中的“智能极简园区网络配置(小行星方案)”。
如图1所示,企业内部有两个部门,分别属于VLAN 10和VLAN 20。网络管理员想确认VLAN 20中IP地址为192.168.2.200/24的主机是否有访问VLAN 10中IP地址为192.168.1.100/24的服务器的流量。
采用如下的思路配置针对不同网段用户限速:
- # 配置Switch。
-
- <HUAWEI> system-view
- [HUAWEI] sysname Switch
- [Switch] vlan batch 10 20 30 //创建VLAN 10、VLAN 20、VLAN 30
- [Switch] interface gigabitethernet 1/0/1
- [Switch-GigabitEthernet1/0/1] port link-type trunk //设置接口接入类型为trunk
- [Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 10 20 //将接口划分到VLAN 10和VLAN 20
- [Switch-GigabitEthernet1/0/1] quit
- [Switch] interface gigabitethernet 1/0/2
- [Switch-GigabitEthernet1/0/2] port link-type access //设置接口接入类型为access
- [Switch-GigabitEthernet1/0/2] port default vlan 30 //将接口划分到VLAN 30
- [Switch-GigabitEthernet1/0/2] quit
- [Switch] interface vlanif 10 //创建VLANIF接口
- [Switch-Vlanif10] ip address 192.168.1.1 255.255.255.0 //配置VLANIF接口的IP地址,此IP地址为192.168.1.0/24网段的网关
- [Switch-Vlanif10] quit
- [Switch] interface vlanif 20
- [Switch-Vlanif20] ip address 192.168.2.1 255.255.255.0
- [Switch-Vlanif20] quit
- [Switch] interface vlanif 30 //创建VLANIF接口
- [Switch-Vlanif30] ip address 10.1.20.2 255.255.255.0 //配置VLANIF接口的IP地址,用于与Router互连
- [Switch-Vlanif30] quit
- [Switch] ip route-static 0.0.0.0 0 10.1.20.1 //配置静态路由指向外网,实现网络互通
- # 配置SwitchA。
-
- <HUAWEI> system-view
- [HUAWEI] sysname SwitchA
- [SwitchA] vlan batch 10 20 //创建VLAN 10和VLAN 20
- [SwitchA] interface gigabitethernet 1/0/1
- [SwitchA-GigabitEthernet1/0/1] port link-type access //设置接口接入类型为access
- [SwitchA-GigabitEthernet1/0/1] port default vlan 10 //将接口划分到VLAN 10
- [SwitchA-GigabitEthernet1/0/1] quit
- [SwitchA] interface gigabitethernet 1/0/2
- [SwitchA-GigabitEthernet1/0/2] port link-type access
- [SwitchA-GigabitEthernet1/0/2] port default vlan 20
- [SwitchA-GigabitEthernet1/0/2] quit
- [SwitchA] interface gigabitethernet 1/0/3
- [SwitchA-GigabitEthernet1/0/3] port link-type trunk //设置接口接入类型为trunk
- [SwitchA-GigabitEthernet1/0/3] port trunk allow-pass vlan 10 20 //将接口划分到VLAN 10和VLAN 20
- [SwitchA-GigabitEthernet1/0/3] quit
- # 配置路由器。
-
- 配置路由器上与Switch相连的接口的IP地址为10.1.20.1/24。

- # 在Switch上配置ACL规则,匹配源IP地址为192.168.2.200、目的IP地址为192.168.1.100的流量。
-
- [Switch] acl 3000
- [Switch-acl-adv-3000] rule permit ip source 192.168.2.200 0.0.0.0 destination 192.168.1.100 0.0.0.0
- [Switch-acl-adv-3000] quit
- # 在Switch上配置流分类,按照ACL对报文进行分类。
-
- [Switch] traffic classifier c1 operator and
- [Switch-classifier-c1] if-match acl 3000
- [Switch-classifier-c1] quit
- # 在Switch上配置流行为,并配置流量统计动作。
-
- [Switch] traffic behavior b1
- [Switch-behavior-b1] statistic enable
- [Switch-behavior-b1] quit
- # 在Switch上创建流策略,将流分类和对应的流行为进行绑定,并将流策略应用到与SwitchA相连的接口GE1/0/1的入方向上。
-
- [Switch] traffic policy p1
- [Switch-trafficpolicy-p1] classifier c1 behavior b1
- [Switch-trafficpolicy-p1] quit
- [Switch] interface gigabitethernet 1/0/1
- [Switch-GigabitEthernet1/0/1] traffic-policy p1 inbound
- [Switch-GigabitEthernet1/0/1] quit
- # 查看ACL规则的配置信息。
-
- [Switch] display acl 3000
- Advanced ACL 3000, 1 rule
- Acl's step is 5
- rule 5 permit ip source 192.168.2.200 0 destination 192.168.1.100 0 (match-counter 0)
- # 查看流策略的配置信息。
- [Switch] display traffic policy user-defined p1
- User Defined Traffic Policy Information:
- Policy: p1
- Classifier: c1
- Operator: AND
- Behavior: b1
- Permit
- Statistic: enable
- # 查看流量统计信息。
- [Switch] display traffic policy statistics interface gigabitethernet 1/0/1 inbound
-
- Interface: GigabitEthernet1/0/1
- Traffic policy inbound: p1
- Rule number: 1
- Current status: success
- Statistics interval: 300
- ---------------------------------------------------------------------
- Board : 1
- ---------------------------------------------------------------------
- Matched | Packets: 0
- | Bytes: 0
- | Rate(pps): 0
- | Rate(bps): 0
- ---------------------------------------------------------------------
- Passed | Packets: 0
- | Bytes: 0
- | Rate(pps): 0
- | Rate(bps): 0
- ---------------------------------------------------------------------
- Dropped | Packets: 0
- | Bytes: 0
- | Rate(pps): 0
- | Rate(bps): 0
- ---------------------------------------------------------------------
- Filter | Packets: 0
- | Bytes: 0
- ---------------------------------------------------------------------
- Car | Packets: 0
- | Bytes: 0
- ---------------------------------------------------------------------

回显信息中,Matched显示匹配流分类规则的报文数和字节数,Passed显示匹配流分类规则的报文中通过的报文数和字节数。如果Matched和Passed显示的统计结果不为0,表示VLAN 20中IP地址为192.168.2.200主机有访问VLAN 10中IP地址为192.168.1.100的服务器的流量。
- Switch的配置文件
-
- #
- sysname Switch
- #
- vlan batch 10 20 30
- #
- acl number 3000
- rule 5 permit ip source 192.168.2.200 0 destination 192.168.1.100 0
- #
- traffic classifier c1 operator and precedence 5
- if-match acl 3000
- #
- traffic behavior b1
- permit
- statistic enable
- #
- traffic policy p1 match-order config
- classifier c1 behavior b1
- #
- interface Vlanif10
- ip address 192.168.1.1 255.255.255.0
- #
- interface Vlanif20
- ip address 192.168.2.1 255.255.255.0
- #
- interface Vlanif30
- ip address 10.1.20.2 255.255.255.0
- #
- interface GigabitEthernet1/0/1
- port link-type trunk
- port trunk allow-pass vlan 10 20
- traffic-policy p1 inbound
- #
- interface GigabitEthernet1/0/2
- port link-type access
- port default vlan 30
- #
- ip route-static 0.0.0.0 0.0.0.0 10.1.20.1
- #
- return
- SwitchA的配置文件
-
- #
- sysname SwitchA
- #
- vlan batch 10 20
- #
- interface GigabitEthernet1/0/1
- port link-type access
- port default vlan 10
- #
- interface GigabitEthernet1/0/2
- port link-type access
- port default vlan 20
- #
- interface GigabitEthernet1/0/3
- port link-type trunk
- port trunk allow-pass vlan 10 20
- #
- return

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。