This document provides instructions for setting up a NetFlow collection and analysis system using Logstash, Elasticsearch, and Kibana. It explains what NetFlow is and discusses using Mikrotik routers and Logstash to collect NetFlow data. Logstash would process and index the NetFlow data into Elasticsearch for storage. Kibana could then be used to visualize and analyze the NetFlow data from Elasticsearch. The document concludes by providing step-by-step configuration instructions for Logstash, Elasticsearch, and Kibana to enable NetFlow collection, storage, and analysis.
2. What is NetFlow?
1. NetFlow is a feature that was introduced on Cisco routers that provides the ability to
collect IP network traffic as it enters or exits an interface.
2. NetFlow have a several versions from 1 to 10, but the comon is only v5 and v9.
3. The idea was that the first packet of a flow would create a NetFlow switching record. This
record would then be used for all later packets of the same flow, until the expiration of
the flow. Only the first packet of a flow would require an investigation of the route table
to find the most specific matching route.
4. NetFlow v5 content
Bytes Contents Description
0-3 srcaddr Source IP address
4-7 dstaddr Destination IP address
8-11 nexthop IP address of next hop router
12-13 input SNMP index of input interface
14-15 output SNMP index of output interface
16-19 dPkts Packets in the flow
20-23 dOctets
Total number of Layer 3 bytes in the
packets of the flow
24-27 first SysUptime at start of flow
28-31 last
SysUptime at the time the last packet
of the flow was received
32-33 srcport
TCP/UDP source port nr or
equivalent
34-35 dstport
TCP/UDP dest port nr or
equivalent
36 pad1 Unused (zero) bytes
37 tcp_flags Cumulative OR of TCP flags
38 prot IP protocol type
39 tos IP type of service (ToS)
40-41 src_as
Autonomous system number of the
source, either origin or peer
42-43 dst_as
Autonomous system number of the
destination, either origin or peer
44 src_mask Source address prefix mask bits
45 dst_mask Destination address prefix mask bits
46-47 pad2 Unused (zero) bytes
5. Mikrotik as NetFlow Exporter?!
1. SIA Mikrotīkls, as MikroTik - Latvian manufacturer of computer hardware.
2. The main product is a Linux-based operating system known as MikroTik RouterOS.
3. It allows you to change any PC computer (including machines in MIPS and PowerPC) fully
functional router.
4. Remote administration from using the program WinBox
6. Logstash as NetFlow Collector?!
Process Any Data, From Any Source
1. Centralize data processing of all types
2. Normalize varying schema and formats
3. Quickly extend to custom log formats
4. Easily add plugins for custom data sources
The recent Logstash 2.2 release is powered by a new and improved, next-generation pipeline
backbone, enables dynamic watermarking for JDBC input queries, supports compressed HTTP input
requests, and is compatible with the latest versions of Elasticsearch and Beats.
7. ElasticSearch as storage?!
1. Object Json DB
2. Real-Time Data
3. High Availability
4. Full-Text Search
5. RESTful API
6. Massively Distributed
8. Kibana as Analyzer?!
Open Source
Easy Setup
Integration with Elasticsearch
Data visualization platform
GeoIP
Easy to Share
Simple Data Export
Data from Many Sources