Let's consider the following topology to configure IPFIX:
To monitor traffic, you must configure one or more and associate it to a and enable IPFIX on the interface either in egress or ingress direction. Optionally, you can configure a to set the sampling rate for flow samples.
Procedure
|
1. |
First, let's gather the required details to enable IPFIX on a router:
-
The IP address of the source : 2001:db8::0001
-
The IP address of the IPFIX Collector (Destination address): 2001:db8::0002
-
Interface of the router where we will enable IPFIX: HundredGigE 0/0/0/24
-
NetFlow version used to transport the data to the collector: IPFIX
|
|
2. |
Configure a Flow Exporter using the command to specify where and how the packets should be exported.
Router(config)# flow exporter-map fem_ipfix
Router(config-fem)# destination 2001:db8::0002
Router(config-fem)# source Loopback 0
Router(config-fem)# transport udp 9001
Router(config-fem)# exit
Router(config-fem)# version ipfix
Router(config-fem-ipfix)# template data timeout 600
Router(config-fem-ipfix)# options interface-table
Router(config-fem-ipfix)# exit
Verify the Flow Exporter configuration using the command.
Router#show exporter-map fem_ipfix
Flow Exporter Map : fem_ipfix
-------------------------------------------------
Id : 1
Packet-Length : 1468
DestinationIpAddr : 2001:db8::2
VRFName : default
SourceIfName :
SourceIpAddr : 2001:db8::3
DSCP : 0
TransportProtocol : UDP
TransportDestPort : 1024
Do Not Fragment : Not Enabled
Export Version: IPFIX
Common Template Timeout : 1800 seconds
Options Template Timeout : 1800 seconds
Data Template Timeout : 1800 seconds
Interface-Table Export Timeout : 1800 seconds
Sampler-Table Export Timeout : 0 seconds
VRF-Table Export Timeout : 0 seconds
|
|
3. |
Create a Flow Monitor using the command to define the type of traffic to be monitored. You can include one or more exporter maps in the monitor map. A single flow monitor map can support up to eight exporters.
The record type specifies the type of packets that are sampled as the packets pass through the router. MPLS, IPv4, and IPv6 packet sampling is supported.
Router(config)# flow monitor-map fmm1
Router(config-fmm)# record ipv6
Router(config-fmm)# option filtered
Router(config-fmm)# exporter fem_ipfix
Router(config-fmm)# cache entries 65535
Router(config-fmm)# cache timeout active 1800
Router(config-fmm)# cache timeout inactive 15
Router(config-fmm)# exit
Verify the Flow Monitor configuration using the command.
Router#show flow monitor-map fmm1
Flow Monitor Map : fmm1
-------------------------------------------------
Id: 1
RecordMapName: ipv6
ExportMapName: Expo1
CacheAgingMode: Normal
CacheMaxEntries: 500000
CacheActiveTout: 60 seconds
CacheInactiveTout: 20 seconds
CacheUpdateTout: N/A
CacheRateLimit: 2000
HwCacheExists: False
HwCacheInactTout: 50
|
|
4. |
Configure a Flow Sampler using the command. .Use the same sampler map configuration on the sub-interfaces and physical interfaces under a port.
Router(config)# configure
Router(config)# sampler-map fsm1
Router(config-sm)# random 1 out-of 4000
Router(config)# exit
Router(config)#commit
Router(config)#exit
Router#
Verify the sampler map configuration using the command.
Router#show sampler-map fsm1
Sampler Map : fsm1
-------------------------------------------------
Id: 1
Mode: Random (1 out of 4000 Pkts)
Router#
|
|
5. |
View the running configuration to verify the configuration that you have configured.
Router#show run
Thu Nov 9 06:40:07.296 UTC
Building configuration...
flow exporter-map fem_ipfix
version ipfix
options interface-table
template data timeout 600
!
transport udp 9001
source Loopback0
destination 2001:db8::2
!
flow monitor-map fmm1
record ipv6
option filtered
exporter fem_ipfix
cache entries 65535
cache timeout active 1800
cache timeout inactive 1
!
sampler-map fsm1
random 1 out-of 4000
!
interface FourHundredGigE0/0/0/1
shutdown
!
interface HundredGigE0/0/0/24
shutdown
flow ipv4 monitor fmm1 sampler fsm1 ingress
flow ipv6 monitor fmm-ipv6 sampler fsm1 ingress
!
end
|
|
6. |
Apply a Monitor Map and a Sampler Map to a physical interface using the command to enable IPFIX on the router.
Router(config)#interface HundredGigE 0/0/0/24
Router(config-if)#flow ipv4 monitor fmm1 sampler fsm1 ingress
Router(config-if)#exit
|