交換機涉及丟包問題進行流量統計

交換機涉及丟包問題 進行流量統計 配置參考

 

解決方案

關鍵配置如下:

#
acl number 3000
rule 0 permit icmp source 192.168.1.2 0 destination192.168.1.3 0  
rule 1 permit icmp source 192.168.1.3 0 destination 192.168.1.2 0   
//
需要統計的流量,源做目的,目的做源.需要正反寫兩條rule條目
#
traffic classifier 3000 operator and
if-match acl 3000
#
traffic behavior 3000
permit
statistic enable    

// 在流行爲中 開啓流量統計功能 statistic enable
#
traffic policy 3000
classifier 3000 behavior 3000
#
interface gigabitEthernet0/0/1                  

// 在流量的進入交換機的接口和出交換機的接口上都要雙方向調用流策略
traffic-policy 3000 inbound
traffic-policy 3000 outbound

#
interface gigabitEthernet0/0/2

//在流量的進入交換機的接口和出交換機的接口上都要雙方向調用流策略
traffic-policy 3000 inbound
traffic-policy 3000 outbound

#

 

PC1>ping 192.168.1.3    // PC1 ping PC2測試流量統計效果

Ping 192.168.1.3: 32 data bytes, Press Ctrl_C to break
From 192.168.1.3: bytes=32 seq=1 ttl=128 time=31 ms
From 192.168.1.3: bytes=32 seq=2 ttl=128 time=15 ms
From 192.168.1.3: bytes=32 seq=3 ttl=128 time=15 ms
From 192.168.1.3: bytes=32 seq=4 ttl=128 time<1 ms
From 192.168.1.3: bytes=32 seq=5 ttl=128 time=31 ms

--- 192.168.1.3 ping statistics ---
  5 packet(s) transmitted
  5 packet(s) received
  0.00% packet loss
  round-trip min/avg/max = 0/18/31 ms

[SW1]display traffic policy statistics interface GigabitEthernet 0/0/1 inbound

Interface: GigabitEthernet0/0/1
Traffic policy inbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item                             Packets                      Bytes
---------------------------------------------------------------------
Matched                               10                        740
  +--Passed                           10                        740
 +--Dropped                           0                          0
   +--Filter                          0                          0
    +--URPF                            -                          -
   +--CAR                             0                          0
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/1 outbound

Interface: GigabitEthernet0/0/1
Traffic policy outbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item                             Packets                      Bytes
---------------------------------------------------------------------
Matched                               10                        740
  +--Passed                           10                        740
 +--Dropped                           0                          0
   +--Filter                          0                          0
   +--URPF                            -                          -
   +--CAR                             0                          0
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/2 inbound

Interface: GigabitEthernet0/0/2
Traffic policy inbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item                             Packets                      Bytes
---------------------------------------------------------------------
Matched                               10                        740
  +--Passed                           10                        740
  +--Dropped                           0                          0
   +--Filter                          0                          0
   +--URPF                            -                          -
   +--CAR                             0                          0
[SW1]display traffic policy statistics interface GigabitEthernet 0/0/2 outbound

Interface: GigabitEthernet0/0/2
Traffic policy outbound: 3000
Rule number: 2
Current status: OK!
---------------------------------------------------------------------
Board : 0
Item                             Packets                      Bytes
---------------------------------------------------------------------
Matched                               10                        740
  +--Passed                           10                        740
 +--Dropped                           0                          0
   +--Filter                          0                          0
   +--URPF                            -                          -
   +--CAR                             0                          0

 

入接口GigabitEthernet 0/0/1 inbound 方向通過的數據包個數 等於出接口GigabitEthernet 0/0/2 outbound方向通過的數據包個數,表明ping的請求包交換機沒有丟包

入接口GigabitEthernet 0/0/1 outbound 方向通過的數據包個數 等於出接口GigabitEthernet 0/0/2 inbound方向通過的數據包個數,表明ping的回包交換機沒有丟包

 

清空接口統計計數:

reset traffic policy statistics interface GigabitEthernet 0/0/2 outbound


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章