Cisco 路由器有時需要定位到某個高流量的IP地址,但是交換機模塊的端口是沒辦法查看。使用ip accounting可以實現此目的。
【ip accounting使用說明】
- 此方法如果在路由器負載特大的時候請謹慎使用,因其會使系統性能下降
- 基於地址對的字節數量及數據包數量統計
- 通常只支持outbound的數據包,及被ACL拒絕的數據包(支持IN 和 OUT方向的ACL)
- 只統計穿越路由器的流量,源或目的是該路由器的數據包不做統計
- 支持所有的switching path,除了Autonomous Switching
- 可以通過SNMP來訪問統計值,MIB是OLD-CISCO-IP-MIB, lipAccountingTable
- ip accounting還支持其他的監測方式,如基於tos,mac-address等
【ip accounting參數】
A(config-if)#ip accounting
access-violations Account for IP packets violating access lists on this interface
mac-address Account for MAC addresses seen on this interface
output-packets Account for IP packets output on this interface
precedence Count packets by IP precedence on this interface
【例子】
步驟1:將流量計數應用到路由出口
A#conf t
A(config)#
A(config)#interface s0/0/0
A(config-if)#ip accounting output-packets
步驟2:查看端口流量計數
A#sh ip accounting
Source Destination Packets Bytes
192.25.1.186 192.25.1.130 44 2640
192.25.1.180 169.253.200.50 4 428
192.25.1.135 10.22.61.62 3 120
Accounting data age is 1
A#
以上結構可以查看對應的IP地址哪個流量高
為了准確判斷,在查看前最好能清除一下計數
A#clear ip accounting
發出 clear ip accounting 命令時即停止遞增,清除統計信息。