Queue Tree with more than two interfaces

From MikroTik Wiki
Revision as of 12:43, 24 February 2007 by Fisero (talk | contribs) (Queue Tree Setup)
Jump to: navigation, search

Basic Setup

This page will tak about how to make QUEUE TREE in RouterOS that with Masquerading for more than two interfaces. It's for sharing internet connection among users on each interfacess. In manual this possibility isn't writted.


First, let's set the basic setting first. I'm using a machine with 3 or more network interfaces:

[admin@instaler] > in pr
#    NAME       TYPE    RX-RATE    TX-RATE    MTU  
0  R public     ether   0          0          1500 
1  R wifi1      wlan    0          0          1500
2  R wifi2      wlan    0          0          1500
3  R wifi3      wlan    0          0          1500

And this is the IP Addresses for each interface:

[admin@instaler] > ip ad pr
Flags: X - disabled, I - invalid, D - dynamic 
#  ADDRESS           NETWORK      BROADCAST      INTERFACE
0  10.20.1.0/24      10.20.1.0    10.20.1.255    public   
1  10.10.2.0/24      10.10.2.0    10.10.2.255    wifi1
2  10.10.3.0/24      10.10.3.0    10.10.3.255    wifi2
3  10.10.4.0/24      10.10.4.0    10.10.4.255    wifi3

On the public you can add NAT or proxy if you want.

Mangle Setup

And now is the most important part in this case.

We need to mark our users. One connectoin for upload and second for download. In this example I add mangle for two users, user10 and user50. At the end I add mangle for local transmission because I don't QoS local trafic emong users.

[admin@instaler] ip firewall mangle> print
Flags: X - disabled, I - invalid, D - dynamic 
0   chain=forward src-address=10.10.2.10 
    action=mark-connection new-connection-mark=users-10U passthrough=yes 
1   chain=forward dst-address=10.10.2.10 
    action=mark-connection new-connection-mark=users-10D passthrough=yes 
2   chain=forward connection-mark=users-10U action=mark-packet 
    new-packet-mark=user10 passthrough=yes 
3   chain=forward connection-mark=users-10D action=mark-packet 
    new-packet-mark=user10 passthrough=yes 
4   chain=forward src-address=10.10.3.50 
    action=mark-connection new-connection-mark=users-50U passthrough=yes 
5   chain=forward dst-address=10.10.3.50
    action=mark-connection new-connection-mark=users-50D passthrough=yes 
6   chain=forward connection-mark=users-10U action=mark-packet 
    new-packet-mark=user50 passthrough=yes 
7   chain=forward connection-mark=users-10D action=mark-packet 
    new-packet-mark=user50 passthrough=yes 
98  chain=forward src-address=10.10.0.0/16 dst-address=10.10.0.0/16 
    action=mark-connection new-connection-mark=users-lokal passthrough=yes 
99  chain=forward connection-mark=users-lokal action=mark-packet 
    new-packet-mark=lokalTrafic passthrough=yes 


Queue Tree Setup

And now, the queue tree setting. We need one rule for downlink and one rule for uplink. Be careful when choosing the parent. for downlink traffic, we use parent "dlobal-out", because we have two or more downloading interfaces. And for uplink, we are using parent "public", we want QoS uplink traffic. (I'm using pcq-up and download from manual) This example is for 2Mb/1Mb

[admin@instaler] > queue tree pr
Flags: X - disabled, I - invalid 
0   name="Download" parent=global-out packet-mark="" limit-at=0 
    queue=pcq-download priority=1 max-limit=2000000 burst-limit=0 
    burst-threshold=0 burst-time=0s 
1   name="Upload" parent=WGW packet-mark="" limit-at=0 queue=pcq-upload 
    priority=1 max-limit=1000000 burst-limit=0 burst-threshold=0 
    burst-time=0s 

Now we add our users:

2   name="user10D" parent=Download packet-mark=user10 limit-at=0 
    queue=pcq-download priority=5 max-limit=0 burst-limit=0 
    burst-threshold=0 burst-time=0s 
3   name="user10U" parent=Upload packet-mark=user10 limit-at=0 
    queue=pcq-upload priority=5 max-limit=0 burst-limit=0 burst-threshold=0 
    burst-time=0s
4   name="user50D" parent=Download packet-mark=user50 limit-at=0 
    queue=pcq-download priority=5 max-limit=0 burst-limit=0 
    burst-threshold=0 burst-time=0s 
5   name="user50U" parent=Upload packet-mark=user50 limit-at=0 
    queue=pcq-upload priority=5 max-limit=0 burst-limit=0 burst-threshold=0 
    burst-time=0s


Ondřej Fišer Use it in peace