HTB script

/ip firewall mangle
add action=accept chain=forward comment=icmp_options disabled=no protocol=\
    icmp
add action=mark-packet chain=forward comment=all_up_classifier disabled=no \
    new-packet-mark=all-up-p passthrough=no src-address=192.168.1.0/24
add action=mark-packet chain=forward comment=all_down_classifier disabled=no \
    dst-address-list=viplist new-packet-mark=vip-down-p passthrough=no
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=icq-down-p passthrough=no protocol=tcp \
    src-port=443,53
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=icq-down-p passthrough=no protocol=udp \
    src-port=8000,53
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=pag-down-p packet-size=0-512 passthrough=\
    no protocol=tcp src-port=8080,80
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=web-down-p passthrough=no protocol=tcp \
    src-port=8080,80
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=tcp-down-p packet-size=0-512 passthrough=\
    no protocol=tcp
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=udp-down-p packet-size=0-800 passthrough=\
    no protocol=udp
add action=mark-packet chain=forward comment="" disabled=no dst-address=\
    192.168.1.0/24 new-packet-mark=oth-down-p passthrough=no

/queue type
add kind=pcq name=pcq-all-up pcq-classifier=src-address pcq-limit=50 pcq-rate=1000000 pcq-total-limit=12000
add kind=pcq name=pcq-gam-down pcq-classifier=dst-address pcq-limit=50 pcq-rate=1000000 pcq-total-limit=12000
add kind=pcq name=pcq-web-down pcq-classifier=dst-address pcq-limit=50 pcq-rate=0 pcq-total-limit=12000
add kind=pcq name=pcq-oth-down pcq-classifier=dst-address pcq-limit=50 pcq-rate=0 pcq-total-limit=12000


/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=in parent=global-out priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=0 name=out parent=global-out priority=8
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=4M \
    max-limit=30M name=Leaf-d-Tcp packet-mark=tcp-down-p parent=in priority=1 \
    queue=pcq-gam-down
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=4M \
    max-limit=30M name=Leaf-d-udp packet-mark=udp-down-p parent=in priority=2 \
    queue=pcq-gam-down
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=4M \
    max-limit=30M name=Leaf-d-Icq packet-mark=icq-down-p parent=in priority=3 \
    queue=pcq-gam-down
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=12M \
    max-limit=30M name=Leaf-d-Web packet-mark=web-down-p,oth-down-p parent=in \
    priority=5 queue=pcq-web-down
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=10M name=Leaf-d-Vip packet-mark=vip-down-p parent=in priority=8 \
    queue=pcq-oth-down
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
    max-limit=30M name=Leaf-u-all packet-mark=all-up-p parent=out priority=8 \
    queue=pcq-all-up
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=4M \
    max-limit=30M name=Leaf-d-Pag packet-mark=pag-down-p parent=in priority=4 \
    queue=pcq-oth-down