Limiting the number of concurrent sessions

Hi Folk

I want to limit the number of concurrent sessions to, say, 5. This means if there are 5 ongoing sessions at the moment and a user tries to open a new session, he gets rejected. How can I achieve that?

I just used google…
max 100 connection for every host ip (32 bit of netmask) :
Code: Select all

/ip firewall
add chain=forward protocol=tcp tcp-flags=syn connection-limit=100,32 action=drop comment=“connection limit” disabled=no
in this case , max 100 connection for every host ip (32 bit of netmask).

Duplicate for udp