SoFunction
Updated on 2025-04-06

Description and configuration of three network traffic detection methods

1. ip accounting

1. Configuration method

router(config)#int s 0/0

router(config-if)#ip accounting output-packets

router#sh ip accounting output-packets

Source Destination Packets Bytes

192.1.1.110 192.1.1.97 5 500

172.17.246. 128 192.1.1.110 8 704

Accounting data age is 2d23h

or

router(config)#int s 0/0

router(config-if)#ip accounting access-violations

router#sh ip accounting [checkpoint] access-violations

Source Destination Packets Bytes ACL

192.1.1.110 224.0.0.5 46 3128 19

Accounting data age is 7

2. Description

●If this method is
routing
Please use it with caution when the load of the device is too high, as it will degrade the system performance.
● Statistics on the number of bytes and packets based on the address pair
● Usually only outbound packets and packets rejected by ACLs (supports ACLs in IN and OUT directions)
● Only count time travel
routing
The flow, source or purpose of the device is
routing
The data packets of the device are not counted
● Supports all switching paths, except Autonomous Switching
● Statistical values ​​can be accessed through SNMP, MIB is OLD-CISCO-IP-MIB, lipAccountingTable
● ip accounting also supports other monitoring methods, such as tos, mac-address, etc.

2. netflow

1. Configuration method

router (config-if)#ip route-cache flow

router (config)#ip flow-export destination 172.17.246.225 9996

router (config)#ip flow-export version 5

Optional configuration

router (config)#ip flow-export source loopback 0

router (config)#ip flow-cache entries

router (config)#ip flow-cache timeout

sh ip cache flow

IP packet size distribution (132429191 total packets):

1-32 64 96 128 160 192 224 256 288 320 352 384 416 448 480

.000 .191 .024 .009 .010 .006 .005 .008 .003 .005 .003 .003 .002 .001 .001

512 544 576 1024 1536 2048 2560 3072 3584 4096 4608

.001 .002 .107 .032 .578 .000 .000 .000 .000 .000 .000

IP Flow Switching Cache, 278544 bytes

33 active, 4063 inactive, 7975259 added

104834714 ager polls, 0 flow alloc failures

Active flows timeout in 30 minutes

Inactive flows timeout in 15 seconds

last clearing of statistics never

Protocol Total Flows Packets Bytes Packets Active(Sec) Idle(Sec)

-------- Flows /Sec /Flow /Pkt /Sec /Flow /Flow

TCP-Telnet 25378 0.0 12 652 0.0 22.9 15.2

TCP-FTP 432435 0.1 4 59 0.4 1.2 2.7

TCP-FTPD 28670 0.0 212 1397 1.4 8.2 1.6

TCP-WWW 4682530 1.0 15 927 16.4 2.4 4.6

2. Description

● Statistics the amount of data based on streams (including address pairs, port numbers, protocol types, etc.)

● Only support inbound traffic

● Only unicast is supported

● Only configured on the main port

● Need to be used with cef or fast switching

● Right
routing
The performance of the device has an impact

10,000 active flows: sh log

Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes,

0 overruns)

Console logging: level debugging, 79 messages logged

Monitor logging: level debugging, 0 messages logged

Buffer logging: level debugging, 79 messages logged

Logging Exception size (4096 bytes)

Trap logging: level informational, 83 message lines logged

Log Buffer (4096 bytes):

*May 25 05:27:50: %SEC-6-IPACCESSLOGP: list 118 permitted tcp 10.1.64.71(0) -> 10.0.29.3(0), 1 packet

*May 25 05:28:59: %SEC-6-IPACCESSLOGP: list 118 permitted tcp 10.1.64.71(0) -> 10.0.28.128(0), 1 packet

*May 25 05:29:19: %SEC-6-IPACCESSLOGP: list 118 allowed tcp 10.1.64.71(0) -> 10.0.29.3(0), 56 packets Article entry: csh     Editor: csh