You can perform Juniper router Flow configuration using the following steps:
Three maps have to configured to enable NetFlow on these routers
1) Exporter Map
2) Sampler Map
3) Flow Monitor Map
router(config)# flow exporter-map NFAEM
router(config-NFAEM )# destination 192.168.1.1
router(config-NFAEM )# source gi0/0
router(config-NFAEM )# transport udp 9996
router(config-NFAEM )# version v9
router(config-NFAEM-ver)# template data timeout 60
router(config-NFAEM -ver)# options interface-table timeout 60
router(config-NFAEM -ver)# exit
router(config)# sampler-map NFASM
router(config-NFASM )# random 1 out-of 65535
router(config)# exit
Note that the Exporter Map you created earlier is associated to the Flow Monitor map.
outer(config)# flow monitor-map NFAMM
router(config-NFAMM)# record ipv4 –>Configure the flow record map name for IPv4, IPv6, or MPLS. Use the ipv4-ipv6-fields keyword to collect IPv4 and IPv6 fields in an MPLS-aware NetFlow.
router(config-NFAMM)# exporter NFAEM –> Use the name you used for Exporter Map here
router(config-NFAMM)# cache timeout active 60
router(config-NFAMM)# cache timeout inactive 15
router(config-NFAMM)# exit
The next step is to apply the Monitor Map and Sampler Map to all the active Interfaces. Go to each interface config mode and apply the command as below.
router(config)# interface Gi0/0
router(config-if)# flow ipv4 monitor NFAMM sampler NFASM ingress
router(config-if)# exit
You are done now. Go ahead and start monitoring.