According to this https://wiki.mikrotik.com/wiki/DDoS_Detection_and_Blocking the expire time has a bug so 10s is actually 1s. Can anyone please through some light if this is still the case? What is the expire value needed for in any case? I am trying to set a rule to drop and black list all udp traffic if over 6 packets per 8 seconds per IP but the expire value is a little confusing.
Even the newer version does not explain what the expire value is for and why would you want to use a 10s expire time for 32 packets/1s time frame. It still uses 10s without explaining why the expire value should be as such.
So the question remains, how do I drop and blacklist any traffic above 6 packets per 8 seconds? What would be the correct expire value for it and why?
Matches packets until a given rate is exceeded. Rate is defined as packets per time interval. As opposed to the limit matcher, every flow has it’s own limit. Flow is defined by mode parameter. Parameters are written in following format: count[/time],burst,mode[/expire].
count - packet count per time interval per flow to match
time - specifies the time interval in which the packet count per flow cannot be exceeded (optional, 1s will be used if not specified)
burst - initial number of packets per flow to match: this number gets recharged by one every time/count, up to this number
mode - this parameter specifies what unique fields define flow (src-address, dst-address, src-and-dst-address, dst-address-and-port, addresses-and-dst-port)
expire - specifies interval after which flow with no packets will be allowed to be deleted (optional)
Dropping traffic above 6 packets per 8 seconds means: dst-limit=6/8s
I think your doubt is about expire time. Maybe it is easier to understand with an example. Suppose that you receive this number of packets for a flow. Depending on expire time is 2s or 10s, the calculated rate is different.
UDP source addresses are trivially spoofed, using rules like this you turn a volumetric DDoS into a computational DDoS as your connection tables fill up and crash the router.
There are no magic rules to fix DDoS. If your bandwidth is lower than the incoming traffic then by the time it hits your router it is too late to do anything about it, your link is already saturated.