/ip fire mangle
add action=mark-packet chain=forward comment="Marcando Pacotes Sem Limite Conexao" disabled=no dst-port=21 new-packet-mark=semlimite passthrough=yes protocol=tcp
add action=mark-packet chain=forward disabled=no dst-port=22 new-packet-mark=semlimite passthrough=yes protocol=tcp src-
add action=mark-packet chain=forward disabled=no dst-port=23 new-packet-mark=semlimite passthrough=yes protocol=tcp src-
add action=mark-packet chain=forward disabled=no dst-port=25 new-packet-mark=semlimite passthrough=yes protocol=tcp src-
add action=mark-packet chain=forward disabled=no dst-port=53 new-packet-mark=semlimite passthrough=yes protocol=tcp src-
add action=mark-packet chain=forward disabled=no dst-port=80 new-packet-mark=semlimite passthrough=yes protocol=tcp src-
add action=mark-packet chain=forward disabled=no dst-port=110 new-packet-mark=semlimite passthrough=yes protocol=tcp
add action=mark-packet chain=forward disabled=no dst-port=443 new-packet-mark=semlimite passthrough=yes protocol=tcp
add action=mark-packet chain=forward disabled=no dst-port=587 new-packet-mark=semlimite passthrough=yes protocol=tcp
add action=mark-packet chain=forward disabled=no dst-port=8080 new-packet-mark=semlimite passthrough=yes protocol=tcp
/ip firewall filter
add action=drop chain=forward comment="Limitando numero conexoes simultaneas" connection-limit=25,32 disabled=no packet-mark=!semlimite protocol=tcp tcp-flags=syn