{"id":11887,"date":"2019-01-30T11:08:21","date_gmt":"2019-01-30T13:08:21","guid":{"rendered":"https:\/\/made4it.com.br\/netflow-configuration-on-juniper-routers\/"},"modified":"2023-03-09T14:56:07","modified_gmt":"2023-03-09T17:56:07","slug":"netflow-configuration-on-juniper-routers","status":"publish","type":"post","link":"https:\/\/made4it.com.br\/en\/netflow-configuration-on-juniper-routers\/","title":{"rendered":"Netflow Configuration on Juniper Routers"},"content":{"rendered":"\n<p>Hello<\/p>\n\n<p>Today we will break down how to configure your Juniper router to export Netflow (jFlow). At the end of the article is the configuration using IPFIX (Netflow v10).<\/p>\n\n<p>Here we have the Network topology and the Netflow Server information<\/p>\n\n<figure class=\"wp-block-image\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"362\" src=\"https:\/\/www.made4it.com.br\/wp-content\/uploads\/2019\/01\/netflow-1024x362.png\" alt=\"\" class=\"wp-image-708\" srcset=\"https:\/\/made4it.com.br\/wp-content\/uploads\/2019\/01\/netflow-1024x362.png 1024w, https:\/\/made4it.com.br\/wp-content\/uploads\/2019\/01\/netflow-300x106.png 300w, https:\/\/made4it.com.br\/wp-content\/uploads\/2019\/01\/netflow-768x272.png 768w, https:\/\/made4it.com.br\/wp-content\/uploads\/2019\/01\/netflow.png 1066w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>Netflow topology and information<\/figcaption><\/figure>\n\n<p>These are the steps needed to configure a Juniper Router to export Netflow v5<\/p>\n\n<ol class=\"wp-block-list\"><li>Configure the NTP Server<\/li><li>Configuring Forwarding Options with Sampling Rate<\/li><li>Configure the Host that will receive the Flows coming from the Router<\/li><li>Configure the interface to enable Netflow on the interface<\/li><\/ol>\n\n<p>Let&#8217;s go to the step-by-step configuration<\/p>\n\n<ol class=\"wp-block-list\"><li>Configure the NTP Server<\/li><\/ol>\n\n<p>It is important to configure an NTP Server because the Flows data uses timestamp according to the router&#8217;s time. If the router has a different time than the server, the data will not agree with the time, generating a mismatch of information.<br\/><br\/>It is important that you configure at least 2 NTP servers and also your router&#8217;s timezone.<\/p>\n\n<pre class=\"wp-block-preformatted\">## Using the Servers of the a.ntp.br and b.ntp.br<br\/>set system ntp server 200.160.0.8<br\/>set system ntp server 200.189.40.8<br\/><br\/>## Setting the Time-Zone<br\/>set system time-zone America\/Sao_Paulo<br\/><br\/>## Default way to view the Juniper configuration<br\/>guilherme@vMX-BGP&gt; show configuration system<br\/>system {  <br\/>  time-zone America\/Sao_Paulo;<br\/><br\/><br\/>  ntp {<br\/>  server 200.160.0.8;<br\/>  server 200.189.40.8;<br\/>  }<br\/>}<\/pre>\n\n<p>2. Configure Forwarding Options with the Sampling Rate<\/p>\n\n<p>The sampling rate to avoid overloading the CPU of your Routing Engine, it creates a sample of the traffic and exports it, so the Netflow system can receive the data and apply a multiplication factor to make the data real numbers.<br\/><br\/>To configure, use the commands. The ideal value of the rate depends on how much traffic you use, a tip is important is to use values above 200 and analyze the CPU of your router.<\/p>\n\n<pre class=\"wp-block-preformatted\">## Applying the Rate value to 500<br\/>set forwarding-options sampling input rate 500<br\/><br\/>## Juniper display form without display-set<br\/>forwarding-options {<br\/>  sampling {<br\/>  input {<br\/>  rate 500;<br\/>  }<br\/><\/pre>\n\n<p>3. Configure the Host that will receive the Flows coming from the Router<\/p>\n\n<p>To configure your router to export Netflow it is necessary to inform it which IP address the server will receive the flows and which UDP port it will receive this traffic on.<br\/><br\/>To do this use the commands:<\/p>\n\n<pre class=\"wp-block-preformatted\">## Exporting to IP 192.168.210.47 on port 2055 and using netflow version 5<br\/>set forwarding-options sampling family inet output flow-server 192.168.210.47 port 2055<br\/>  set forwarding-options sampling family inet output flow-server 192.168.210.47 version 5<br\/><br\/>## Show Preview without display set<br\/>guilherme@vMX-BGP&gt; show configuration forwarding-options<br\/>  sampling {<br\/>  family inet {<br\/>  output {<br\/>  flow-server 192.168.210.47 {<br\/>  port 2055;<br\/>  version 5;<br\/>  }<br\/>  }<br\/>  }<br\/>  }<br\/><\/pre>\n\n<p>4. Configure the interface to enable Netflow on the interface<\/p>\n\n<p>After setting the sampling rate and the flow server it is still necessary to activate Netflow on the interfaces where it will generate the data. Remember that it is necessary to configure the command inside each unit.<br\/><br\/>To do this, configure the interfaces inside each unit with the following command:<\/p>\n\n<pre class=\"wp-block-preformatted\">### Apply the sampling input command<br\/>  set interfaces ge-0\/0\/1 unit 0 family inet sampling input<br\/><\/pre>\n\n<p>The complete configuration looks like this:<\/p>\n\n<pre class=\"wp-block-preformatted\">guilherme@vMX-BGP&gt; show configuration | display set<br\/>  set system time-zone America\/Sao_Paulo<br\/>  set system ntp server 200.160.0.8<br\/>  set system ntp server 200.189.40.8<br\/> <br\/>set interfaces ge-0\/0\/0 description \"Talk to Netflow<br\/>  set interfaces ge-0\/0\/0 unit 0 family inet address 192.168.210.49\/24<br\/> <br\/>set interfaces ge-0\/0\/1 description \"WAN INTERFACE - IP TRANSIT<br\/>  set interfaces ge-0\/0\/1 unit 0 family inet sampling input<br\/>  set interfaces ge-0\/0\/1 unit 0 family inet address 200.200.200.1\/30<br\/> <br\/>set forwarding-options sampling input rate 500<br\/>  set forwarding-options sampling family inet output flow-server 192.168.210.47 port 2055<br\/>  set forwarding-options sampling family inet output flow-server 192.168.210.47 version 5<br\/><br\/><br\/>## Juniper Show Shape<br\/>guilherme@vMX-BGP&gt; show configuration<br\/>  Last commit: 2019-01-30 13:30:01 BRST by guilherme<br\/>  version 17.1R2.7;<br\/>  system {<br\/>  host-name vMX-BGP;<br\/>  time-zone America\/Sao_Paulo;<br\/>  ntp {<br\/>  server 200.160.0.8;<br\/>  server 200.189.40.8;<br\/>  }<br\/>  }<br\/>  interfaces {<br\/>  ge-0\/0\/0 {<br\/>  description \"Talk to Netflow\";<br\/>  unit 0 {<br\/>  family inet {<br\/>  address 192.168.210.49\/24;<br\/>  }<br\/>  }<br\/>  }<br\/>  ge-0\/0\/1 {<br\/>  description \"WAN INTERFACE - IP TRANSIT\";<br\/>  unit 0 {<br\/>  family inet {<br\/>  sampling {<br\/>  input;<br\/>  }<br\/>  address 200.200.200.1\/30;<br\/>  }<br\/>  }<br\/>  }<br\/>  }<br\/>  forwarding-options {<br\/>  sampling {<br\/>  input {<br\/>  rate 500;<br\/>  }<br\/>  family inet {<br\/>  output {<br\/>  flow-server 192.168.210.47 {<br\/>  port 2055;<br\/>  version 5;<br\/>  }<br\/>  }<br\/>  }<br\/>  }<br\/>  }<br\/><\/pre>\n\n<p>To make it even easier we have the video demonstrating the configuration of each command applied in this tutorial<\/p>\n\n<figure class=\"wp-block-embed aligncenter is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe title=\"Configura\u00e7\u00e3o de Netflow - Jflow em Roteadores Juniper\" width=\"800\" height=\"450\" src=\"https:\/\/www.youtube.com\/embed\/VIWQZISAbqM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><figcaption>Netflow configuration on Juniper<\/figcaption><\/figure>\n\n<p>As a bonus we will post the IPFIX configuration for some types of routers<\/p>\n\n<h4 class=\"wp-block-heading\">Juniper MX204<\/h4>\n\n<p>The configuration for routers like the MX204, you can use IPFIX (Netflow v10). To configure on MX204 use the commands, changing the Flow-server and source address IP&#8217;s.<\/p>\n\n<pre class=\"wp-block-preformatted\">  set services flow-monitoring version-ipfix template MADE4FLOW flow-active-timeout 60<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW flow-inactive-timeout 15<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW template-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW option-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW ipv4-template<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 flow-active-timeout 60<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 flow-inactive-timeout 15<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 template-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 option-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 ipv6-template<br\/>  set chassis fpc 0 sampling-instance MADE4FLOW<br\/>  set chassis fpc 0 inline-services flow-table-size ipv4-flow-table-size 10<br\/>  set chassis fpc 0 inline-services flow-table-size ipv6-flow-table-size 5<br\/>  set forwarding-options sampling instance MADE4FLOW input rate 1000<br\/>  set forwarding-options sampling instance MADE4FLOW input run-length 0<br\/>  set forwarding-options sampling instance MADE4FLOW input max-packets-per-second 10000<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-inactive-timeout 15<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-active-timeout 60<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-server 10.1.1.1 port 2055<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-server 10.1.1.1 autonomous-system-type origin<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-server 10.1.1.1 version-ipfix template MADE4FLOW<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output inline-jflow source-address 10.1.1.2<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-inactive-timeout 15<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-active-timeout 60<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-server 10.1.1.1 port 2055<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-server 10.1.1.1 autonomous-system-type origin<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-server 10.1.1.1 version-ipfix template MADE4FLOW-v6<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output inline-jflow source-address 10.1.1.2<br\/><br\/>### On each interface and each unit add the commands<br\/>  set interfaces xe-2\/0\/0 unit 151 family inet sampling input<br\/>  set interfaces xe-2\/0\/0 unit 151 family inet6 sampling input<br\/><\/pre>\n\n<hr class=\"wp-block-separator\"\/>\n\n<h4 class=\"wp-block-heading\">Juniper MX104<\/h4>\n\n<p>To configure the Juniper MX104 use the commands below. Remember that MX104 only supports exporting to 1 Netflow Server with IPFIX.<\/p>\n\n<pre class=\"wp-block-preformatted\">  set services flow-monitoring version-ipfix template MADE4FLOW flow-active-timeout 60<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW flow-inactive-timeout 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW template-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW option-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW ipv4-template<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 flow-active-timeout 60<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 flow-inactive-timeout 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 template-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 option-refresh-rate seconds 30<br\/>  set services flow-monitoring version-ipfix template MADE4FLOW-v6 ipv6-template<br\/>  set forwarding-options sampling instance MADE4FLOW input rate 500<br\/>  set forwarding-options sampling instance MADE4FLOW input run-length 0<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-inactive-timeout 15<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-active-timeout 60<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-server 10.1.1.1 port 2055<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output flow-server 10.1.1.1 version-ipfix template MADE4FLOW<br\/>  set forwarding-options sampling instance MADE4FLOW family inet output inline-jflow source-address 10.1.1.2<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-inactive-timeout 15<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-active-timeout 60<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-server 10.1.1.1 port 2055<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output flow-server 10.1.1.1 version-ipfix template MADE4FLOW-v6<br\/>  set forwarding-options sampling instance MADE4FLOW family inet6 output inline-jflow source-address 10.1.1.2<br\/>  set chassis afeb slot 0 sampling-instance MADE4FLOW<br\/><br\/>  ## On each interface of your router use the commands<br\/>  set interfaces xe-2\/0\/0 unit 151 family inet sampling input<br\/>  set interfaces xe-2\/0\/0 unit 151 family inet6 sampling input<\/pre>\n\n<p>If you have a router not mentioned here, please send an email to comercial@made4it.com.br and we will send you the settings.<br\/><br\/>I hope I have helped you and until next time.<br\/><br\/>Big hug.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello Today we will break down how to configure your Juniper router to export Netflow (jFlow). At the end of the article is the configuration using IPFIX (Netflow v10). Here we have the Network topology and the Netflow Server information These are the steps needed to configure a Juniper Router to export Netflow v5 Configure [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":8414,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"footnotes":""},"categories":[317,327,296,352],"tags":[692,693,694,695,696,697,698,330,699,332,333],"class_list":["post-11887","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-made4flow","category-netflow-en","category-network","category-uncategorized-en","tag-how-to-configure-netflow-on-juniper","tag-how-to-configure-netflow-on-juniper-mx","tag-how-to-configure-netflow-on-mx204","tag-ipfix-en","tag-ipfix-mx204-en","tag-jflow-en","tag-jflow-juniper-en","tag-netflow-en","tag-netflow-juniper-en","tag-netflow-v5-en","tag-netflow-v9-en"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts\/11887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/comments?post=11887"}],"version-history":[{"count":0,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/posts\/11887\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/media\/8414"}],"wp:attachment":[{"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/media?parent=11887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/categories?post=11887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/made4it.com.br\/en\/wp-json\/wp\/v2\/tags?post=11887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}