Saturday, June 24, 2017

Bandwidth Management on Mikrotik using Winbox

Bandwidth Management on Mikrotik using Winbox


Bandwidth Management on Mikrotik using Winbox

Bandwidth share with PCQ (Per Connection Queue) principally is using the queue method to specify the bandwidth usage on the multiple clients. PCQ in the Mikrotik router already installed by default and a program to manage internet traffic network QoS (Quality of Service ). The Method of  Bandwidth Management here in order to share bandwidth internet connection is equal among client that you have.

For example we have the internet connection bandwidth of 2000 kbps, and we want to share to 10 clients that will get the bandwidth allotted 2000/10 kbps = 200 kbps. and if  we have 5 client that use the internet will divide 2000/5 kbps = 400 kbps. When 10 client using at the time, at the peak condition will get bandwidth quota around 100 kbps each other. Ok lets practice this !

  • Assuming we have local network address 192.168.1.0/24 and the interface that connected to the local area network we called as "lan". and the interface that lead that led to the Internet Service Provider (ISP) we called as "public" (note it is up to you give the name of the interface, the function is just distinguish  where the name intranet and internet).
  • We will use Mikrotik Winbox to be interface software tool
  • We will create a firewall setting mark

1. Okay we begin from the First Command
/ip firewall mangle add chain=forward src-address=192.168.1.0/24 action=mark-connection new-connection-mark=NET1-CM
Go to Winbox and, select IP > firewall >Mangle tab then click on "+" button will shown as the picture below:

On the General tab as shown as the picture above fill Chain : with forward, and Src Address : with local network IP address (192.168.1.0/24). After that still on Mangle Rule go to Action tab, will shown as the picture below :


Fill the form fields as shown as the picture above! if you do was right the result can be seen by click on  IP > Firewall  as shown below!

2. The second command is
/ip firewall mangle add connection-mark=NET1-CM action=mark-packet new-packet-mark=NET1-PM chain=forward
in order to making mark packet
enter through IP > firewall > mangle tab then click on  "+" button


You just need to set up chain = forward and Connection Mark = NET1-CM, then go to the action tab


Completed the fields as the picture above, if you do was right, you can see the results by clicking again on IP > Firewall , as shown like the picture bellow :


3. The Third Command is Making queue types “with name of pcq_downstream”
/queue type add name=pcq_downsteam kind=pcq pcq-classifier=dst-address
Return to the main menu select Winbox Queues at Queue List select tab Queue Types then press button "+"

Completed the field as shown like the picture above!, Limit and Total Limit is depending on the ISP bandwidth that you have, in this case the internet connection that use is up to 2 mbps.

4. the Fourth Command is to make queue types “with name pcq_upstream”
/queue type add name=pcq_upstream kind=pcq pcq-classifier=src-address
Still on the main menu select Winbox Queues at Queue List select tab Queue Types then press "+"  button

 Just like downsteam, upsteam settings as above to adjust with your internet connection limitation totally

5. The Fifth Command is to make queue tree interface “lan”
/queue tree add parent=lan queue=pcq_downsteam packet-mark=NET1-PM
Starting from the main menu select Winbox again Queues at Queue List select tab Queue Three then press "+"  button
  
Adjust the settings as shown like the picture above, the difference is the Parent, depending on your internet connection of your ISP, if you do not know, you can see that by clicking on the menu Interface from the main menu Winbox

In this case the name of  lan interface is ether1, public interface is wlan1.  if you have already know, completed with your Parent according with the name of your lan interface.

6. the Sixth Command is to make queue tree interface “public”
/queue tree add parent=public queue=pcq_upstream packet-mark=NET1-PM
begin from the main menu select Winbox again Queues at Queue List select tab Queue Three then press  "+"  button

Surely you can guess already what is the difference about the picture above that is the fields of the Parent, adjust the name according to your public interface.

Ok from six steps above I could have a summary. This is the short way if you dont want to take a long time. Go to the main menu of the winbox, this is the following practical steps:
/ip firewall mangle add chain=forward src-address=192.168.1.0/24 action=mark-connection new-connection-mark=NET1-CM
/ip firewall mangle add connection-mark=NET1-CM action=mark-packet new-packet-mark=NET1-PM chain=forward
/queue type add name=pcq_downsteam kind=pcq pcq-classifier=dst-address
/queue type add name=pcq_upstream kind=pcq pcq-classifier=src-address
/queue tree add parent=lan queue=pcq_downsteam packet-mark=NET1-PM
/queue tree add parent=public queue=pcq_upstream packet-mark=NET1-PM
Copy the six comment above into the notepad, and change the IP address marked with red color, green color is lan interface, public interface marked with blue, according to your internet connection. Then go to the main menu of Winbox, and click on the New Terminal. After you have changes the six steps above, then paste by right click on the active Terminal at the cursor.

For more details, lets see the following video ! hopefully useful for you and good luck!


Available link for download