Jump to content
Калькуляторы

Подскажите по приоритетам трафика в микротик

Прописал следующие правила:

 

 

/ip firewall mangle

add action=mark-packet chain=postrouting comment="Link-critical traffic (DHCP)" disabled=no dst-port=67 new-packet-mark=link_critical out-interface=ether1 passthrough=no protocol=udp src-port=68

add action=mark-packet chain=postrouting comment="VPN TCP" disabled=no new-packet-mark=link_critical out-interface= ether1 passthrough=no port=443,1723 protocol=tcp

add action=mark-packet chain=postrouting comment="VPN GRE" disabled=no new-packet-mark=link_critical out-interface= ether1 passthrough=no protocol=gre

add action=mark-packet chain=postrouting comment="VPN UDP" disabled=no new-packet-mark=link_critical out-interface= ether1 passthrough=no port=4500,500,1701 protocol=udp

add action=mark-packet chain=postrouting comment="VPN ESP" disabled=no new-packet-mark=link_critical out-interface= ether1 passthrough=no protocol=ipsec-esp

add action=mark-packet chain=postrouting comment="Time-critical traffic (DNS, TCP control packets, certain ACK packets, new connections)" disabled=no dst-port=53 new-packet-mark=time_critical out-interface= ether1 passthrough=no protocol=udp

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=time_critical out-interface= ether1 passthrough=no protocol=tcp tcp-flags=fin,syn,rst

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=time_critical out-interface= ether1 packet-size=40-89 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="" connection-state=new disabled=no new-packet-mark=time_critical out-interface= ether1 passthrough=no protocol=tcp

add action=mark-packet chain=postrouting comment="Critical traffic (just some ACK packets)" disabled=no new-packet-mark=critical out-interface= ether1 packet-size=90-159 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="High-priority interactive traffic (SSH, WinBox, certain ACK packets)" disabled=no new-packet-mark=high_pri_interactive out-interface= ether1 passthrough=no port=22,2200 protocol=tcp

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=high_pri_interactive out-interface= ether1 passthrough=no port=8291 protocol=tcp

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=high_pri_interactive out-interface= ether1 packet-size=160-249 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="Low-priority interactive traffic (HTTP, HTTPS)" disabled=no new-packet-mark=low_pri_interactive out-interface= ether1 passthrough=no port=80 protocol=tcp

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=low_pri_interactive out-interface= ether1 packet-size=250-359 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="High-priority non-interactive traffic (FTP)" connection-type=ftp disabled=no new-packet-mark=high_pri_non_interactive out-interface= ether1 passthrough=no protocol=tcp

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=high_pri_non_interactive out-interface= ether1 packet-size=360-489 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="Low-priority non-interactive traffic (POP, SMTP)" disabled=no new-packet-mark=low_pri_non_interactive out-interface= ether1 passthrough=no port=25,110 protocol=tcp

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=low_pri_non_interactive out-interface= ether1 packet-size=490-639 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="Non-critical traffic (P2P)" disabled=no new-packet-mark=non_critical out-interface= ether1 packet-size=640-809 passthrough=no protocol=tcp tcp-flags=ack

add action=mark-packet chain=postrouting comment="" disabled=no new-packet-mark=non_critical out-interface= ether1 passthrough=no protocol=tcp

 

/queue tree

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name="Outgoing queue" packet-mark="" parent=ether1 priority=8

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name="Low-pri non-interactive" packet-mark=low_pri_non_interactive parent="Outgoing queue" priority=7 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name=Non-critical packet-mark=non_critical parent="Outgoing queue" priority=8 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name=Link-critical packet-mark=link_critical parent="Outgoing queue" priority=1 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name=Time-critical packet-mark=time_critical parent="Outgoing queue" priority=2 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name=Critical packet-mark=critical parent="Outgoing queue" priority=3 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name="High-pri interactive" packet-mark=high_pri_interactive parent="Outgoing queue" priority=4 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name="Low-pri interactive" packet-mark=low_pri_interactive parent="Outgoing queue" priority=5 queue=default

add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=9M name="High-pri non-interactive" packet-mark=high_pri_non_interactive parent="Outgoing queue" priority=6 queue=default

 

Интерфейс провайдера ether1. Настроен NAT

Скорость канала 10Мбит.

Вижу, что HTTP, HTTPS трафик не маркируется.

Не могу понять почему.

Edited by edc

Share this post


Link to post
Share on other sites

HTTPS обычно идёт по 443/TCP порту, а в правиле указан только 80/TCP.

 

И ещё меня смущает пробел после "out-interface=".

Edited by bel

Share this post


Link to post
Share on other sites

Попробуйте использовать Forward и Output, если интернет раздает ваш же маршрутизатор, а не перенаправляет пакеты далее на другой.

 

 

Share this post


Link to post
Share on other sites

Поставил parent=global-out - заработало.

Но почему-то трафик ipsec туннелей никак не маркируется.

Туннели настроены на этом же маршрутизаторе и используют ether1 интерфейс.

Share this post


Link to post
Share on other sites

Если поставить output, то очень мало трафика маркируется.

Больше всего, когда стоит postrouting.

Можно как-то остальной трафик, кроме того, что указан в правилах, тоже маркировать и поставить низкий приоритет.

Сейчас, как я понял, весь немаркированный трафик идет первым приоритетом.

Share this post


Link to post
Share on other sites

Так вы одним правилом один трафик маркируйте, другим - другой. Отдельно входящий и отдельно исходящий. Если вы какой-то трафик не помаркировали, то он вообще идет помимо приоритетов. Поэтому нужно сделать правило маркировки, куда попадает весь трафик и пойдет по минимальному приоритету, у него галочку Passthrough не ставите. А все те, что маркируют конкретный трафик, делаете с этой галочкой. Тогда можно делать рабочие приоритеты без "утечек".

Share this post


Link to post
Share on other sites

В конечном итоге так и сделал.

Но если указать parent interface на downdload global-out, а на upload - global-in или global-total, то объем маркированных данных примерно одинаковый.

Хотя в данный момент соотношение download/upload около порядка.

Share this post


Link to post
Share on other sites

Использую схему с dscp, маркировка в postrouting, правило примерно такого вида:

 

add action=mark-packet chain=postrouting dscp=1 dst-address-list=local-net\
new-packet-mark=dscp_1 passthrough=no src-address-list=!local-net

 

Если надо определенный трафик приоретизировать, то делаю так:

 

add action=change-dscp chain=prerouting comment=p2p disabled=no new-dscp=0 p2p=all-p2p passthrough=yes

 

В дереве очередей первое правило:

 

/queue tree
add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 max-limit=12M 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=dscp0 packet-mark=dscp_0 parent=IN priority=8 queue=pcq-in

Share this post


Link to post
Share on other sites

А есть у кого-то пример маркировки пакетов для протоколов H.323 и SIP ?

 

Вы можете маркировать их по портам, но лучше по TOS. А дальше в стандартном дереве поставите им первый приоритет.

Share this post


Link to post
Share on other sites

А есть у кого-то пример маркировки пакетов для протоколов H.323 и SIP ?

 

Вы можете маркировать их по портам, но лучше по TOS. А дальше в стандартном дереве поставите им первый приоритет.

А вот как этот злополучный tos определить? Снял трафик tools/packet sniffer а затем загружаю его в wireshark

А дальше "темнота" .....

или есть метод попроще?

Share this post


Link to post
Share on other sites

А вот как этот злополучный tos определить? Снял трафик tools/packet sniffer а затем загружаю его в wireshark

А дальше "темнота" .....

или есть метод попроще?

 

Поискать в гугле стандартные метки телефонии, далее в манглах попробовать вводить их и смотреть попадают под него пакеты или нет. Если времени свободного много, можно в экселе накопировать правил, увеличивая значение на 1, после чего вставить в микротик, так сможете тоже найти.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.