How to give ICMP high priority in Mikrotik Router?

Hello again.. Many of my friends using mikrotik devices in their network complains that whenever users starts downloading anything ping to their gateway (Mikrotik NAS) becomes unexceptionally high and gradually results in “Request timed out”.

After inspection I found that whenever users uses 100% of their allotted bandwidth, since we have not assigned any QOS(Quality of Service) for ping (ICMP Protocol) the request drops.

For this we need to create some mangle rules for marking connection and packet for ICMP requests and ICMP reply separately and then assign a simple queue mentioning the packet mark assigning a fixed bandwidth (say 512 kbps) for it. Then we can see even if users download at full bandwidth, the ping will be <1 ms to 2 ms max.

But unfortunately, hotspot users still faces a problem as when they log in the ICMP queue is moved below and thus reduces its priority. There is also a simple solution to it as we can simply add a script in user profile which will move the ICMP queue to the top(position 0) each time an user logs in.

Thanks a lot to Mr. Syed Jahanzaib for his valuable inputs.


  1. From IP -> Firewall -> Mangle Create a rule for Chain Prerouting, protocol ICMP. (For ICMP Requests)


  2. In Action we will mark the connection and give a name – icmp-con.


  3. From IP -> Firewall -> Mangle Create a rule for Chain Postrouting, protocol ICMP. (For ICMP Reply)


  4. In Action we will mark the connection and give a name – icmp-con.


  5. Then again we will create a mangle rule for marking packets based on previously marked connections. First we will do it for prerouting chain.


  6. Then we will mark packets and give a name icmp-pkt.


  7. We will repeat the same for post routing chain.


  8. We will also mark the postrouting packets with same name.


  9. Check the order of the newly created rules. Make sure these rules are not blocked by any other mangle rules. It’s better to write them at the beginning.


  10. Create a queue with 512 kbps policy.


  11. Select packet mark as icmp-pkt and also select limit-at bandwidth.


  12. Make sure queue is at the top of any other queue.


  13. Create a script from System –> Scripts with the following source:
    /queue simple move [find name="ICMP"] [:pick [find] 0]


  14. Then goto IP –> Hotspot –> User Profile. Select the desired profile and under scripts add the following:
    /system script run moveICMP


That’s it! Your problem should be solved by now….

Happy Ping Pong!!!  😀

Enjoyed this post? Share it!

  • Ummar Hussain

    Great Srijit

  • Shankar Anand

    Great u really done a good job ji

  • Syed Jahanzaib

    Perhaps a copy paste code should also be added as reference for quick copy pasting. As being humans, We all love copy paste 🙂

    • Sure sir. Will add. Great work.

    • Gm Baloch

      syed jahanzaib bhai jaan ap ko code kam nhain kar rah hain lol

  • Vishal Sharma

    Great….. Thanks!!!!

  • jayraj salunkhe

    how to configure ipsec VPN on mikrotik router in gns3.