电信网通负载均衡+动态流控(10.13最后修订添加网页L7精确分离)

     ]   2015-08-22 23:41:12   来源: 深圳网吧联盟论坛   评论: 0   点击:    分享到: 

收藏
脚本效果图:实现流控大师的效果却不用高额费和繁琐定期更新。
原帖地址:
http://bbs.szwblm.com/forum.php?mod=viewthread&tid=102179&extra=page%3D1

脚本效果图:实现流控大师的效果却不用高额费和繁琐定期更新。\可以有效汇聚叠加不同ISP线路\
空闲时服务器延迟与满负荷时服务器延迟对比
\



以下是路由标记脚本脚本内容:
10月13日,最后修修订:重新修改了限速策略,现在更清晰直观。在路由标记时用L7协议来更精准的分离http数据。
10月13日,再次追加代码,实现网页元素以及脚本和图片的数据精确分离,可以在满负荷情况下仍然有下图的表现。\


#RouteROS 6.6
# software id = W5EY-LHT9
#
/ip firewall mangle
add action=mark-connection chain=input in-interface=CNC new-connection-mark=CNC_conn
add action=mark-connection chain=input in-interface=TEL new-connection-mark=TEL_conn
add action=mark-routing chain=output connection-mark=CNC_conn new-routing-mark=Route_ChinaUnicom
add action=mark-routing chain=output connection-mark=TEL_conn new-routing-mark=Route_ChinaTelecom
add action=jump chain=prerouting comment="--\B8\F9\BE\DD\B6\CB\BF\DA\B1\EA\BC\C7\B3\F6\D3\CE\CF\B7\CA\FD\BE\DD\C1\B4----------------------------\r\
    \n\r\
    \n*     \CA\FD\BE\DD\D7\AA\B1\ED\B4\A6\C0\ED            *\r\
    \n\r\
    \n\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA\A1\AA" dst-address-type=!local in-interface=LAN jump-target=Game_chain
add action=mark-routing chain=prerouting comment="\D4\DA\C4\DA\CD\F8 LAN \B7\A2\CB\CD\B5\BD\B5\E7\D0\C5\B5\C4\CA\FD\BE\DD\D3\C3\C4\BF\B5\C4\B5\D8\D6\B7\C2\B7\D3\C9\D7\AA\B5\BDTelecom\B1\ED " connection-mark=\
    game_conn dst-address-list=ChinaTelecom new-routing-mark=Route_ChinaTelecom passthrough=no
add action=mark-routing chain=prerouting comment="\D4\DA\C4\DA\CD\F8 LAN \B7\A2\CB\CD\B5\BD\C1\AA\CD\A8\B5\C4\CA\FD\BE\DD\D3\C3\C4\BF\B5\C4\B5\D8\D6\B7\C2\B7\D3\C9\D7\AA\B5\BDUnicom\B1\ED " connection-mark=\
    game_conn dst-address-list=ChinaUnicom new-routing-mark=Route_ChinaUnicom passthrough=no
add action=mark-connection chain=prerouting comment="\D4\DA\C4\DA\CD\F8 LAN \CA\FD\BE\DD\D6\D0 \A3\AC\CC\DE\B3\FD\D3\CE\CF\B7\CA\FD\BE\DD\C1\B4" connection-mark=!game_conn dst-address-type=!local in-interface=LAN \
    new-connection-mark=LAN_conn
add action=jump chain=prerouting comment="\C4\DA\CD\F8\C7\EB\C7\F3\B5\C4\CD\F8\D2\B3\B6\CB\BF\DA\B7\D6\C1\F7" dst-port=80,443 in-interface=LAN jump-target="PCC pase" protocol=tcp
add action=jump chain=prerouting comment="\C4\DA\CD\F8\C7\EB\C7\F3\B5\C4UDP\CA\FD\BE\DD" connection-mark=LAN_conn jump-target="NTH pase" protocol=udp
add action=jump chain=prerouting comment="\C6\E4\CB\FBtcp\CA\FD\BE\DD" connection-mark=LAN_conn jump-target="NTH pase" protocol=tcp
add action=jump chain=prerouting comment="\C6\E4\CB\FB\CA\FD\BE\DD" connection-mark=LAN_conn jump-target="PCC pase"
add action=mark-connection chain="NTH pase" comment="NTH\A3\BA\A3\BA\A3\BA\A3\BA\A3\BA\A3\BA\B2\F0\B7\D6\BD\F8\C8\EB\D7\D3\B1\ED\C1\B4\B5\C4\CA\FD\BE\DD\B0\FC" new-connection-mark=NTH_conn packet-mark=!no-mark
add action=mark-routing chain="NTH pase" comment="NTH\A3\BA\A3\BA\A3\BA\A3\BA\A3\BA\A3\BA \B2\F0\B7\D6\CA\FD\BE\DD\B0\FC1" connection-mark=NTH_conn new-routing-mark=Route_ChinaUnicom nth=3,1 passthrough=no
add action=mark-routing chain="NTH pase" comment="NTH\A3\BA\A3\BA\A3\BA\A3\BA\A3\BA\A3\BA \B2\F0\B7\D6\CA\FD\BE\DD\B0\FC3" connection-mark=NTH_conn new-routing-mark=Route_ChinaTelecom passthrough=no
add action=mark-connection chain="PCC pase" comment="PCC-\A1\A3-\A1\A3-\A1\A3-\A1\A3 \B2\F0\B7\D6\BD\F8\C8\EB\D7\D3\B1\ED\C1\B4\B5\C4\CA\FD\BE\DD\B0\FC" connection-mark=!no-mark new-connection-mark=PCC_conn
add action=mark-routing chain="PCC pase" comment="PCC-\A1\A3-\A1\A3-\A1\A3-\A1\A3 \B7\D6\C1\F7ip1" connection-mark=PCC_conn new-routing-mark=Route_ChinaUnicom passthrough=no per-connection-classifier=\
    both-addresses-and-ports:3/0
add action=mark-routing chain="PCC pase" comment="PCC-\A1\A3-\A1\A3-\A1\A3-\A1\A3 \B7\D6\C1\F7ip1" connection-mark=PCC_conn new-routing-mark=Route_ChinaTelecom passthrough=no
add action=mark-connection chain=Game_chain comment="\D3\A2\D0\DB\C1\AA\C3\CB" new-connection-mark=game_conn port=5000-5700 protocol=udp
add action=mark-connection chain=Game_chain comment="\D3\A2\D0\DB\C1\AA\C3\CB" new-connection-mark=game_conn port=8000-8500,2099,5000-5700 protocol=tcp
add action=mark-connection chain=Game_chain comment="\BC\D3\C3\DC\CD\F8\D2\B3\CA\FD\BE\DD\C1\B4" new-connection-mark=game_conn port=443,9999 protocol=tcp
add action=mark-connection chain=Game_chain comment="\CD\AC\BB\A8\CB\B3" new-connection-mark=game_conn port=8601,8002,9999 protocol=tcp
add action=mark-connection chain=connetcion-BR comment="\B6\AF\CC\AC\C1\F7\BF\D8\CA\FD\BE\DD\D0\D0\CE\AA\B1\E6\CA\B6\B1\ED\A3\AC\B7\C7\B3\AC\C1\BF\CF\C2\D4\D8\CA\FD\BE\DD\B1\EA\BC\C7" connection-mark="!IN_H conn" \
    new-connection-mark=in_conn
add action=mark-connection chain=connetcion-BR comment="\B7\D6\C0\EB\CD\F8\D2\B3\CA\FD\BE\DD" connection-mark=in_conn connection-rate=0-400k layer7-protocol=http new-connection-mark="web conn" protocol=tcp
add action=mark-connection chain=connetcion-BR comment="\B6\AF\CC\AC\C1\F7\BF\D8\CA\FD\BE\DD\D0\D0\CE\AA\B1\E6\CA\B6\B1\ED\A3\AC\B7\D6\C0\EBudp\D0\AD\D2\E9\C9\CF\B5\C4\B3\AC\C1\BF\CF\C2\D4\D8\CA\FD\BE\DD" \
    connection-bytes=400000-0 connection-mark=in_conn connection-rate=200k-4294967295 new-connection-mark="IN_H conn" protocol=udp
add action=mark-connection chain=connetcion-BR comment="\B6\AF\CC\AC\C1\F7\BF\D8\CA\FD\BE\DD\D0\D0\CE\AA\B1\E6\CA\B6\B1\ED\A3\AC\B7\D6\C0\EBtcp\D0\AD\D2\E9\C9\CF\B5\C4\B3\AC\C1\BF\CF\C2\D4\D8\CA\FD\BE\DD" \
    connection-bytes=500000-0 connection-mark=in_conn connection-rate=200k-4294967295 new-connection-mark="IN_H conn" protocol=tcp
add action=mark-connection chain=connetcion-BR comment="\B1\EA\BC\C7\CA\A3\CF\C2\B5\C4\D0\A1\CA\FD\BE\DD\B0\FC" connection-mark=in_conn new-connection-mark="in small_conn"
add action=jump chain=connetcion-BR comment=\
    "\B6\AF\CC\AC\C1\F7\BF\D8\CA\FD\BE\DD\D0\D0\CE\AA\B1\E6\CA\B6\B1\ED\A3\AC\B0\D1\B7\D6\C0\EB\B3\AC\C1\BF\CF\C2\D4\D8\CA\FD\BE\DD\BA\F3\B5\C4\D5\FD\B3\A3\CD\A8\D0\C5\CA\FD\BE\DD\B5\A5\B6\C0\B1\EA\BC\C7" \
    connection-mark="in small_conn" jump-target=Game_chain
add action=jump chain=forward in-interface=CNC jump-target="html conn"
add action=mark-packet chain=forward comment="\CD\F8\D2\B3\CA\FD\BE\DD" connection-mark=webflash_conn in-interface=CNC new-packet-mark="CNC_webflash pack" passthrough=no
add action=jump chain=forward comment="\B0\D1\C1\F7\CF\F2\C4\DA\CD\F8\B5\C4\BE\DD\C1\F7\C8\AB\B2\BF\D2\D4\D0\D0\CE\AA\B7\BD\CA\BD\B7\D6\C0\EB\A3\AC\D3\C3\D3\DA\BF\CD\BB\A7\BB\FA\C1\F7\C1\BF\BF\D8\D6\C6\A1\A3" \
    in-interface=CNC jump-target=connetcion-BR
add action=mark-packet chain=forward comment="\D3\CE\CF\B7\CA\FD\BE\DD" connection-mark=game_conn in-interface=CNC new-packet-mark=CNC_game_pack passthrough=no
add action=mark-packet chain=forward comment="\CD\F8\D2\B3\CA\FD\BE\DD" connection-mark="web conn" in-interface=CNC new-packet-mark="CNC_web pack" passthrough=no
add action=mark-packet chain=forward comment="\D0\A1\CA\FD\BE\DD" connection-mark="in small_conn" in-interface=CNC new-packet-mark=CNC_s_pack passthrough=no
add action=mark-packet chain=forward comment="\B3\AC\C1\BF\CA\FD\BE\DD" connection-mark="IN_H conn" in-interface=CNC new-packet-mark="CNC_H pack" passthrough=no
add action=mark-packet chain=forward comment="\C6\E4\CB\FB\CA\FD\BE\DD" in-interface=CNC new-packet-mark=CNC_other_pack passthrough=no
add action=jump chain=forward comment="\B0\D1\C1\F7\CF\F2\C4\DA\CD\F8\B5\C4\BE\DD\C1\F7\C8\AB\B2\BF\D2\D4\D0\D0\CE\AA\B7\BD\CA\BD\B7\D6\C0\EB\A3\AC\D3\C3\D3\DA\BF\CD\BB\A7\BB\FA\C1\F7\C1\BF\BF\D8\D6\C6\A1\A3" \
    in-interface=TEL jump-target="html conn"
add action=mark-packet chain=forward comment="\CD\F8\D2\B3\CA\FD\BE\DD" connection-mark=webflash_conn in-interface=TEL new-packet-mark="TEL_webflash pack" passthrough=no
add action=jump chain=forward comment="\B0\D1\C1\F7\CF\F2\C4\DA\CD\F8\B5\C4\BE\DD\C1\F7\C8\AB\B2\BF\D2\D4\D0\D0\CE\AA\B7\BD\CA\BD\B7\D6\C0\EB\A3\AC\D3\C3\D3\DA\BF\CD\BB\A7\BB\FA\C1\F7\C1\BF\BF\D8\D6\C6\A1\A3" \
    in-interface=TEL jump-target=connetcion-BR
add action=mark-packet chain=forward comment="\D3\CE\CF\B7\CA\FD\BE\DD" connection-mark=game_conn in-interface=TEL new-packet-mark=TEL_game_pack passthrough=no
add action=mark-packet chain=forward comment="\CD\F8\D2\B3\CA\FD\BE\DD" connection-mark="web conn" in-interface=TEL new-packet-mark="TEL_web pack" passthrough=no
add action=mark-packet chain=forward comment="\D0\A1\CA\FD\BE\DD" connection-mark="in small_conn" in-interface=TEL new-packet-mark=TEL_s_pack passthrough=no
add action=mark-packet chain=forward comment="\B3\AC\C1\BF\CA\FD\BE\DD" connection-mark="IN_H conn" in-interface=TEL new-packet-mark="TEL_H pack" passthrough=no
add action=mark-packet chain=forward comment="\C6\E4\CB\FB\CA\FD\BE\DD" in-interface=TEL new-packet-mark=TEL_other_pack passthrough=no
add action=mark-connection chain="html conn" comment="\D3\C5\CF\C8\B1\EA\BC\C7dns" layer7-protocol=dns new-connection-mark=webflash_conn protocol=udp
add action=mark-connection chain="html conn" comment=flash connection-bytes=5000000-0 connection-rate=2M-4294967295 layer7-protocol=http_flash new-connection-mark=webflash_conn protocol=tcp
add action=mark-connection chain="html conn" comment=gif layer7-protocol=http_gif new-connection-mark=webflash_conn
add action=mark-connection chain="html conn" comment=html layer7-protocol=http_html new-connection-mark=webflash_conn
add action=mark-connection chain="html conn" comment=javascript layer7-protocol=http_javascript new-connection-mark=webflash_conn
add action=mark-connection chain="html conn" comment=jpeg layer7-protocol=http_jpeg new-connection-mark=webflash_conn
add action=mark-connection chain="html conn" comment=png layer7-protocol=http_png new-connection-mark=webflash_conn
add action=mark-connection chain="html conn" comment=rtsp connection-bytes=400000-0 connection-rate=200k-4294967295 layer7-protocol=http-rtsp new-connection-mark=webflash_conn protocol=tcp

#以下是限速脚本需要配合上面标记脚本使用。

/queue typeadd kind=pcq name=pcq-download-TEL pcq-classifier=dst-address pcq-total-limit=50000
add kind=pcq name=pcq-download-CNC pcq-classifier=dst-address pcq-total-limit=50000
add kind=pcq name=PcQ_src_WEBsmall pcq-classifier=src-address pcq-rate=4M pcq-total-limit=5000
add kind=pcq name=pcq-upload-game pcq-classifier=src-address pcq-total-limit=500
add kind=pcq name=pcq-download-TEL-H pcq-classifier=src-address pcq-total-limit=1500
set 11 pcq-rate=12M pcq-total-limit=1000
/queue tree
add name=CNCquse parent=global queue=default
add name=TELquse parent=global queue=default
add max-limit=11M name=CNC-game packet-mark=CNC_game_pack parent=CNCquse priority=1
add limit-at=4M max-limit=23M name=TEL-game packet-mark=TEL_game_pack parent=TELquse priority=1
add max-limit=23M name="Clse1 TEL" parent=TELquse queue=pcq-upload-default
add name="Clse1 CNC" parent=CNCquse queue=default
add name="Clse2 CNC" parent="Clse1 CNC" queue=default
add name="Clse3 CNC" parent="Clse2 CNC" queue=default
add limit-at=4M max-limit=23M name=TEL-webwebflash packet-mark="TEL_webflash pack" parent="Clse1 TEL" priority=2 queue=PcQ_src_WEBsmall
add limit-at=4M max-limit=23M name=CNC-webwebflash packet-mark="CNC_webflash pack" parent="Clse1 CNC" priority=2 queue=PcQ_src_WEBsmall
add max-limit=11M name=CNC-big packet-mark="CNC_H pack" parent="Clse3 CNC" priority=6
add max-limit=11M name=CNC-small packet-mark=CNC_s_pack parent="Clse2 CNC" priority=3
add max-limit=11M name=CNC-web packet-mark="CNC_web pack" parent="Clse2 CNC" priority=2
add max-limit=11M name="CNC other" packet-mark=CNC_other_pack parent="Clse3 CNC"
add max-limit=23M name="Clse2 TEL" parent="Clse1 TEL" queue=pcq-upload-default
add max-limit=23M name="Clse3 TEL" parent="Clse2 TEL" queue=pcq-upload-default
add max-limit=23M name=TEL-big packet-mark="TEL_H pack" parent="Clse3 TEL" priority=6
add max-limit=23M name=TEL-small packet-mark=TEL_s_pack parent="Clse2 TEL" priority=6
add max-limit=23M name=TEL-web packet-mark="TEL_web pack" parent="Clse2 TEL" priority=2
add max-limit=23M name="TEL other" packet-mark=TEL_other_pack parent="Clse3 TEL"

扫描上方二维码  关注《深圳网吧联盟》微信公众号  了解更多网吧猛料

手动输入微信号查找"szwblmcom"也可以关注到喔

相关热词搜索: 网通 电信 网页
上一篇:ROS分时段限速,双休固定限速,已修正脚本
下一篇:最后一页