Getting Started with Configuring Cisco IOS NetFlow and NetFlow Data Export
Last Updated: May 10, 2012
This module contains the minimum amount of information about and instructions necessary for configuring NetFlow to capture and export network traffic data. This module is intended to help you get started using NetFlow and NetFlow Data Export as quickly as possible. If you want more detailed information about this feature and instructions for configuring NetFlow and NetFlow Data Export, please refer to Configuring NetFlow and NetFlow Data Export.
NetFlow capture and export are performed independently on each internetworking device on which NetFlow is enabled. NetFlow need not be operational on each router in the network.
NetFlow is a Cisco IOS application that provides statistics on packets flowing through the router. NetFlow is emerging as a primary network accounting and security technology.
Your software release may not support all the features documented in this module. For the latest feature information and caveats, see the release notes for your platform and software release. To find information about the features documented in this module, and to see a list of the releases in which each feature is supported, see the Feature Information Table at the end of this document.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Prerequisites for Configuring NetFlow and NetFlow Data Export
Before you enable NetFlow:
Configure the router for IP routing.
Ensure that one of the following is enabled on your router, and on the interfaces that you want to configure NetFlow on: Cisco Express Forwarding (CEF), distributed CEF, or fast switching.
Understand the resources required on your router because NetFlow consumes additional memory and CPU resources.
Restrictions for Configuring NetFlow and NetFlow Data Export
NetFlow consumes additional memory. If you have memory constraints, you might want to preset the size of the NetFlow cache so that it contains a smaller number of entries. The default cache size depends on the platform. For example, the default cache size for the Cisco 7500 router is 65536 (64K) entries.
Memory Impact
During times of heavy traffic, the additional flows can fill up the global flow hash table. If you need to increase the size of the global flow hash table, increase the memory of the router.
Cisco IOS Releases 12.2(14)S, 12.0(22)S, or 12.2(15)T
If your router is running a version of Cisco IOS prior to releases 12.2(14)S, 12.0(22)S, or 12.2(15)T, the iproute-cacheflow command is used to enable NetFlow on an interface.
If your router is running Cisco IOS release 12.2(14)S, 12.0(22)S, 12.2(15)T, or later, the ipflowingress command is used to enable NetFlow on an interface.
Egress NetFlow Accounting in Cisco IOS 12.3T Releases, 12.3(11)T, or Later
The Egress NetFlow Accounting feature captures NetFlow statistics for IP traffic only. MPLS statistics are not captured. The MPLS Egress NetFlow Accounting feature can be used on a provider edge (PE) router to capture IP traffic flow information for egress IP packets that arrived at the router as MPLS packets and underwent label disposition.
Egress NetFlow accounting might adversely affect network performance because of the additional accounting-related computation that occurs in the traffic-forwarding path of the router.
Locally generated traffic (traffic that is generated by the router on which the Egress NetFlow Accounting feature is configured) is not counted as flow traffic for the Egress NetFlow Accounting feature.
Note
In Cisco IOS 12.2S releases, egress NetFlow captures either IPv4 packets or MPLS packets as they leave the router.
The Egress NetFlow Accounting feature counts CEF-switched packets only. Process-switched transit packets are not counted.
NetFlow Data Export
Restrictions for NetFlow Version 9 Data Export
Backward compatibility--Version 9 is not backward-compatible with Version 5 or Version 8. If you need Version 5 or Version 8, you must configure it.
Export bandwidth--Export bandwidth use increases for Version 9 (because of template flowsets) versus Version 5. The increase in bandwidth usage versus Version 5 varies with the frequency with which template flowsets are sent. The default is to resend templates every 20 packets, which has a bandwidth cost of about 4 percent. If necessary, you can lower the resend rate with the ipflow-exporttemplaterefresh-ratepackets command.
Performance impact--Version 9 slightly decreases overall performance, because generating and maintaining valid template flowsets require additional processing.
Information About Configuring NetFlow and NetFlow Data Export
NetFlow captures data for all egress (outgoing) packets through the use of the following features:
Egress NetFlow Accounting--NetFlow gathers statistics for all egress packets for IP traffic only.
NetFlow MPLS Egress--NetFlow gathers statistics for all egress MPLS-to-IP packets.
NetFlow Flows Key Fields
A network flow is identified as a unidirectional stream of packets between a given source and destination--both are defined by a network-layer IP address and by transport-layer source and destination port numbers. Specifically, a flow is identified as the combination of the following key fields:
Source IP address
Destination IP address
Source port number
Destination port number
Layer 3 protocol type
Type of service (ToS)
Input logical interface
These seven key fields define a unique flow. If a packet has one key field different from another packet, it is considered to belong to another flow. A flow might contain other accounting fields (such as the AS number in the NetFlow export Version 5 flow format) that depend on the export record version that you configure. Flows are stored in the NetFlow cache.
NetFlow Data Export Using the Version 9 Export Format
NetFlow Data Export format Version 9 is a flexible and extensible format, which provides the versatility needed for support of new fields and record types. This format accommodates new NetFlow-supported technologies such as Multicast, Multiprotocol Label Switching (MPLS), and Border Gateway Protocol (BGP) next hop. The Version 9 export format enables you to use the same version for main and aggregation caches, and the format is extendable, so you can use the same export format with future features.
Router(config)# ip flow-export destination 172.16.10.2 99
(Optional) IP address or hostname of the workstation to which you want to send the NetFlow information and the number of the UDP port on which the workstation is listening for this input.
Note
The workstation is running an application such as NetFlow Collection Engine (NFC) that is used to analyze the exported data.
Step 4
Repeat Step 3 once to configure a second NetFlow export destination.
(Optional) You can configure a maximum of two export destinations for NetFlow.
Step 5
ipflow-exportversion9
Example:
Router(config)# ip flow-export version 9
(Optional) Enables the export of information in NetFlow cache entries.
The
version9keyword specifies that the export packet uses the Version 9 format.
Caution
Entering this command on a Cisco 12000 Series Internet Router causes packet forwarding to stop for a few seconds while NetFlow reloads the route processor and line card CEF tables. To avoid interruption of service to a live network, apply this command during a change window, or include it in the startup-config file to be executed during a router reboot.
Step 6
interfaceinterface-typeinterface-number
Example:
Router(config)# interface ethernet 0/0
(Required) Specifies the interface that you want to enable NetFlow on and enters interface configuration mode.
Step 7
ipflow {ingress |
egress}
Example:
Router(config-if)# ip flow ingress
(Required) Enables NetFlow on the interface.
ingress--Captures traffic that is being received by the interface.
egress--Captures traffic that is being transmitted by the interface.
Step 8
exit
Example:
Router(config-if)# exit
(Optional) Exits interface configuration mode and returns to global configuration mode.
Note
You only need to use this command if you want to enable NetFlow on another interface.
Step 9
Repeat Steps 6 through 8 to enable NetFlow on other interfaces
(Optional) --
Step 10
end
Example:
Router(config-if)# end
(Required) Exits the current configuration mode and returns to privileged EXEC mode.
Verifying That NetFlow Is Operational and View NetFlow Statistics
To verify that NetFlow is working properly, perform this optional task.
SUMMARY STEPS
1.showipflowinterface
2.showipcacheflow
3.showipcacheverboseflow
DETAILED STEPS
Step 1
showipflowinterface
Use this command to display the NetFlow configuration for an interface. The following is sample output from this command:
Example:
Router# show ip flow interface
Ethernet0/0
ip flow ingress
Step 2
showipcacheflow
Use this command to verify that NetFlow is operational and to display a summary of the NetFlow statistics. The following is sample output from this command:
Use this command to verify that NetFlow is operational and to display a detailed summary of the NetFlow statistics. The following is sample output from this command:
To verify that NetFlow data export is operational and to view the statistics for NetFlow data export perform the step in this optional task.
SUMMARY STEPS
1.showipflowexport
DETAILED STEPS
showipflowexport
Use this command to display the statistics for the NetFlow data export, including statistics for the main cache and for all other enabled caches. The following is sample output from this command:
Example:
Router# show ip flow export
Flow export v9 is enabled for main cache
Exporting flows to 172.16.10.2 (99)
Exporting using source interface Ethernet0/0
Version 9 flow records
0 flows exported in 0 udp datagrams
0 flows failed due to lack of export packet
0 export packets were sent up to process level
0 export packets were dropped due to no fib
0 export packets were dropped due to adjacency issues
0 export packets were dropped due to fragmentation failures
0 export packets were dropped due to encapsulation fixup failures
Configuration Examples for Configuring NetFlow and NetFlow Data Export
The following example shows how to configure Egress NetFlow Accounting:
configure terminal
!
interface ethernet 0/0
ip flow egress
!
Example Configuring NetFlow Subinterface Support
NetFlow Subinterface Support For Ingress (Received) Traffic On a Subinterface
configure terminal
!
interface ethernet 0/0.1
ip flow ingress
!
NetFlow SubInterface Support For Egress (Transmitted) Traffic On a Subinterface
configure terminal
!
interface ethernet 1/0.1
ip flow egress
!
Note
NetFlow performs additional checks for the status of each subinterface that requires more CPU processing time and bandwidth. If you have several subinterfaces configured and you want to configure NetFlow data capture on all of them, we recommend that you configure NetFlow on the main interface instead of on the individual subinterfaces.
Example Configuring NetFlow Multiple Export Destinations
The following example shows how to configure NetFlow multiple export destinations:
configure terminal
!
ip flow-export destination 10.10.10.10 9991
ip flow-export destination 172.16.10.2 9991
!
Note
You can configure a maximum of two export destinations for the main cache and for each aggregation cache.
Example Configuring NetFlow and NetFlow Data Export Using the Version 9 Export Format
The following example shows how to configure NetFlow and NetFlow data export using the Version 9 export format:
configure terminal
!
ip flow-export destination 10.10.10.10 9991
ip flow-export version 9
!
Example Configuring NetFlow for Analyzing PPPoE Session Traffic
If you want to obtain accurate NetFlow traffic statistics for PPPoE sessions, you must configure NetFlow on the virtual-template interface, not on the physical interface that is configured with VLAN encapsulation. For example, if you configure NetFlow on the physical interface that is configured for VLAN encapsulation as shown in the following configuration, the NetFlow traffic statistics will not be an accurate representation of the traffic on the PPPoE sessions.
The following example shows how to configure egress NetFlow on a virtual template interface so that you can accurately analyze the packet size distribution statistics of the traffic that the router is sending to the end user over the PPoE session:
interface Virtual-Template 1
ip unnumbered ethernet 0
encapsulation ppp
ip flow egress
The following display output from the showipcacheflow command shows that this PPPoE session traffic is comprised primarily of 1536-byte packets.
No new or modified RFCs are supported, and support for existing RFCs has not been modified .
--
Technical Assistance
Description
Link
The Cisco Support and Documentation website provides online resources to download documentation, software, and tools. Use these resources to install and configure the software and to troubleshoot and resolve technical issues with Cisco products and technologies. Access to most tools on the Cisco Support and Documentation website requires a Cisco.com user ID and password.
Feature Information for Configuring NetFlow and NetFlow Data Export
The following table provides release information about the feature or features described in this module. This table lists only the software release that introduced support for a given feature in a given software release train. Unless noted otherwise, subsequent releases of that software release train also support that feature.
Use Cisco Feature Navigator to find information about platform support and Cisco software image support. To access Cisco Feature Navigator, go to
www.cisco.com/go/cfn. An account on Cisco.com is not required.
Table 1
Feature Information for Configuring NetFlow and NetFlow Data Export
Feature Name
Releases
Feature Configuration Information
Egress NetFlow Accounting
12.3(11)T 15.0(1)S
The Egress NetFlow Accounting feature allows NetFlow statistics to be gathered on egress traffic that is exiting the router. Previous versions of NetFlow allow statistics to be gathered only on ingress traffic that is entering the router.
The following commands were introduced by this feature:
ipflowegress and
ipflow-egressinput-interface.
The following commands were modified by this feature:
flow-sampler,
match,
showipcacheflow,
showipcacheverboseflow, and
showipflowinterface.
NetFlow Multiple Export Destinations
12.0(19)S 12.2(2)T 12.2(14)S 15.0(1)S
The NetFlow Multiple Export Destinations feature enables configuration of multiple destinations of the NetFlow data.
The following commands were modified by this feature:
ipflow-aggregationcache,
ipflow-exportdestination, and
showipflowexport.
NetFlow Subinterface Support
12.0(22)S 12.2(14)S 12.2(15)T
The NetFlow Subinterface Support feature provides the ability to enable NetFlow on a per-subinterface basis.
The following command was introduced by this feature:
ipflowingress.
The following command was modified by this feature:
showipinterface.
The NetFlow v9 Export Format is flexible and extensible, which provides the versatility needed to support new fields and record types. This format accommodates new NetFlow-supported technologies such as Multicast, MPLS, NAT, and BGP next hop.
The following commands were modified by this feature:
debugipflowexport,
export,
ipflow-export, and
showipflowexport.
Glossary
AS--autonomous system. A collection of networks under a common administration sharing a common routing strategy. Autonomous systems are subdivided by areas. An autonomous system must be assigned a unique 16-bit number by the Internet Assigned Numbers Authority (IANA).
CEF--Cisco Express Forwarding. Layer 3 IP switching technology that optimizes network performance and scalability for networks with large and dynamic traffic patterns.
BGP--Border Gateway Protocol. An interdomain routing protocol that replaces Exterior Gateway Protocol (EGP). A BGP system exchanges reachability information with other BGP systems. BGP is defined by RFC 1163.
BGPnexthop--IP address of the next hop to be used by a router to reach a certain destination.
dCEF--distributed Cisco Express Forwarding. A type of CEF switching in which line cards (such as Versatile Interface Processor (VIP) line cards) maintain identical copies of the forwarding information base (FIB) and adjacency tables. The line cards perform the express forwarding between port adapters; this relieves the Route Switch Processor of involvement in the switching operation.
exportpacket--Type of packet built by a device (for example, a router) with NetFlow services enabled that is addressed to another device (for example, the NetFlow Collection Engine). The packet contains NetFlow statistics. The other device processes the packet (parses, aggregates, and stores information on IP flows).
fastswitching--Cisco feature in which a route cache is used to expedite packet switching through a router.
flow--A set of packets with the same source IP address, destination IP address, protocol, source/destination ports, and type-of-service, and the same interface on which the flow is monitored. Ingress flows are associated with the input interface, and egress flows are associated with the output interface.
MPLS--Multiprotocol Label Switching. An emerging industry standard for the forwarding of packets along a normally routed path (sometimes called MPLS hop-by-hop forwarding).
NetFlow--A Cisco IOS application that provides statistics on packets flowing through the router. It is emerging as a primary network accounting and security technology.
NetFlowAggregation--A NetFlow feature that lets you summarize NetFlow export data on an IOS router before the data is exported to a NetFlow data collection system such as the NetFlow Collection Engine. This feature lowers bandwidth requirements for NetFlow export data and reduces platform requirements for NetFlow data collection devices.
NetFlowCollectionEngine (formerly NetFlow FlowCollector)--Cisco application that is used with NetFlow on Cisco routers and Catalyst series switches. The NetFlow Collection Engine collects packets from the router that is running NetFlow and decodes, aggregates, and stores them. You can generate reports on various aggregations that can be set up on the NetFlow Collection Engine.
NetFlowv9--NetFlow export format Version 9. A flexible and extensible means for carrying NetFlow records from a network node to a collector. NetFlow Version 9 has definable record types and is self-describing for easier NetFlow Collection Engine configuration.
RP--Route Processor. A processor module in the Cisco 7000 series routers that contains the CPU, system software, and most of the memory components that are used in the router. Sometimes called a Supervisory Processor.
Cisco and the Cisco logo are trademarks or registered trademarks of Cisco and/or its affiliates in the U.S. and other countries. To view a list of Cisco trademarks, go to this URL:
www.cisco.com/go/trademarks. Third-party trademarks mentioned are the property of their respective owners. The use of the word partner does not imply a partnership relationship between Cisco and any other company. (1110R)
Any Internet Protocol (IP) addresses and phone numbers used in this document are not intended to be actual addresses and phone numbers. Any examples, command display output, network topology diagrams, and other figures included in the document are shown for illustrative purposes only. Any use of actual IP addresses or phone numbers in illustrative content is unintentional and coincidental.