Skip to content Skip to sidebar Skip to footer

MikroTik Bandwidth Management + Web Proxy

mtk
Script MikroTik in Black and White

========================

First you need to determining your network model.

in this case we used subnetmask Class "C"

-----------------------------------

255.255.255.0           = 24 -> 254

255.255.255.128       = 25 -> 128

255.255.255.192       = 26 -> 64

255.255.255.224       = 27 -> 32

255.255.255.240       = 28 -> 16

255.255.255.248       = 29 -> 8

255.255.255.252 = 30 -> 4

255.255.255.254 = 31 -> 2

255.255.255.255 = 32 -> 1

        ------------------------------

Note :  if using WinBox Just copy-paste to terminal/linegroup.. Here we go.....;)

           (ISP line  Up to 1 Mbps)


/interface
set 0 name=public
set 1 name=local


password


system identity set name=newbie


/ip address add address=192.168.1.2/24 netmask=255.255.255.0 interface=public comment="Internet"
/ip address add address=192.168.0.1/28 netmask=255.255.255.240 interface=local comment = "LAN"


/ip route add gateway=192.168.1.1


/ip dns set primary-dns=8.8.8.8 allow-remoterequests=yes
/ip dns set secondary-dns=8.8.4.4 allow-remoterequests=yes




/ip web-proxy
set enabled=yes src-address=0.0.0.0 port=3128 hostname="computersnewbie.blogspot.com" transparent-proxy=yes parent-proxy=0.0.0.0:0 cache-administrator="computersnewbie@groups.facebook.com" max-object-size=8192KiB cache-drive=system max-cache-size=unlimited max-ram-cache-size=unlimited


/ip firewall nat
add chain=dstnat protocol=tcp dst-port=80 action=redirect to-ports=3128 disabled=no
add chain=dstnat protocol=tcp dst-port=8080 action=redirect to-ports=3128 disabled=no
add chain=dstnat protocol=tcp dst-port=8000 action=redirect to-ports=3128
add chain=scrnat out-interface=public action=masquerade




/ip firewall mangle

add chain=prerouting protocol=icmp action=mark-connection new-connection-mark=icmp-con passthrough=yes comment="" disabled=no

add chain=prerouting protocol=icmp connection-mark=icmp-con action=mark-packet new-packet-mark=icmp-pkt passthrough=no comment="" disabled=no

add chain=prerouting action=mark-connection new-connection-mark=con-up passthrough=yes comment=""

add chain=prerouting action=mark-packet new-packet-mark=all-pkt connection-mark=con-up passthrough=no comment=""

add chain=output content="X-Cache: HIT" action=mark-connection new-connection-mark=proxy-con passthrough=yes comment="" disabled=no

add chain=output connection-mark=proxy-con action=mark-packet new-packet-mark=proxy-pkt passthrough=no comment="" disabled=no

add chain=forward action=mark-connection new-connection-mark=direct-con passthrough=yes comment="" disabled=no

add chain=forward protocol=tcp connection-mark=direct-con action=mark-packet new-packet-mark=all-pkt passthrough=no comment="" disabled=no

add chain=output protocol=tcp connection-mark=direct-con action=mark-packet new-packet-mark=all-pkt passthrough=no comment="" disabled=no





/queue simple

add name="proxy-HIT" dst-address=0.0.0.0/0 interface=all parent=none packet-marks=proxy-pkt direction=both priority=8 queue=default-small/default-small limit-at=0/0 max-limit=0/0 total-queue=default-small disabled=no

add name="Ping-queue" dst-address=0.0.0.0/0 interface=all parent=none packet-marks=icmp-pkt direction=both priority=2 queue=default-small/default-small limit-at=0/0 max-limit=0/0 total-queue=default-small disabled=no

add name="Parent-queue" dst-address=0.0.0.0/0 interface=all parent=none direction=both priority=8 queue=default-small/default-small limit-at=0/0 max-limit=200000/850000 total-queue=default-small disabled=no



/queue simple

add name="Billing" target-addresses=192.168.0.2 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="1" target-addresses=192.168.0.3 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="2" target-addresses=192.168.0.4 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="3" target-addresses=192.168.0.5 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="4" target-addresses=192.168.0.6 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="5" target-addresses=192.168.0.7 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="6" target-addresses=192.168.0.8 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="7" target-addresses=192.168.0.9 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="8" target-addresses=192.168.0.10 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="9" target-addresses=192.168.0.11 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no

add name="10" target-addresses=192.168.0.12 dst-address=0.0.0.0/0 interface=all parent=Parent-queue packet-marks=all-pkt direction=both priority=3 queue=default-small/default-small limit-at=20000/85000 max-limit=32000/100000 total-queue=default-small disabled=no





7 comments for "MikroTik Bandwidth Management + Web Proxy"

  1. Thank's for sharing, itu untuk queue nya yang di limit apaan bos? thx

    ReplyDelete
  2. target-addresses=192.168.0.2-12....harusnya cuma packet public,tapi dalam kenyataannya yg proxy HIT juga ikut kelimit...ada solusi bro...xixiixi :)

    ReplyDelete
  3. target for proxy office ?
    I ask ......


    Thank's

    ReplyDelete
  4. sir is this useful in computer shop?i mean, does this script seperates the online gaming & browsing?

    ReplyDelete
  5. Great article, Thanks for your great information, the content is quiet interesting. I will be waiting for your next post.

    ReplyDelete