【华为交换机】流量统计及配置实例
配置思路 a. 配置各设备vlan及接口信息,实现PC与SW2网络互通。
b. 配置ACL规则,根据源/目的IP匹配需要“统计”的报文。
c. 配置流分类,匹配上述ACL,对出入报文进行区分。
d. 配置流行为,使能流量统计功能。
e. 配置流策略,将上述流分类和流行为进行绑定。
f. 在出/入接口应用流策略。
配置步骤 1. 配置vlan及接口信息,实现网络互通。
SW1配置:
vlan batch 10 20 //创建vlan 10 20
interface Vlanif10
ip address 10.1.1.1 255.255.255.0 //配置vlanif10虚拟接口IP
interface Vlanif20
ip address 10.1.2.1 255.255.255.0 //配置vlanif20虚拟接口IP
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10 //配置接口类型
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 20 //配置接口类型
SW2配置:
vlan batch 20 //创建vlan 20
interface Vlanif20
ip address 10.1.2.2 255.255.255.0 //配置vlanif20虚拟接口IP
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 20 //配置接口类型
ip route-static 10.1.1.0 255.255.255.0 10.1.2.1 //配置10.1.1.0/24网段的回程路由
2. 配置ACL规则
acl number 3000 //创建ACL 3000
rule 10 permit ip source 10.1.1.2 0 destination 10.1.2.2 0
//允许源ip:10.1.1.2/32,目的ip:10.1.2.2/32的报文通过。
3. 配置流分类
traffic classifier liutong operator and //创建流分类liutong
if-match acl 3000 //匹配规则为ACL 3000
4. 配置流行为
traffic behavior liutong //创建流行为liutong
statistic enable //使能流量统计功能
5. 配置流策略
traffic policy liutong //创建流策略liutong
classifier liutong behavior liutong //将流分类liutong和流行为liutong绑定
6. 应用流策略
interface GigabitEthernet0/0/1
traffic-policy liutong inbound //在g0/0/1口的入方向应用策略
interface GigabitEthernet0/0/2
traffic-policy liutong outbound //在g0/0/2口的出方向应用策略
实验验证 PC1上执行ping 10.1.2.2 -c 3
在SW1上查看流量统计情况
dis traffic policy statistics interface GigabitEthernet0/0/1 inbound
dis traffic policy statistics interface GigabitEthernet0/0/2 outbound