How to limit internet bandwidth usage on Mikrotik router

Author Topic: How to limit internet bandwidth usage on Mikrotik router  (Read 4218 times)

Offline Mahbub

  • Moderator
  • Newbie
  • *****
  • Posts: 30
    • View Profile
How to limit internet bandwidth usage on Mikrotik router
« on: April 25, 2013, 05:00:22 PM »
   
Problem:

Suppose that you have a Mikrotik router which is routing both LAN and Internet packets. You want to limit the Internet bandwidth on some ports. On Mikrotik you can use Simple Queues to limit Both Transmit and Receive bandwidth. But there is no direct option in the Queue settings to limit just the Internet bandwidth, and whole network bandwidth including LAN will be limited on the configured ports.

Solution:

There is a table in the firewall section named Mangle. One of the usages of  this table is  marking packets. In other words you can assign a label to packets according to desired rule. This will help you to make further decisions whole around the Firewall/Router.

Mangle table can be used to solve the problem. you must add a rule to this Table. Telnet to the Mikrotik or use it's GUI/Web interfaces go to IP -> Firewall -> Mangle add a new rule with following settings:

    chain = prerouting
    action = mark-packet
    new-packet-mark = Internet
    passthrough = yes
    dst-address=!192.168.0.0/16

Here dst-address=!192.168.0.0/16 (Take note of the '!' mark at first) is a sample for your network. You must configure it based on you network settings. Also if you need to limit just some ports you must configure the Interface setting. Applying this rule will mark all packets whose destination is not to LAN.

After marking packets you can add a rule in the Simple Queue to limit bandwidth just for packets marked as Internet.