Mikrotik Bandbreite fair aufteilen (queue pcq=0)

Ziel ist es die Bandbreite fair und effizient auf mehrer Netze (Wohnungen) und Hosts (PCs, Laptop, Spielekonsole, TV, …) aufzuteilen.
Die Bandbreite des Internetanschlusses wir zwischen 2 (oder mehr) Netzwerken gleichmäßig/dynamisch (pcq=0) aufgeteilt weiters wird die pro Netzwerk verfügbare Bandbreite zwischen den Hosts gleichmäßig/dynamisch (pcq=0) aufgeteilt.
(siehe “queue Aufteilung Beispiele”)

Configuration

Bandbreite
Download: 60Mbit/s (90% der ISP Bandbreite in der Queue nutzen - 54Mbit)
Upload: 10Mbit/s (90% der ISP Bandbreite in der Queue nutzen - 9Mbit)

Netze
Wohnung 1: 192.168.1.0/24
Wohnung 2: 192.168.2.0/24

Interface
WAN: ether1

Wichtig: Damit die Queues im Mikrotik funktionieren muss “FastTrack” deaktiviert sein!
(Fasttracked packets bypass firewall, connection tracking, simple queues, queue tree with parent=global, ip traffic-flow(restriction removed in 6.33), IP accounting, IPSec, hotspot universal client, VRF assignment)
https://linhost.info/2016/04/mikrotik-routeros-disable-fasttrack-to-limit-bandwidth/

ip firewall mangle

/ip firewall mangle
add action=mark-connection chain=forward comment=DOWNLOAD dst-address=192.168.1.0/24 in-interface=ether1 new-connection-mark=conn-w1-download passthrough=yes
add action=mark-connection chain=forward dst-address=192.168.2.0/24 in-interface=ether1 new-connection-mark=conn-w2-download passthrough=yes
add action=mark-packet chain=forward connection-mark=conn-w1-download new-packet-mark=packet-w1-download passthrough=yes
add action=mark-packet chain=forward connection-mark=conn-w2-download new-packet-mark=packet-w2-download passthrough=yes
add action=mark-connection chain=forward comment=UPLOAD new-connection-mark=conn-w1-upload out-interface=ether1 passthrough=yes src-address=192.168.1.0/24
add action=mark-connection chain=forward new-connection-mark=conn-w2-upload out-interface=ether1 passthrough=yes src-address=192.168.2.0/24
add action=mark-packet chain=forward connection-mark=conn-w1-upload new-packet-mark=packet-w1-upload passthrough=yes
add action=mark-packet chain=forward connection-mark=conn-w2-upload new-packet-mark=packet-w2-upload passthrough=yes

queue type

/queue type
add kind=pcq name=pcq-download-net pcq-classifier=dst-address pcq-dst-address-mask=24 pcq-dst-address6-mask=64 pcq-src-address-mask=24 pcq-src-address6-mask=64
add kind=pcq name=pcq-upload-net pcq-classifier=src-address pcq-dst-address-mask=24 pcq-dst-address6-mask=64 pcq-src-address-mask=24 pcq-src-address6-mask=64
add kind=pcq name=pcq-download-host pcq-classifier=dst-address pcq-dst-address-mask=32 pcq-dst-address6-mask=128 pcq-src-address-mask=32 pcq-src-address6-mask=128
add kind=pcq name=pcq-upload-host pcq-classifier=src-address pcq-dst-address-mask=32 pcq-dst-address6-mask=128 pcq-src-address-mask=32 pcq-src-address6-mask=128

queue tree

/queue tree
add max-limit=54M name=queue-download-net packet-mark=packet-w1-download,packet-w2-download parent=global queue=pcq-download-net
add name=queue-download-w1 packet-mark=packet-w1-download parent=queue-download-net queue=pcq-download-host
add name=queue-download-w2 packet-mark=packet-w2-download parent=queue-download-net queue=pcq-download-host
add max-limit=9M name=queue-upload-net packet-mark=packet-w2-upload,packet-w1-upload parent=global queue=pcq-upload-net
add name=queue-upload-w1 packet-mark=packet-w1-upload parent=queue-upload-net queue=pcq-upload-host
add name=queue-upload-w2 packet-mark=packet-w2-upload parent=queue-upload-net queue=pcq-upload-host

queue Aufteilung Beispiele

2 Netze - 6 Clients

bd = 60Mbit/s
bu = 10Mbit/s
n = 2 (aktive Netze)
n1c = 2 (aktive Clients)
n2c = 4 (aktive Clients)

enter image description here

1 Netz - 2 Clients

bd = 60Mbit/s
bu = 10Mbit/s
n = 1 (aktive Netze)
n1c = 2 (aktive Clients)
n2c = 0 (aktive Clients)

enter image description here

2 Netze - 5 Clients

bd = 60Mbit/s
bu = 10Mbit/s
n = 2 (aktive Netze)
n1c = 1 (aktive Clients)
n2c = 4 (aktive Clients)

enter image description here