Wednesday 6 January 2016

Queue Tree Untuk Hotspot

ether1 = internet gateway (WAN)
ether2 = 192.168.10.1/24 (Hotspot) ==> dibuat dhcp
Kemudian setting hotspot (ga perlu dijelasin ya soalnya udah banyak tutorial nya kalo setting hotspot)
langsung aja :
/ip firewall mangle
add chain=prerouting action=jump jump-target=hotspot comment="Hotspot Jump Mangle"
add chain=postrouting action=jump jump-target=hotspot

add chain=prerouting action=mark-connection new-connection-mark=conn-up passthrough=yes dst-address=192.168.10.0/24 comment="Hotspot Connections"
add chain=postrouting action=mark-connection new-connection-mark=conn-down passthrough=yes src-address=192.168.10.0/24

add chain=prerouting action=mark-packet new-packet-mark=packet-up passthrough=yes connection-mark=conn-up comment="Hotspot Packets"
add chain=postrouting action=mark-packet new-packet-mark=packet-down passthrough=yes connection-mark=conn-down

add chain=prerouting action=mark-packet new-packet-mark=hotspot-up passthrough=no connection-mark=conn-up
add chain=postrouting action=mark-packet new-packet-mark=hotspot-down passthrough=no connection-mark=conn-down

Setelah mangle utama kita buat, sekarang kita akan menambahkan lagi mangle untuk memisahkan jalur browsing, download, facebook dan youtube


/ip firewall layer7-protocol
add name=Download regexp="^.*(get|GET).+\\.(exe|rar|zip|7z|cab|asf|mov|wmv|mpg|mpeg|mkv|avi|flv|pdf|wav|rm|mp3|mp4|ram|rmvb|dat|daa|iso|nrg|bin|vcd|mp2|3gp|mpe|qt|raw|wma|ogg|doc|deb|tar|bzip|gzip|gzip2|0[0-1][0-1]).*\$"
add name=Facebook regexp="^.*get.+.facebook.com.*\$|^.*get.+.zynga.com.*\$|^.*get.+.fbcdn.net.*\$"
add name=Youtube regexp="^.*get.+.c.youtube.com.*\$"
Setelah layer-7-protocol kita tambahkan, kita buat mangle nya.

/ip firewall mangle
add chain=hotspot action=mark-packet new-packet-mark=facebook passthrough=no protocol=tcp layer7-protocol=Facebook comment="Facebook"
add chain=hotspot action=mark-packet new-packet-mark=youtube passthrough=no protocol=tcp layer7-protocol=Youtube comment="Youtube"
add chain=hotspot action=mark-packet new-packet-mark=download passthrough=no protocol=tcp layer7-protocol=Download comment="Download"
 Selesai pembuatan mangle sekarang kita ubah settingan hotspot user profile nya. Disini saya memakai contoh profile Hotspot.
Click here to enlarge

 
Sekarang kita buat queue tree nya

/queue type
add name="pcq-down" kind=pcq pcq-rate=1M pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000 pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32 pcq-dst-address-mask=32 pcq-src-address6-mask=64 pcq-dst-address6-mask=64
add name="pcq-up" kind=pcq pcq-rate=1M pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000 pcq-burst-rate=0 pcq-burst-threshold=0 pcq-burst-time=10s pcq-src-address-mask=32 pcq-dst-address-mask=32 pcq-src-address6-mask=64 pcq-dst-address6-mask=64

/queue tree
add name="Hotspot Down" parent=global-out packet-mark="" limit-at=0 priority=8 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
add name="Hotspot Up" parent=global-in packet-mark="" limit-at=0 priority=8 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s 
add name="Hotspot Browsing" parent="Hotspot Down" packet-mark=hotspot-down limit-at=256k queue=pcq-down priority=2 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
add name="Hotspot Facebook" parent="Hotspot Down" packet-mark=facebook limit-at=256k queue=pcq-down priority=2 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
add name="Hotspot Youtube" parent="Hotspot Down" packet-mark=youtube limit-at=128k queue=pcq-down priority=8 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
add name="Hotspot Download" parent="Hotspot Down" packet-mark=download limit-at=128k queue=pcq-down priority=8 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
add name="Hotspot Upload" parent="Hotspot Up" packet-mark=hotspot-up limit-at=256k queue=pcq-up priority=8 max-limit=1M burst-limit=0 burst-threshold=0 burst-time=0s
finis

1 comment:

  1. setelah saya coba smua script work ,tapi saat paste script /queue tree itu tidak work ,mohon di koreksi scriptnya......

    ReplyDelete