A single rule is not enough because the
matcher matches on packets which are
below the packet-per-unit-of-time limit. So you have to create a custom chain (acting as a subroutine) which will return immediately for packets which do not exceed the packets-per-unit-of-time limit for a given source and destination and store the source address of those exceeding it to the address list before returning to the original chain. In the example, the custom chain itself does not care about the particular destination address and/or port, so it depends on you whether you shall add a
list to the last rule, which should be placed where you've intended to place your single rule to the
or
chain (using the
parameter). The dst-limit matcher measures the packet rates separately for packets characterized by a combination of properties, see
the manual for details and available property sets.
/ip firewall filter
add chain=limiter action=return dst-limit=10/5s,10,src-and-dst-addresses
add chain=limiter action=add-src-to-address-list address-list=syn-rate-exceeded
add chain=limiter action=return
add chain=forward action=jump jump-target=limiter protocol=tcp tcp-flags=syn in-interface=ether1 [dst-port=22,443 place-before=3]