{"id":664,"date":"2016-03-17T14:33:36","date_gmt":"2016-03-17T13:33:36","guid":{"rendered":""},"modified":"2018-10-31T22:13:28","modified_gmt":"2018-10-31T21:13:28","slug":"configuring-netflow-cisco-asa","status":"publish","type":"post","link":"https:\/\/nil.uniza.sk\/en\/configuring-netflow-cisco-asa\/","title":{"rendered":"Configuring Netflow on a Cisco ASA"},"content":{"rendered":"<p>\n\tASA supports netflow exports against some of Netflow collectors, for example ntopng.&nbsp;<\/p>\n<p>\n\tHere I&#39;m describing steps required to configure netflow statistical export using ASA CLI.<\/p>\n<h2>\n\tPrerequisities and notes<\/h2>\n<ul>\n<li>\n\t\ttested on ASA 5515-X, ASA OS version&nbsp;8.6(1)2<\/li>\n<li>\n\t\tto see some outputs, &nbsp;kind of netflow collector software is required. I&#39;m using ntopng downloadable from www.ntop.org<\/li>\n<\/ul>\n<h2>\n\tLinks<\/h2>\n<ul>\n<li>\n\t\t<a href=\"http:\/\/www.draware.dk\/fileadmin\/SolarWinds\/Guide\/How_to_configure_Netflow_on_a_Cisco_ASA.pdf\">http:\/\/www.draware.dk\/fileadmin\/SolarWinds\/Guide\/How_to_configure_Netflow_on_a_Cisco_ASA.pdf<\/a><\/li>\n<li>\n\t\t<a href=\"http:\/\/www.cisco.com\/c\/en\/us\/td\/docs\/security\/asa\/special\/netflow\/guide\/asa_netflow.html#26619\">Cisco ASA NetFlow Implementation Guide<\/a><\/li>\n<\/ul>\n<h1>\n\tConfiguration<\/h1>\n<p>\n\tTo configure netflow export we must apply at least followig commands:<\/p>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t1. Configure the flow export<\/p>\n<pre>\r\n<b class=\"cBold\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; color: rgb(82, 82, 82); overflow-x: auto; overflow-y: hidden;\">flow-export&nbsp;<\/b><span class=\"cExBold\" style=\"margin: 0px; padding: 0px; border: 0px; font-weight: bold; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">destination<\/span><span style=\"color: rgb(82, 82, 82); font-family: 'Courier New', Courier, mono; font-size: 14px; line-height: 20.16px;\">&nbsp;<\/span><em class=\"cExItalic\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">interface-name ipv4-address&nbsp;<\/em><span style=\"color: rgb(82, 82, 82); font-family: 'Courier New', Courier, mono; font-size: 14px; line-height: 20.16px;\">|&nbsp;<\/span><em class=\"cExItalic\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">hostname udp-port<\/em><\/pre>\n<p>\n\tin my case&nbsp;<\/p>\n<pre>\r\nflow-export destination vlan255 192.168.255.19 6343<\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t2. No we will specify an access-list which will define an interesting traffic which will be exported<\/p>\n<pre>\r\naccess-list NAME ACL_TYPE ACTION PROTOCOL SOURCE WILDCARD DESTINATION WILDCARD <\/pre>\n<p>\n\tin my case i&#39;m wishing to export statistics about all flows<\/p>\n<pre>\r\naccess-list <span style=\"color:#ffa07a;\">ACL-NETFLOW-EXPORT<\/span> permit ip any any<\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t3. and then we define a class map which will test the traffic against above defined ACL<\/p>\n<pre>\r\nclass-map NAME_OF_FLOW_CLASS<\/pre>\n<p>\n\tin my case<\/p>\n<pre>\r\nclass-map<span style=\"color:#dda0dd;\"> <\/span><span style=\"color:#daa520;\">NETFLOW-EXPORT-CLASS<\/span><\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t4. and set a match condition<\/p>\n<pre>\r\nmatch access-list ACL-NAME<\/pre>\n<p>\n\tin my case&nbsp;<\/p>\n<pre>\r\nmatch access-list  <span style=\"color:#ffa07a;\">ACL-NETFLOW-EXPORT<\/span><\/pre>\n<p>\n\talternatively if we suppose to match any traffic, we do not need the ACL and then we may use <em>match any <\/em>statement<\/p>\n<pre>\r\nmatch any<\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t5. now we define a policy map to apply flow-export actions to the defined class. Enters policy map configuration mode and define a policy<\/p>\n<p>\n\t<strong><span style=\"color:#ff0000;\">Note: <\/span><\/strong>check the note on step 8 to continue&#8230;.<\/p>\n<pre>\r\n<strike>\u200b<\/strike>policy-map NAME-of-EXPORT-POLICY<\/pre>\n<p>\n\tin my case<\/p>\n<pre>\r\npolicy-map <span style=\"color:#0000ff;\">NETFLOW-EXPORT-POLICY<\/span><\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t6. then map the netflow-export-class class to the defined netflow-policy policy.<\/p>\n<pre>\r\nclass NAME-OF-EXPORT-CLASS<\/pre>\n<p>\n\tin my case<\/p>\n<pre>\r\n<span style=\"color: rgb(218, 165, 32);\">class NETFLOW-EXPORT-CLASS<\/span><\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t7 . and within policy class define &nbsp;a flow-export action.<\/p>\n<pre>\r\n<b class=\"cCN_CmdName\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">flow-export event-type <\/b><em class=\"cExItalic\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">event-type<\/em><b class=\"cCN_CmdName\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\"> destination <\/b><em class=\"cExItalic\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">flow_export_host1<\/em><span style=\"color: rgb(82, 82, 82); font-family: 'Courier New', Courier, mono; font-size: 14px; line-height: 20.16px;\">[<\/span><em class=\"cEmphasis\" style=\"margin: 0px; padding: 0px; border: 0px; font-stretch: inherit; font-size: 14px; line-height: 20.16px; font-family: 'Courier New', Courier, mono; vertical-align: baseline; overflow-x: auto; overflow-y: hidden; color: rgb(82, 82, 82);\">flow_export_host2<\/em><span style=\"color: rgb(82, 82, 82); font-family: 'Courier New', Courier, mono; font-size: 14px; line-height: 20.16px;\">]<\/span><\/pre>\n<p>\n\tin my case<\/p>\n<pre>\r\nflow-export event-type all destination 192.168.255.19<\/pre>\n<p>\n\trepeating this steps (6-7) we may define several export classes.<\/p>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t8. and finally we apply the service policY to a global policy<\/p>\n<pre>\r\nservice-policy FLOW-EXPORT-POLICY global<\/pre>\n<p>\n\tin my case<\/p>\n<pre>\r\nservice-policy <span style=\"color: rgb(0, 0, 255); font-size: 12px; background-color: rgb(238, 238, 238);\">NETFLOW-EXPORT-POLICY <\/span><span style=\"color:#000000;\"><span style=\"font-size: 12px; background-color: rgb(238, 238, 238);\">global<\/span><\/span><\/pre>\n<hr \/>\n<p>\n\t<strong>Note:<\/strong><\/p>\n<p>\n\t<em><strong>Please, make an attention,<\/strong>&nbsp;ASA does not allow to have more as the one global policy, and depends on the configuration some global policy can be already present and exists there. Please check it<\/em><\/p>\n<pre>\r\nkis-asa-5515X# sh run | begin service-policy\r\nservice-policy global_policy global\r\n...\r\n...<\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t<em>If there is one, applying your new policy as a new global policy you will get follwoing error message:&nbsp;<\/em><\/p>\n<pre>\r\nERROR: Policy map global_policy is already configured as a service policy<\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\ttherefore we need to map the class with existing global policy<\/p>\n<pre>\r\npolicy-map global_policy\r\n   class NETFLOW-EXPORT-CLASS\r\n      flow-export event-type all destination 192.168.255.19<\/pre>\n<hr \/>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t&nbsp;<\/p>\n<p>\n\tOptionally we may configure some additional tasks<\/p>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t9. set up an export time interval, default is 1.min<\/p>\n<pre>\r\nflow-export template timeout-rate SECONDS<\/pre>\n<p>\n\tI will keep it on default value.<\/p>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t10. or to set up an export time, which will instruct ASA to export short (shorter as defined time interval) and identical flows as a single flow<\/p>\n<pre>\r\nflow-export delay flow-create SECONDS<\/pre>\n<p>\n\tin my case 10 second<\/p>\n<pre>\r\nflow-export delay flow-create 10<\/pre>\n<p>\n\t&nbsp;<\/p>\n<p>\n\t11.&nbsp;To disable and reenable NetFlow-related syslog messages that have become redundant<\/p>\n<pre>\r\nlogging flow-export-syslogs disable<\/pre>\n<p>\n\t&nbsp;<\/p>\n<h2 id=\"Configurations\">\n\tFinal configuration<\/h2>\n<h2>\n\tversion 1 &#8211; no existing global policy<\/h2>\n<pre>\r\nflow-export destination vlan255 192.168.255.19 6343\r\naccess-list ACL-NETFLOW-EXPORT permit ip any any\r\n\r\nclass-map NETFLOW-EXPORT-CLASS\r\n   match access-list  ACL-NETFLOW-EXPORT\r\n\r\npolicy-map NETFLOW-EXPORT-POLICY\r\n   class NETFLOW-EXPORT-CLASS\r\n      flow-export event-type all destination 192.168.255.19\r\n\r\nservice-policy NETFLOW-EXPORT-POLICY global\r\nflow-export delay flow-create 15\r\nlogging fl\u200bow-export-syslogs disable<\/pre>\n<p>\n\t&nbsp;<\/p>\n<h2>\n\tversion 2 &#8211; if there exist a global policy<\/h2>\n<p>\n\tfor example named as the <em>global_policy<\/em><\/p>\n<pre>\r\nflow-export destination vlan255 192.168.255.19 6343\r\naccess-list ACL-NETFLOW-EXPORT permit ip any any\r\n!\r\nclass-map NETFLOW-EXPORT-CLASS\r\n   match access-list  ACL-NETFLOW-EXPORT\r\n!\r\npolicy-map global_policy\r\n   class NETFLOW-EXPORT-CLASS\r\n      flow-export event-type all destination 192.168.255.19\r\n!\r\n! not needed to apply it again\r\n! service-policy NETFLOW-EXPORT-POLICY global\r\n!\r\nflow-export delay flow-create 15\r\nlogging fl\u200bow-export-syslogs disable<\/pre>\n<p>\n\t&nbsp;<\/p>\n<h2>\n\tVerification and tshooting<\/h2>\n<p>\n\tshow flow-export counters<\/p>\n<p>\n\tshow service-policy global flow ip host [source IP] host [dest IP]<\/p>\n<p>\n\tshow access-list flow_export_acl<\/p>","protected":false},"excerpt":{"rendered":"<p>\n\tASA supports netflow exports against some of Netflow collectors, for example ntopng.&nbsp;<\/p>\n<p>\n\tHere I&#39;m describing steps required to configure netflow statistical export using ASA CLI.<\/p>","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[749],"tags":[],"class_list":["post-664","post","type-post","status-publish","format-standard","hentry","category-asa-en"],"taxonomy_info":{"category":[{"value":749,"label":"ASA"}]},"featured_image_src_large":false,"author_info":{"display_name":"admin","author_link":"https:\/\/nil.uniza.sk\/en\/author\/admin\/"},"comment_info":10,"category_info":[{"term_id":749,"name":"ASA","slug":"asa-en","term_group":0,"term_taxonomy_id":747,"taxonomy":"category","description":"","parent":747,"count":5,"filter":"raw","cat_ID":749,"category_count":5,"category_description":"","cat_name":"ASA","category_nicename":"asa-en","category_parent":747}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/664","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/comments?post=664"}],"version-history":[{"count":0,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/posts\/664\/revisions"}],"wp:attachment":[{"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/media?parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/categories?post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nil.uniza.sk\/en\/wp-json\/wp\/v2\/tags?post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}