当前位置:正能量 » 代码编程 » 路由器 » Qos 单线(6.0适用)【原创】

Qos 单线(6.0适用)【原创】

标记:

/ip firewall mangle
add action=mark-packet chain=postrouting new-packet-mark=QoS_1_Up \
    out-interface=ADSL passthrough=no protocol=icmp
add action=mark-packet chain=postrouting dst-port=\
    8291,20-25,110,1720-1723,3389,3306,3690,15906,35719 new-packet-mark=\
    QoS_2_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting new-packet-mark=QoS_2_Up \
    out-interface=ADSL passthrough=no protocol=gre
add action=mark-packet chain=postrouting dst-port=80,443 new-packet-mark=\
    QoS_3_Up out-interface=ADSL packet-size=0-666 passthrough=no protocol=tcp \
    tcp-flags=syn
add action=mark-packet chain=postrouting dst-port=80,443 new-packet-mark=\
    QoS_3_Up out-interface=ADSL packet-size=0-123 passthrough=no protocol=tcp \
    tcp-flags=ack
add action=mark-packet chain=postrouting dst-port=53,123 new-packet-mark=\
    QoS_1_Up out-interface=ADSL passthrough=no protocol=udp
add action=mark-packet chain=postrouting connection-bytes=0-250000 \
    new-packet-mark=QoS_2_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting connection-bytes=250000-500000 \
    new-packet-mark=QoS_3_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting connection-bytes=500000-1000000 \
    new-packet-mark=QoS_4_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting connection-bytes=1000000-3000000 \
    new-packet-mark=QoS_5_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting connection-bytes=3000000-6000000 \
    new-packet-mark=QoS_6_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting connection-bytes=6000000-0 \
    new-packet-mark=QoS_7_Up out-interface=ADSL passthrough=no protocol=tcp
add action=mark-packet chain=postrouting new-packet-mark=QoS_3_Up \
    out-interface=ADSL packet-size=0-666 passthrough=no protocol=tcp \
    tcp-flags=syn
add action=mark-packet chain=postrouting new-packet-mark=QoS_3_Up \
    out-interface=ADSL packet-size=0-123 passthrough=no protocol=tcp \
    tcp-flags=ack
add action=mark-packet chain=postrouting new-packet-mark=QoS_4_Up \
    out-interface=ADSL packet-size=0-50 passthrough=no protocol=udp
add action=mark-packet chain=postrouting new-packet-mark=QoS_5_Up \
    out-interface=ADSL packet-size=51-256 passthrough=no protocol=udp
add action=mark-packet chain=postrouting new-packet-mark=QoS_6_Up \
    out-interface=ADSL packet-size=256-1024 passthrough=no protocol=udp
add action=mark-packet chain=postrouting new-packet-mark=QoS_7_Up \
    out-interface=ADSL passthrough=no protocol=udp
add action=mark-packet chain=postrouting new-packet-mark=QoS_8_Up \
    out-interface=ADSL p2p=all-p2p passthrough=no
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_1_Down passthrough=no protocol=icmp
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_2_Down passthrough=no protocol=tcp src-port=\
    8291,20-25,110,1720-1723,3389,3306,3690,15906,35719
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_2_Down passthrough=no protocol=gre
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_3_Down packet-size=0-666 passthrough=no protocol=tcp src-port=80,443 \
    tcp-flags=syn
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_3_Down packet-size=0-123 passthrough=no protocol=tcp src-port=80,443 \
    tcp-flags=ack
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_1_Down passthrough=no protocol=udp src-port=53,123
add action=mark-packet chain=prerouting connection-bytes=0-250000 \
    in-interface=ADSL new-packet-mark=QoS_2_Down passthrough=no protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=250000-500000 \
    in-interface=ADSL new-packet-mark=QoS_3_Down passthrough=no protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=500000-1000000 \
    in-interface=ADSL new-packet-mark=QoS_4_Down passthrough=no protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=1000000-3000000 \
    in-interface=ADSL new-packet-mark=QoS_5_Down passthrough=no protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=3000000-6000000 \
    in-interface=ADSL new-packet-mark=QoS_6_Down passthrough=no protocol=tcp
add action=mark-packet chain=prerouting connection-bytes=6000000-0 \
    in-interface=ADSL new-packet-mark=QoS_7_Down passthrough=no protocol=tcp
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_3_Down packet-size=0-666 passthrough=no protocol=tcp tcp-flags=syn
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_3_Down packet-size=0-123 passthrough=no protocol=tcp tcp-flags=ack
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_4_Down packet-size=0-50 passthrough=no protocol=udp
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_5_Down packet-size=51-256 passthrough=no protocol=udp
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_6_Down packet-size=256-1024 passthrough=no protocol=udp
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_7_Down passthrough=no protocol=udp
add action=mark-packet chain=prerouting in-interface=ADSL new-packet-mark=\
    QoS_8_Down p2p=all-p2p passthrough=no

以上脚本,只需要修改

ADSL:外网接口

qiao:桥接口,或者是内网网卡接口。如果有多个内网网卡,建立放在一个桥内管理,或者采用交换机模式管理。

(本文属于原创,转载请注明出处:http://www.skydw.com

端口

8291,20-25,110,1720-1723,3389,3306,3690,15906,35719

请修改成你要优先的端口。

HTB:

/queue simple
add limit-at=128k/1M max-limit=500k/8M name=PCQ queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue1 packet-marks=\
    QoS_1_Up,QoS_1_Down parent=PCQ priority=1/1 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue2 packet-marks=\
    QoS_2_Up,QoS_2_Down parent=PCQ priority=2/2 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue3 packet-marks=\
    QoS_3_Up,QoS_3_Down parent=PCQ priority=3/3 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue4 packet-marks=\
    QoS_4_Up,QoS_4_Down parent=PCQ priority=4/4 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue5 packet-marks=\
    QoS_5_Up,QoS_5_Down parent=PCQ priority=5/5 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue6 packet-marks=\
    QoS_6_Up,QoS_6_Down parent=PCQ priority=6/6 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue7 packet-marks=\
    QoS_7_Up,QoS_7_Down parent=PCQ priority=7/7 queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24
add limit-at=128k/1M max-limit=500k/8M name=queue8 packet-marks=\
    QoS_8_Up,QoS_8_Down parent=PCQ queue=\
    pcq-upload-default/pcq-download-default target=192.168.88.0/24

以上脚本,只需修改

192.168.88.0/24 修改成您自己的网段。(代码为上行512K,下行8M的代码)
limit-at=128k/1M  //这行的意思是保证上行128K,下行1M。
max-limit=500k/8M  //这行的意思是最大上行和下行,这里我取的是最大。
pcq-upload-default/pcq-download-default   这是默认的,不需要做什么修改。

(本文属于原创,转载请注明出处:http://www.znl.net

这里多说几句,要做PCQ,一定要在simple queue里做。那些人在queue tree中做,虽然有一点效果,但只是起到了htb的作用,却没有pcq的作用,pcq是基于IP来做的。

纯属自己理解,勿喷。

OK!请尽情的享受吧。

未经允许不得转载:正能量 » Qos 单线(6.0适用)【原创】

相关文章

评论 (0)

5 + 6 =