Cisco IOS IPサービス – IP Accountingの設定

スポンサーリンク

IP Accountingとはパケットを収集する機能です。送信元IPアドレス・宛先IPアドレスの組ごとに、総パケット数、総バイト数を分析する事ができます。

IP Precedence Accounting

基本設定

以下のコマンドでprecedence毎にパケットを集計できます。

Router(config)# interface <interface>
Router(config-if)# ip accounting precedence [ input | output ]

設定確認

以下showコマンドで収集したパケットを確認する事ができます。

Rack11R1#show interfaces FastEthernet 0/0 precedence
FastEthernet0/0
  Output
    Precedence 0:  75 packets, 8550 bytes
    Precedence 2:  5 packets, 570 bytes
    Precedence 6:  37 packets, 3587 bytes
Rack11R1#

なお、以下のように拡張pingでTOSを指定する事によって容易に動作確認する事ができます。

Rack11R2#ping
Protocol [ip]:
Target IP address: 150.11.7.7
Repeat count [5]:
Datagram size [100]:
Timeout in seconds [2]:
Extended commands [n]: y
Source address or interface:
Type of service [0]: 64
Set DF bit in IP header? [no]:
Validate reply data? [no]:
Data pattern [0xABCD]:
Loose, Strict, Record, Timestamp, Verbose[none]:
Sweep range of sizes [n]:
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 150.11.7.7, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 56/59/64 ms
Rack11R2#

IP Output Packet Accounting

基本設定

IP Output Packet Accountingは出力パケットをsource, destinationのペア毎にパケットを集計する機能です。以下のように集計対象を”ip accounting-list”で必ず指定して下さい(“ip accounting-list”を入力しない何も収集されないようです)。

Router(config)# ip accounting-list <addr> <wildcard> 
Router(config)#
Router(config)# interface <interface>
Router(config-if)# ip accounting output-packets

なお、”ip accounting-list”コマンドのヘルプストリングに見ると第二引数はmaskを指定するように見えますが、これはコメントバグです。第二引数にはワイルドカードを指定して下さい

Rack11R1(config)#ip accounting-list 150.11.0.0 ?
  A.B.C.D  IP address mask

Rack11R1(config)#ip accounting-list 150.11.0.0 0.0.255.255

以下のコマンドでパケットを収集するデータベースのサイズを指定する事ができます。”ip accounting-threshold”は上記集計対象に合致したパケットの収集数で、”ip accounting-transits”は上記集計対象に合致しないパケットの収集数です。

Router(config)# ip accounting-threshold <size>
Router(config)# ip accounting-transits <size>

設定確認

以下showコマンドで収集したパケットを確認する事ができます。

Rack11R1#show ip accounting
   Source           Destination              Packets               Bytes
 150.11.4.4       150.11.8.8                      30                3000
 150.11.5.5       150.11.8.8                      30                3000
 130.11.26.6      150.11.7.7                      20                2000
 130.11.124.2     130.11.17.7                     20                2000

Accounting data age is 0
Rack11R1#

チェックポイントの運用

以下のコマンドで収集した情報をクリアする事ができます。

Rack11R1#clear ip accounting
Rack11R1#
Rack11R1#
Rack11R1#show ip accounting
   Source           Destination              Packets               Bytes

Accounting data age is 0
Rack11R1#

クリアされた情報は完全に削除されるわけではなく、チェックポイントと呼ばれるデータベースに格納されます。チェックポイントを確認する方法は以下の通りです。

Rack11R1#show ip accounting checkpoint
   Source           Destination              Packets               Bytes
 150.11.4.4       150.11.8.8                      30                3000
 150.11.5.5       150.11.8.8                      30                3000
 130.11.26.6      150.11.7.7                      20                2000
 130.11.124.2     130.11.17.7                     20                2000

Accounting data age is 4
Rack11R1#

IP Access Violation Accounting

基本設定

以下のコマンドでACLに反したパケットの送信元IPアドレス・宛先IPアドレスを記録する事ができます。(但し、この機能を使う事ができるのは数字ACLのみです。名前付きACLは集計対象にはならない事に注意して下さい。)

Router(config)# interface <interface>
Router(config-if)# ip accounting access-violations

設定確認

以下showコマンドでACLに反したパケットを確認する事ができます。

Rack11R6#show ip accounting access-violations
   Source           Destination              Packets               Bytes   ACL
 130.11.26.2      150.11.6.6                       3                 300   100
 130.11.234.3     130.11.26.6                      5                 500   100

Accounting data age is 4
Rack11R6#

MAC Address Accounting

基本設定

以下のコマンドでMACアドレス毎にパケットを集計する事ができます。

Router(config)# interface <interface>
Router(config-if)# ip accounting mac-address [ input | output ]

設定確認

以下showコマンドで集計結果を確認する事ができます。

Rack11R1#show interfaces FastEthernet 0/0 mac-accounting
FastEthernet0/0
  Input  (509 free)
    0015.6325.6080(179):  100 packets, 11400 bytes, last: 47895ms ago
    0019.55af.7243(210):  116 packets, 12939 bytes, last: 754ms ago
    0019.55cb.bcc6(253):  99 packets, 11286 bytes, last: 70071ms ago
                  Total:  315 packets, 35625 bytes
  Output  (509 free)
    0100.5e00.000d(82 ):  2 packets, 160 bytes, last: 20610ms ago
    0100.5e00.0005(90 ):  3 packets, 402 bytes, last: 4015ms ago
    0019.55af.7243(210):  105 packets, 11970 bytes, last: 493ms ago
                  Total:  110 packets, 12532 bytes
Rack11R1#
タイトルとURLをコピーしました