Community discussions

MikroTik App
 
cmurrayis
Member Candidate
Member Candidate
Topic Author
Posts: 106
Joined: Fri May 15, 2009 4:31 am

Traffic Flow Incorrect

Thu Jul 21, 2016 1:20 pm

Hi,

We are seeing issues with data recorded by Netflow.

Today we experienced a DDOS attack however was not alerted by our network monitoring as it seems to be reporting far less than is actually occurring.

Example:
Image
Image
Netflow Report:

ImageImage

This connect has been sitting at 150 - 200mbps for the last 3 hours however the netflow graphs does not reflect this and the bad thing we discovered is we bill from netflow data and it is not correct.

Example 2:

Customer 50mbps connection:

ImageImage

Netflow:

ImageImage

In example 1 the 160mbps is udp traffic going to the customer in example 2 who only has a 50mbps connection so we could not see this before the customer reported it.

Settings:

ImageImage

We are exporting version 5 and have tried specific interfaces.

Kind Regards
Image
 
pe1chl
Forum Guru
Forum Guru
Posts: 10234
Joined: Mon Jun 08, 2015 12:09 pm

Re: Traffic Flow Incorrect

Thu Jul 21, 2016 5:09 pm

Netflow exports session data.  Probably it will not export data about sessions that were never completely established.
When you want to monitor interface traffic, I suggest you do that instead of relying on lower-level detail like Netflow.
(with SNMP you can retrieve interface bytes in/out counters and when you do that once a minute you can compute
mean bitrate from that.  this is what traffic graphing software usually does)

In fact, you apparently already do that for graphing, just set an alert based on that info...
 
User avatar
Cha0s
Forum Guru
Forum Guru
Posts: 1142
Joined: Tue Oct 11, 2005 4:53 pm

Re: Traffic Flow Incorrect

Thu Jul 21, 2016 5:58 pm

Netflow exports session data.  Probably it will not export data about sessions that were never completely established.
This is not correct. NetFlow will account for every IP packet passing through the monitored interface(s). It will not account for non-IP traffic though.

NetFlow does not understand 'Established connections'. It understands Flows. A flow consists of packets with the same values:
https://en.wikipedia.org/wiki/NetFlow
A network flow can be defined in many ways. Cisco standard NetFlow version 5 defines a flow as a unidirectional sequence of packets that all share the following 7 values:

Ingress interface (SNMP ifIndex)
Source IP address
Destination IP address
IP protocol
Source port for UDP or TCP, 0 for other protocols
Destination port for UDP or TCP, type and code for ICMP, or 0 for other protocols
IP Type of Service
If an active flow is finished (only for TCP) it will export it to the NetFlow Collector. If an active flow exceeds its configured 'Active Timeout' it will be exported to the NetFlow Collector.
If the router doesn't see any packet for an active flow past its configured timeout it will consider it inactive and eventually will export it to the netflow collector (based again on the configured timeout values).
The router will output a flow record when it determines that the flow is finished. It does this by flow aging: when the router sees new traffic for an existing flow it resets the aging counter. Also, TCP session termination in a TCP flow causes the router to expire the flow. Routers can also be configured to output a flow record at a fixed interval even if the flow is still ongoing.
NetFlow on Mikrotik has a bug when the bytes counter for a single flow exceeds the 32bit unsigned value (~4.2billion bytes - ~4Gbytes) it will wrap the counter back to zero (0) without exporting the flow first. This results in missing traffic when the NetFlow collector processes the received flows.
I've documented this problem here http://forum.mikrotik.com/viewtopic.php ... ow#p509137
No solution yet.
IPFIX on v6.36rc also has bugs. I haven't tried 6.36 stable yet.

I am not sure if this has anything to do with the problem described by cmurrayis since usually DDoS attacks consist of many many packets and not long flows (that would exceed the 32bit octet counter).
When you want to monitor interface traffic, I suggest you do that instead of relying on lower-level detail like Netflow.
(with SNMP you can retrieve interface bytes in/out counters and when you do that once a minute you can compute
mean bitrate from that. this is what traffic graphing software usually does)
You cannot do IP Accounting/Billing using SNMP on a single interface. It's useful for monitoring purposes but not for Billing.

NetFlow with a solution like pmacct will account for each IP's traffic allowing to bill your clients based on their IP(s). It's really powerful and granular (while snmp is not). One downside is that NetFlow accounts for the ethernet payload data, not the ethernet headers. So there will be a small discrepancy between NetFlow and SNMP but this can be calculated/added afterwards.

When you have a trunk interface as cmurrayis has you cannot account for each client's traffic, only an aggregate of all clients behind that interface.

cmurrayis is it possible that your netflow collector drops some netflow packets thus accounting for less traffic than what's actually passing through?
NetFlow packets are UDP so they are 'fire and forget'. If something goes missing it's not being resent.
Since this is a DDoS it will cause netflow to export myriad of inactive flows every X seconds, so it stands to reason that your collector may not be processing all the flows properly (dropping udp packets)
 
cmurrayis
Member Candidate
Member Candidate
Topic Author
Posts: 106
Joined: Fri May 15, 2009 4:31 am

Re: Traffic Flow Incorrect

Fri Jul 22, 2016 12:40 am

Hi Fellas and thanks for the reply.

We use pmacct for billing and the data reported by it reflects that of the Netflow Analyzer.

I have some changes overnight and adjusted the Cache Entries to 1K which seems to have provided better readings however not ideal. We have recently replaced our core aging Cisco 2911 with a Mikrotik CCR and this is when the problem started to occur. With both Netflow Collectors showing similar results we do not believe this to be the issue as they are on separate hardware.

It does however appear to have been having issues with the UDP traffic inbound to the customer as the graph below shows yesterdays traffic and is pretty accurate to the SNMP aggregate for the interfaces on the router however after the blue line is where I dropped the Cache Entries down and you can see the end of the DDOS attack just before it stopped.

Image
 
patrick7
Member
Member
Posts: 343
Joined: Sat Jul 20, 2013 2:40 pm

Re: Traffic Flow Incorrect

Fri Jul 22, 2016 1:03 am

OT: Which netflow collector are you using?
 
cmurrayis
Member Candidate
Member Candidate
Topic Author
Posts: 106
Joined: Fri May 15, 2009 4:31 am

Re: Traffic Flow Incorrect

Tue Nov 08, 2016 2:39 am

Has there been a rectification of the Wrapper Counter yet?

Who is online

Users browsing this forum: No registered users and 93 guests