Torrent allocating all available bandwidth

Hi!

I’m using hAP AC with latest stable firmware. I have a 100Mbit link on ether1 with ISP by direct cable. My setup is a plain default “Quick set”.

The problem is that when somebody at my home runs torrent and the speed reaches 100Mbit all other devices are losing connection to the internet.
I tried to google but… Is there a simple solution or I should dive into queues and p2p traffic marking?

Thank you.

Queues are simple solution :slight_smile:

I’m not an expert, just want to share my mangle & queue according to http://forum.mikrotik.com/t/using-routeros-to-qos-your-network-2020-edition/66683/1 and with a little experiment
My connection UP 1.3Mbps, DOWN 10Mbps, WAN ether1 and LAN ether2-master, RouterOS v6.38.7

Just simple explanation:

  1. Mark traffic (VOIP, DNS, ACK, HTTP, UDP etc). we need for assign priority for each traffic
  2. First 1MB will get full speed burst 1s (with this I can get 14MBps) - if HTTP, my assumption as BROWSING - using SFQ for this so no one feel connection down
  3. After 1MB, if still using full speed (or anything that using very much bandwidth) , mark as DOWNLOAD - using PCQ for this, so everybody get equal bandwidth if they are downloading
  4. At Queue for each traffix set limit-at according max client, max limit to set how much bandwidth for this traffic, example for HEAVY traffic you can set max-limit 80M so you have spare 20M

I thing these code for you with connection 100M. You can modify like what you need

/ip firewall mangle
add action=mark-connection chain=prerouting comment=DNS connection-state=new \
    new-connection-mark=DNS passthrough=yes port=53 protocol=udp
add action=mark-connection chain=postrouting connection-state=new \
    new-connection-mark=DNS passthrough=yes port=53 protocol=udp
add action=mark-packet chain=postrouting connection-mark=DNS new-packet-mark=\
    DNS passthrough=no
add action=mark-connection chain=prerouting comment=VOIP dscp=46 \
    new-connection-mark=VOIP passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting dscp=46 new-connection-mark=VOIP \
    passthrough=yes protocol=udp
add action=mark-connection chain=prerouting dscp=26 new-connection-mark=VOIP \
    passthrough=yes protocol=tcp
add action=mark-connection chain=prerouting dscp=26 new-connection-mark=VOIP \
    passthrough=yes protocol=udp
add action=mark-packet chain=prerouting connection-mark=VOIP new-packet-mark=\
    VOIP passthrough=no
add action=mark-connection chain=prerouting comment=UDP connection-state=new \
    new-connection-mark=UDP passthrough=yes protocol=udp
add action=mark-connection chain=prerouting connection-bytes=1000000-0 \
    connection-mark=UDP connection-rate=200k-1G new-connection-mark=UDP_BIG \
    passthrough=yes protocol=udp
add action=mark-packet chain=prerouting connection-mark=UDP_BIG \
    new-packet-mark=UDP_BIG passthrough=no
add action=mark-packet chain=prerouting connection-mark=UDP new-packet-mark=\
    UDP passthrough=no
add action=mark-connection chain=prerouting comment=ICMP connection-state=new \
    new-connection-mark=ICMP passthrough=yes protocol=icmp
add action=mark-connection chain=postrouting connection-state=new \
    new-connection-mark=ICMP passthrough=yes protocol=icmp
add action=mark-packet chain=postrouting connection-mark=ICMP \
    new-packet-mark=ICMP passthrough=no
add action=mark-packet chain=postrouting comment=ACK new-packet-mark=ACK \
    packet-size=0-123 passthrough=no protocol=tcp tcp-flags=ack
add action=mark-packet chain=prerouting new-packet-mark=ACK packet-size=0-123 \
    passthrough=no protocol=tcp tcp-flags=ack
add action=mark-connection chain=prerouting comment=HTTP connection-state=new \
    new-connection-mark=HTTP passthrough=yes port=80,443,8080 protocol=tcp
add action=mark-connection chain=prerouting connection-bytes=1000000-0 \
    connection-mark=HTTP connection-rate=200k-1G new-connection-mark=HTTP_BIG \
    passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting connection-mark=HTTP new-packet-mark=\
    HTTP passthrough=no
add action=mark-packet chain=prerouting connection-mark=HTTP_BIG \
    new-packet-mark=HTTP_BIG passthrough=no
add action=mark-connection chain=prerouting comment=TCP_OTHER_THAN_HTTP \
    connection-state=new new-connection-mark=OTHER_TCP passthrough=yes port=\
    !80,443,8080 protocol=tcp
add action=mark-connection chain=prerouting connection-bytes=1000000-0 \
    connection-mark=OTHER_TCP connection-rate=200k-1G new-connection-mark=\
    OTHER_TCP_BIG passthrough=yes protocol=tcp
add action=mark-packet chain=prerouting connection-mark=OTHER_TCP \
    new-packet-mark=OTHER_TCP passthrough=no
add action=mark-packet chain=prerouting connection-mark=OTHER_TCP_BIG \
    new-packet-mark=OTHER_TCP_BIG passthrough=no
add action=mark-connection chain=prerouting comment=OTHER connection-mark=\
    no-mark new-connection-mark=OTHER passthrough=yes
add action=mark-connection chain=prerouting connection-bytes=1000000-0 \
    connection-mark=OTHER connection-rate=200k-1G new-connection-mark=\
    OTHER_BIG passthrough=yes
add action=mark-packet chain=prerouting connection-mark=OTHER \
    new-packet-mark=OTHER passthrough=no
add action=mark-packet chain=prerouting connection-mark=OTHER_BIG \
    new-packet-mark=OTHER_BIG passthrough=no
    

/queue tree
add max-limit=100M name=MASTER_UP parent=ether1 queue=default
add max-limit=100M name=MASTER_DOWN parent=ether2-master queue=default
add burst-limit=120M burst-threshold=80M burst-time=1s limit-at=1M max-limit=\
    100M name=VOIP_U packet-mark=VOIP parent=MASTER_UP priority=1 queue=\
    default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s \
    limit-at=1M max-limit=100M name=VOIP_D packet-mark=VOIP parent=\
    MASTER_DOWN priority=1 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=100M name=ACK_U packet-mark=ACK parent=MASTER_UP \
    priority=2 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s \
    limit-at=1M max-limit=100M name=ACK_D packet-mark=ACK parent=MASTER_DOWN \
    priority=2 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=100M name=DNS_U packet-mark=DNS parent=MASTER_UP \
    priority=3 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s \
    limit-at=1M max-limit=100M name=DNS_D packet-mark=DNS parent=MASTER_DOWN \
    priority=3 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=100M name=UDP_U packet-mark=UDP parent=MASTER_UP \
    priority=5 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s \
    limit-at=1M max-limit=100M name=UDP_D packet-mark=UDP parent=MASTER_DOWN \
    priority=5 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=100M name=ICMP_U packet-mark=ICMP parent=MASTER_UP \
    priority=4 queue=default
add burst-limit=120M burst-threshold=80M burst-time=1s limit-at=1M max-limit=\
    100M name=ICMP_D packet-mark=ICMP parent=MASTER_DOWN priority=4 queue=\
    default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=100M name=HTTP_U packet-mark=HTTP,OTHER parent=MASTER_UP \
    priority=6 queue=pcq-upload-default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s \
    limit-at=1M max-limit=100M name=HTTP_D packet-mark=HTTP,OTHER parent=\
    MASTER_DOWN priority=6 queue=default
add limit-at=1M max-limit=80M name=HEAVY_D packet-mark=\
    HTTP_BIG,UDP_BIG,OTHER_TCP_BIG,OTHER_BIG parent=MASTER_DOWN queue=\
    pcq-download-default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=80M name=HEAVY_U packet-mark=\
    HTTP_BIG,UDP_BIG,OTHER_TCP_BIG,OTHER_BIG parent=MASTER_UP queue=\
    pcq-upload-default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s limit-at=\
    1M max-limit=100M name=OTHER_TCP_U packet-mark=OTHER_TCP parent=\
    MASTER_UP priority=7 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=80M burst-time=1s \
    limit-at=1M max-limit=100M name=OTHER_TCP_D packet-mark=OTHER_TCP \
    parent=MASTER_DOWN priority=7 queue=default
add bucket-size=0.2 burst-limit=120M burst-threshold=50M burst-time=1s \
    limit-at=1M max-limit=80M name=OTHER_D packet-mark=no-mark parent=\
    MASTER_DOWN priority=7 queue=pcq-download-default
add bucket-size=0.2 burst-limit=120M burst-threshold=50M burst-time=1s limit-at=\
    1M max-limit=80M name=OTHER_U packet-mark=no-mark parent=MASTER_UP \
    priority=7 queue=default

Sorry for my English…