deniSun
20-01-15, 00:40
Σε συνέχεια αυτού (http://www.adslgr.com/forum/threads/858116-Mikrotik-%CF%83%CE%B5-%CF%81%CF%8C%CE%BB%CE%BF-PPPoE-client-%CE%BC%CE%B5-modem-%CF%83%CE%B5-bridge-mode) του οδηγού προσθέτω τις ρυθμίσεις για ενεργοποίηση του QoS.
Η λογική που ακολουθούμε είναι ότι μαρκάρουμε πρώτα την σύνδεση και της αποδίδουμε μια ετικέτα.
Στην συνέχει όλα τα πακέτα των συνδέσεων με την συγκεκριμένη ετικέτα, μαρκάρονται ανάλογα και παίρνουν την ανάλογη προτεραιότητα με βάση τις ουρές που ορίσαμε.
Προτεραιότητες:
---QoS_1---
7: ICMP-Echo [tcp/udp]
53: DNS [udp]
80: http [tcp] 0-500000 (<500KB)
123: sntp [udp]
443: https [tcp]
---QoS_2---
20, 21: ftp [tcp]
22: ssh/sftp [tcp]
23: telnet [tcp]
25: smtp [tcp]
80: http [tcp] 500000- (>500KB)
110: pop3 [tcp]
143: imap [tcp]
443: https [tcp] 500000- (>500KB)
465: smtp over ssl [tcp]
587: smtp [tcp]
993: imap over ssl [tcp]
995: pop3 over ssl [tcp]
---QoS_8---
10000-65535: free ports (49152-65535) - utorrent (59775)
Συνοπτικά:
QoS_1: ICMP-Echo(7), DNS (53), http-small(80,443), NTP(123)
QoS_2: FTP(20,21), SSH/SFTP(22), Telnet(23), emails(25,110,143,465,587,993,995), http-large(80,443)
QoS_3~6: reserved
QoS_7: TCP/UDP and all others remaining traffic
QoS_8: Lowest priority, this is for the ports 10000-65535 (p2p)
Δηλώσεις:
*** Δημιουργία ουρών ipv4/ipv6
/queue simple (pppoe-out1 priority 8, LAN > pppoe)
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=pppoe-out1 parent=none priority="8/8" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_1 packet-marks=QoS_1 parent=pppoe-out1 priority="1/1" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_2 packet-marks=QoS_2 parent=pppoe-out1 priority="2/2" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_7 packet-marks=QoS_7 parent=pppoe-out1 priority="7/7" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_8 packet-marks=QoS_8 parent=pppoe-out1 priority="8/8" queue=default/default total-queue=default
*** Ορισμός mangles για ipv4 και μαρκάρισμα συνδέσεων (έπειτα πακέτων)
/ip firewall mangle
add chain=forward protocol=icmp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=QoS_1_ICMP
add chain=forward protocol=icmp connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=prerouting protocol=udp dst-port=53 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______DNS
add chain=prerouting protocol=udp dst-port=53 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp port=!80,443 packet-size=0-123 tcp-flags=ack action=mark-packet new-packet-mark=QoS_1 passthrough=no comment=______ACK
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______HTTP-S_small
add chain=forward protocol=tcp dst-port=80,443 connection-mark=QoS_1 connection-bytes=0-500000 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=udp dst-port=123 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______NTP
add chain=forward protocol=udp dst-port=123 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp dst-port=20,21,22,23,25,110,143,465,587,993,995 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_2 passthrough=yes disabled=no comment=QoS_2_FTP_SSH_Telnet_SMTP_POP3-S_SNTP_IMAP-S_SMTP-S
add chain=forward connection-mark=QoS_2 action=mark-packet new-packet-mark=QoS_2 passthrough=no
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-mark=QoS_1 connection-bytes=500000-0 action=mark-packet new-packet-mark=QoS_2 passthrough=no comment=______HTTP-S_large
add chain=forward protocol=tcp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no comment=QoS_8_Torrents
add chain=forward protocol=udp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_8 action=mark-packet new-packet-mark=QoS_8 passthrough=no
add chain=forward protocol=tcp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no comment=QoS_7_all_others
add chain=forward protocol=udp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_7 action=mark-packet new-packet-mark=QoS_7 passthrough=no
*** Ορισμός mangles για ipv6 και μαρκάρισμα συνδέσεων (έπειτα πακέτων)
/ipv6 firewall mangle
add chain=forward protocol=icmpv6 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=QoS_1_ICMP
add chain=forward protocol=icmpv6 out-interface=pppoe-out1 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp src-port=!80,443 in-interface=pppoe-out1 packet-size=0-123 tcp-flags=ack action=mark-packet new-packet-mark=QoS_1 passthrough=no comment=______ACK
add chain=forward protocol=tcp dst-port=!80,443 out-interface=pppoe-out1 packet-size=0-123 tcp-flags=ack action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=prerouting protocol=udp port=53 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______DNS
add chain=prerouting protocol=udp port=53 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______HTTP-S
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-mark=QoS_1 connection-bytes=0-500000 action=mark-packet new-packet-mark=QoS_1 passthrough=no comment=______HTTP-S_small
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-mark=QoS_1 connection-bytes=500000-0 action=mark-packet new-packet-mark=QoS_2 passthrough=no comment=QoS_2_HTTP-S_large_FTP_SSH_Telnet_SMTP_POP3-S_SNTP_IMAP-S_SMTP-S
add chain=forward protocol=tcp dst-port=20,21,22,23,25,110,143,465,587,993,995 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_2 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_2 action=mark-packet new-packet-mark=QoS_2 passthrough=no
add chain=forward protocol=tcp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no comment=QoS_8_Torrents
add chain=forward protocol=udp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_8 action=mark-packet new-packet-mark=QoS_8 passthrough=no
add chain=forward protocol=tcp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no comment=QoS_7_all_others
add chain=forward protocol=udp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_7 action=mark-packet new-packet-mark=QoS_7 passthrough=no
Η λογική που ακολουθούμε είναι ότι μαρκάρουμε πρώτα την σύνδεση και της αποδίδουμε μια ετικέτα.
Στην συνέχει όλα τα πακέτα των συνδέσεων με την συγκεκριμένη ετικέτα, μαρκάρονται ανάλογα και παίρνουν την ανάλογη προτεραιότητα με βάση τις ουρές που ορίσαμε.
Προτεραιότητες:
---QoS_1---
7: ICMP-Echo [tcp/udp]
53: DNS [udp]
80: http [tcp] 0-500000 (<500KB)
123: sntp [udp]
443: https [tcp]
---QoS_2---
20, 21: ftp [tcp]
22: ssh/sftp [tcp]
23: telnet [tcp]
25: smtp [tcp]
80: http [tcp] 500000- (>500KB)
110: pop3 [tcp]
143: imap [tcp]
443: https [tcp] 500000- (>500KB)
465: smtp over ssl [tcp]
587: smtp [tcp]
993: imap over ssl [tcp]
995: pop3 over ssl [tcp]
---QoS_8---
10000-65535: free ports (49152-65535) - utorrent (59775)
Συνοπτικά:
QoS_1: ICMP-Echo(7), DNS (53), http-small(80,443), NTP(123)
QoS_2: FTP(20,21), SSH/SFTP(22), Telnet(23), emails(25,110,143,465,587,993,995), http-large(80,443)
QoS_3~6: reserved
QoS_7: TCP/UDP and all others remaining traffic
QoS_8: Lowest priority, this is for the ports 10000-65535 (p2p)
Δηλώσεις:
*** Δημιουργία ουρών ipv4/ipv6
/queue simple (pppoe-out1 priority 8, LAN > pppoe)
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=pppoe-out1 parent=none priority="8/8" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_1 packet-marks=QoS_1 parent=pppoe-out1 priority="1/1" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_2 packet-marks=QoS_2 parent=pppoe-out1 priority="2/2" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_7 packet-marks=QoS_7 parent=pppoe-out1 priority="7/7" queue=default/default total-queue=default
add burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s disabled=no target=pppoe-out1 limit-at=0/0 max-limit=0/0 name=QoS_8 packet-marks=QoS_8 parent=pppoe-out1 priority="8/8" queue=default/default total-queue=default
*** Ορισμός mangles για ipv4 και μαρκάρισμα συνδέσεων (έπειτα πακέτων)
/ip firewall mangle
add chain=forward protocol=icmp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=QoS_1_ICMP
add chain=forward protocol=icmp connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=prerouting protocol=udp dst-port=53 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______DNS
add chain=prerouting protocol=udp dst-port=53 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp port=!80,443 packet-size=0-123 tcp-flags=ack action=mark-packet new-packet-mark=QoS_1 passthrough=no comment=______ACK
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______HTTP-S_small
add chain=forward protocol=tcp dst-port=80,443 connection-mark=QoS_1 connection-bytes=0-500000 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=udp dst-port=123 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______NTP
add chain=forward protocol=udp dst-port=123 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp dst-port=20,21,22,23,25,110,143,465,587,993,995 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_2 passthrough=yes disabled=no comment=QoS_2_FTP_SSH_Telnet_SMTP_POP3-S_SNTP_IMAP-S_SMTP-S
add chain=forward connection-mark=QoS_2 action=mark-packet new-packet-mark=QoS_2 passthrough=no
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-mark=QoS_1 connection-bytes=500000-0 action=mark-packet new-packet-mark=QoS_2 passthrough=no comment=______HTTP-S_large
add chain=forward protocol=tcp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no comment=QoS_8_Torrents
add chain=forward protocol=udp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_8 action=mark-packet new-packet-mark=QoS_8 passthrough=no
add chain=forward protocol=tcp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no comment=QoS_7_all_others
add chain=forward protocol=udp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_7 action=mark-packet new-packet-mark=QoS_7 passthrough=no
*** Ορισμός mangles για ipv6 και μαρκάρισμα συνδέσεων (έπειτα πακέτων)
/ipv6 firewall mangle
add chain=forward protocol=icmpv6 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=QoS_1_ICMP
add chain=forward protocol=icmpv6 out-interface=pppoe-out1 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp src-port=!80,443 in-interface=pppoe-out1 packet-size=0-123 tcp-flags=ack action=mark-packet new-packet-mark=QoS_1 passthrough=no comment=______ACK
add chain=forward protocol=tcp dst-port=!80,443 out-interface=pppoe-out1 packet-size=0-123 tcp-flags=ack action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=prerouting protocol=udp port=53 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______DNS
add chain=prerouting protocol=udp port=53 connection-mark=QoS_1 action=mark-packet new-packet-mark=QoS_1 passthrough=no
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_1 passthrough=yes disabled=no comment=______HTTP-S
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-mark=QoS_1 connection-bytes=0-500000 action=mark-packet new-packet-mark=QoS_1 passthrough=no comment=______HTTP-S_small
add chain=forward protocol=tcp dst-port=80,443 out-interface=pppoe-out1 connection-mark=QoS_1 connection-bytes=500000-0 action=mark-packet new-packet-mark=QoS_2 passthrough=no comment=QoS_2_HTTP-S_large_FTP_SSH_Telnet_SMTP_POP3-S_SNTP_IMAP-S_SMTP-S
add chain=forward protocol=tcp dst-port=20,21,22,23,25,110,143,465,587,993,995 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_2 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_2 action=mark-packet new-packet-mark=QoS_2 passthrough=no
add chain=forward protocol=tcp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no comment=QoS_8_Torrents
add chain=forward protocol=udp dst-port=10000-65535 out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_8 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_8 action=mark-packet new-packet-mark=QoS_8 passthrough=no
add chain=forward protocol=tcp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no comment=QoS_7_all_others
add chain=forward protocol=udp out-interface=pppoe-out1 connection-state=new action=mark-connection new-connection-mark=QoS_7 passthrough=yes disabled=no
add chain=forward connection-mark=QoS_7 action=mark-packet new-packet-mark=QoS_7 passthrough=no