Friday, November 4, 2011

mikrotik squid

/ip firewall mangle
add action=mark-packet chain=forward comment="squid" disabled=no dscp=12 new-packet-mark=mark-Hit passthrough=no

/queue tree
add name="2-squid" disabled=no max-limit=0 packet-mark=mark-Hit parent=global-out priority=2 queue=default


add chain=forward action=mark-connection new-connection-mark=mark-Hit passthrough=yes protocol=tcp src-address-list=proxy dst-address-list=local

add chain=forward action=mark-packet new-packet-mark=mark-Hit passthrough=no connection-mark=mark-Hit

script mikrotik biar ndak pegel jari

warnet
:for e from=2 to=35 do={
/ip fi ma
add chain=forward src-address="192.168.2.$e" dst-address-list=nice action=mark-connection new-connection-mark="IIX$e" comment="w$e"
add chain=forward connection-mark="IIX$e" action=mark-packet new-packet-mark="limit-iix$e"
add chain=forward src-address="192.168.2.$e" dst-address-list=!nice action=mark-connection new-connection-mark="INT$e"
add chain=forward connection-mark="INT$e" action=mark-packet new-packet-mark="limit-int$e"
add chain=forward src-address="192.168.2.$e" in-interface=ether2-warnet packet-mark="Upload0$e"
}


/que tr
add name=Total-Download parent=ether2-warnet
add name=Download-IIX parent=Total-Download
add name=Download-INT parent=Total-Download


:for e from=2 to=35 do={
/que tr
add name="iix$e" parent=Download-IIX packet-mark="limit-iix$e" limit-at=64k max-limit=640k
add name="int$e" parent=Download-INT packet-mark="limit-int$e" limit-at=32k max-limit=320k
}

hotspot

:for e from=10 to=26 do={
/ip fi ma
add chain=forward src-address="192.168.4.$e" dst-address-list=nice action=mark-connection new-connection-mark="hIIX$e" comment="h$e"
add chain=forward connection-mark="hIIX$e" action=mark-packet new-packet-mark="hlimit-iix$e"
add chain=forward src-address="192.168.4.$e" dst-address-list=!nice action=mark-connection new-connection-mark="hINT$e"
add chain=forward connection-mark="hINT$e" action=mark-packet new-packet-mark="hlimit-int$e"
add chain=forward src-address="192.168.4.$e" in-interface=ether4-hotspot packet-mark="hUpload0$e"
}

/que tr
add name=hotspot parent=ether4-hotspot
add name=hotspot-IIX parent=hotspot
add name=hotspot-INT parent=hotspot


:for e from=10 to=26 do={
/que tr
add name="hiix$e" parent=hotspot-IIX packet-mark="hlimit-iix$e" limit-at=32k max-limit=256k
add name="hintl$e" parent=hotspot-INT packet-mark="hlimit-int$e" limit-at=32k max-limit=128k
}