We are facing issue of flooding so i need script in which if any user request comes more then 10 times or example 50 times in 10sec or in 1 sec that mac address should require to be in firewall
so is there any rule or script which can help me to prevent from flooding
If you are looking to filter by MAC, then you will need a script to further process the results produced similar to above:
create a firewall filter rule that contains the matcher criteria you require (i.e. connection-limit, limit, dst-limit or psd) with an action=add-src-to-address-list
create a scheduler script to process the address list entries and convert them into Firewall filters for each mac-address, schedule this for a frequency that meets your needs (maybe 1 minute), which contains:
create another scheduler script to cleanup the firewall mac filter entries (lest the filters list grow too large, they will have additional filters automatically created if the flood is still active), schedule this for the beginning of every hour, which contains:
:local currenthour [:pick [/system clock get time] 1 2]
/ip firewall filter remove [find comment="Remove at hour: $currenthour"]
The above examples are not complete, you still need to update them with correct matching criteria, list names, etc. The mac-address method seems overly complex and resource intensive. Great justification why this is more important than IP filtering would need to be considered.