Kau bisa bersembunyi dari kesalahanmu, tapi tidak dari penyesalanmu. Kau bisa bermain dengan dramamu, tapi tidak dengan karmamu.

  • About

    Seorang Teknisi Jaringan yang pernah berkecimpung di Internet Service Provider (ISP) dan akhirnya memutuskan diri untuk menjadi freelancer yang berdomisili di Solo, Surakarta Hadiningrat.

  • Services

    Melayani jasa pasang Internet berbasis Wireless maupun Fiber Optic, Jasa Pasang Tower/Pipa, Pointing Wireless, Setting Router, CCTV, Hotspot, Proxy, Web Server, Network Managed dan Monitoring

  • Contact

    Berbagai saran, kritikan, keluhan dan masukan akan sangat berarti bagi saya. Anda dapat menghubungi/whatsapp saya di nomor:08564-212-8686 atau melalui BBM:2128686

    Tuesday, August 27, 2019

    Kali ini saya akan bagi tips buat anda yang pengen bikin address-list akamai di mikrotik.
    OK, saya anggap anda bisa searching di bgp.he.net untuk mendapatkan informasi as-number akamai
    kemudian di blog ini juga sudah ada generate prefix berdasarkan asnumber, silahkan cari.
    setelah ini anggaplah sudah ter-generate dan muncul 2 file berisi list ip akamai tadi


    kemudian, gabunglah kedua file tadi
    /dump # cat  AS35994-AS35994-akamai.rsc >> AS20940-AS20940-akamai.rsc
    /dump # sort --unique -k7 AS20940-AS20940-akamai.rsc >> cidr_akamai.rsc 

    contoh hasilnya seperti berikut
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.251.0/24
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.252.0/22
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.34.0/24
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.38.0/24
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.40.0/24
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.48.0/24
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.51.0/24
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.54.0/23
    /ip firewall address-list add list=cidr_akamai comment=AS20940-akamai address=96.7.74.0/24

    jika sudah, maka siap di import di mikrotik anda.

    note::
     --unique = berarti filter ip address tanpa duplikat
    -k7 = adalah kolom ke-7 yang akan kita urutkan



    on-up
    ====

    :local remote
    :set remote $"remote-address"
    :log warning ("wellcome ppp-$user ( $remote )")
    :if ( [ /ppp secret get "$user" comment ] = "" ) do={
    :local month
    :local year
    :local yeardiv
    :local yearmult
    :local leapyear
    :local lastday
    :local date [ /system clock get date ]
    :local time [ /system clock get time ]
    # ambil nama bulan dan tahun dari date
    :set month [:pick $date 0 3]
    :set year [:pick $date 7 11]
    # check tahun kabisat atau bukan
    :set yeardiv ($year / 4)
    :set yearmult ($yeardiv * 4)
    :if ([$yearmult] = $year) do={ :set leapyear true } else={ :set leapyear false }
    # set nilai lastday sesuai nama bulan dan tahun
    :if ([$month] = "jan") do={ :set lastday 31d }
    :if ([$month] = "feb") do={
    :if ($leapyear = true) do={ :set lastday 29d }
    :if ($leapyear = false) do={ :set lastday 28d }
    }
    :if ([$month] = "mar") do={ :set lastday 31d }
    :if ([$month] = "apr") do={ :set lastday 30d }
    :if ([$month] = "may") do={ :set lastday 31d }
    :if ([$month] = "jun") do={ :set lastday 30d }
    :if ([$month] = "jul") do={ :set lastday 31d }
    :if ([$month] = "aug") do={ :set lastday 31d }
    :if ([$month] = "sep") do={ :set lastday 30d }
    :if ([$month] = "oct") do={ :set lastday 31d }
    :if ([$month] = "nov") do={ :set lastday 30d }
    :if ([$month] = "dec") do={ :set lastday 31d }
    # cek nilai lastday
    #:log info ("$lastday")
    /ppp secret set $user comment="$date $time"
    /system scheduler remove [find name="ppp-$user"]
    /system scheduler add interval=$lastday name="ppp-$user" on-event="/ppp active remove [find user=\"$user\"]\r\n/ppp secret disable [find name=\"$user\"]\r\n/system scheduler remove [find name=\"ppp-$user\"]" start-date=$date start-time=$time
    } else={
    :local zoky [ /ppp secret get "$user" comment ]
    :local zoky1 " $zoky"
    :local zoky2
    :for i from=0 to=([:len $zoky1] - 1) do={
    :local char [:pick $zoky1 $i]
    :if ($char = " ") do={
    :set $char "\\ "
    }
    :set zoky2 ($zoky2 . $char)
    }
    :local var $zoky2
    :local myArray [:toarray [:pick $var ([:find $var " "]+1) [:len $var]]]
    :local month
    :local year
    :local yeardiv
    :local yearmult
    :local leapyear
    :local lastday
    :local comdate [:pick $myArray 0]
    :local comtime [:pick $myArray 1]
    # ambil nama bulan dan tahun dari comdate
    :set month [:pick $comdate 0 3]
    :set year [:pick $comdate 7 11]
    # check tahun kabisat atau bukan
    :set yeardiv ($year / 4)
    :set yearmult ($yeardiv * 4)
    :if ([$yearmult] = $year) do={ :set leapyear true } else={ :set leapyear false }
    # set nilai lastday sesuai nama bulan dan tahun
    :if ([$month] = "jan") do={ :set lastday 31d }
    :if ([$month] = "feb") do={
    :if ($leapyear = true) do={ :set lastday 29d }
    :if ($leapyear = false) do={ :set lastday 28d }
    }
    :if ([$month] = "mar") do={ :set lastday 31d }
    :if ([$month] = "apr") do={ :set lastday 30d }
    :if ([$month] = "may") do={ :set lastday 31d }
    :if ([$month] = "jun") do={ :set lastday 30d }
    :if ([$month] = "jul") do={ :set lastday 31d }
    :if ([$month] = "aug") do={ :set lastday 31d }
    :if ([$month] = "sep") do={ :set lastday 30d }
    :if ([$month] = "oct") do={ :set lastday 31d }
    :if ([$month] = "nov") do={ :set lastday 30d }
    :if ([$month] = "dec") do={ :set lastday 31d }
    # cek nilai lastday
    #:log info ("$lastday")
    /system scheduler remove [find name="ppp-$user"]
    /system scheduler add interval=$lastday name="ppp-$user" on-event="/ppp active remove [find user=\"$user\"]\r\n/ppp secret disable [find name=\"$user\"]\r\n/system scheduler remove [find name=\"ppp-$user\"]" start-date=$comdate start-time=$comtime
    } :local profile [/ppp secret get [find name="$user"] profile]
    :local rateLimit [/ppp profile get [find name="$profile"] rate-limit]
    :local parent [/ppp profile get [find name="$profile"] parent]
    :local queue [/ppp profile get [find name="$profile"] queue]
    /queue simple remove [find name="$user-$remote"]
    /queue simple add max-limit="$rateLimit" name="$user-$remote" parent="$parent" queue="$queue/$queue" target="$remote"
    /queue simple remove [find where name~"-$user"]


    on-down
    ======
    :local remote
    :set remote $"remote-address"
    :log warning ("goodbye $user ( $remote )")
    :local bytes [/queue simple get [find name="$user-$remote"] bytes]
    :local totalbytes
    :local arraybytes [:toarray [:pick $bytes ([:find $bytes "/"]+1) [:len $bytes]]]
    :local upbytes [:pick $arraybytes 0]
    :local downbytes [:pick $arraybytes 1]
    :set totalbytes ($upbytes+$downbytes)
    :local zoky [/ppp secret get "$user" comment]
    :local zoky1 " $zoky"
    :local zoky2
    :for i from=0 to=([:len $zoky1] - 1) do={
    :local char [:pick $zoky1 $i]
    :if ($char = " ") do={
    :set $char "\\ "
    }
    :set zoky2 ($zoky2 . $char)
    }
    :local commentppp $zoky2
    :local arraycomment [:toarray [:pick $commentppp ([:find $commentppp " "]+1) [:len $commentppp]]]
    :local comdate [:pick $arraycomment 0]
    :local comtime [:pick $arraycomment 1]
    :local combytes [:pick $arraycomment 2]
    :if ($combytes = "") do={
    /ppp secret set "$user" comment="$comdate $comtime $totalbytes"
    } else={
    :local alltotalbytes
    :set alltotalbytes ($combytes+$totalbytes)
    /ppp secret set "$user" comment="$comdate $comtime $alltotalbytes"
    }
    /queue simple remove [find name="$user-$remote"]
    note
    ===
    profile harap di set max-limit, parent dan queue-typenya
    bikin scheduler di run perjam atau terserah anda intervalnya
    untuk update counter usagenya
    :local userppp
    :local usersimple
    :foreach i in=[/ppp secret find] do {
    :set userppp ( userppp [/ppp secret get $i name])
    :local zoky [/ppp secret get "$userppp" comment]
    :local zoky1 " $zoky"
    :local zoky2
    :for i from=0 to=([:len $zoky1] - 1) do={
    :local char [:pick $zoky1 $i]
    :if ($char = " ") do={
    :set $char "\\ "
    }
    :set zoky2 ($zoky2 . $char)
    }
    :local commentppp $zoky2
    :local arraycomment [:toarray [:pick $commentppp ([:find $commentppp " "]+1) [:len $commentppp]]]
    :local comdate [:pick $arraycomment 0]
    :local comtime [:pick $arraycomment 1]
    :local combytes [:pick $arraycomment 2]
    :if ([/ppp secret get [/ppp secret find name="$userppp"] profile] != "") do {
    :foreach j in=[/queue simple find where name~"$userppp"] do {
    :set usersimple ( usersimple [/queue simple get $j name])
    :local bytes [/queue simple get [/queue simple find name="$usersimple"] bytes]
    :local totalbytes
    :local arraybytes [:toarray [:pick $bytes ([:find $bytes "/"]+1) [:len $bytes]]]
    :local upbytes [:pick $arraybytes 0]
    :local downbytes [:pick $arraybytes 1]
    :set totalbytes ($upbytes+$downbytes)
    :if ($combytes < 0) do {
    :local alltotalbytes
    :if (($comtime < 0)&&($combytes < 0)) do {
    :set alltotalbytes ($comdate+$totalbytes)
    /ppp secret set "$userppp" comment="$alltotalbytes"
    } else {
    :set alltotalbytes ($combytes+$totalbytes)
    /ppp secret set "$userppp" comment="$comdate $comtime $alltotalbytes"
    }
    #:log warning "$userppp $comdate $comtime $combytes $usersimple $totalbytes $alltotalbytes"
    } else {
    :if ($totalbytes = $totalbytes) do {
    #:log warning "no update usage ppp"
    } else {
    :local alltotalbytes
    :if (($comtime < 0)&&($combytes < 0)) do {
    :set alltotalbytes ($comdate+$totalbytes)
    /ppp secret set "$userppp" comment="$alltotalbytes"
    } else {
    :set alltotalbytes ($combytes+$totalbytes)
    /ppp secret set "$userppp" comment="$comdate $comtime $alltotalbytes"
    }
    #:log warning "$userppp $comdate $comtime $combytes $usersimple $totalbytes $alltotalbytes"
    }
    }
    }
    }
    }

    credits : zoky raharjo (fb)