This section includes the most important configuration commands to enable NetFlow on Cisco routers. Subsequent sections of this chapter cover specific NetFlow versions and more advanced features and describe the respective commands. Because the NetFlow configuration on the Catalysts is slightly different, it is covered in a separate section.
router(config)# ip flow-export {destination {ip-address | hostname} udp-port | source {interface-name} | version {1 | [{5 | 9} [origin-as | peer-as] [bgp-nexthop]]} | template {refresh-rate packets | timeout-rate minutes} [options {export-stats | refresh-rate packets | sampler | timeout-rate minutes}]}
enables the export of information in NetFlow cache entries. The minimum to specify is the IP address or hostname for exporting the flow records, the UDP port where the collector is listening, and the NetFlow version. Optionally, the configuration allows the collection and reporting of the BGP Autonomous System numbers and the BGP next-hop address.
The source {interface-name} keyword is very useful to configure in the ip flow-export command, because it overrides the default behavior for the source IP address of the UDP NetFlow export packets (using the IP address of the interface that the datagram is transmitted over as the source IP address for the NetFlow export packets). The source IP address of the NetFlow export packets is used by the collector to determine from which router the NetFlow records arrive. In a situation where the primary link from the router to the collector is not operational, the router might send the flow records via a different interface, and the collector receives the records from the same router with a different source IP addresses if source {interface-name} is not set.
router(config-if)# ip flow ingress
configures NetFlow on an interface or subinterface.
router(config-if)# ip flow egress
configures egress support for NetFlow on an interface or subinterface.
router(config)# ip flow-cache timeout [active minutes | inactive seconds]
specifies the main flow cache active and inactive parameters for flow expiration. The default values are 30 minutes for the active timeout (with a configurable range from 1 to 60) and 15 seconds for the inactive timeout (with a configurable range from 10 to 600).
router(config)# ip flow-cache entries
changes the number of entries maintained in the main NetFlow cache. The valid range is from 1024 to 524288 entries. The number of entries should be changed only if the main cache capacity reaches its limit and if the router has additional free memory available.