0% found this document useful (0 votes)
46 views

Settingan Dasar Mikrotik 4 Port

The document configures a MikroTik router to provide WiFi hotspot services with different user packages that have varying session durations (1 hour, 2 hours, 6 hours, 1 day) and data limits (512KB, 1MB, 1.5MB, 2MB). It sets up the hotspot interface, security profiles, address pools, and schedules tasks to automatically update user profiles when their sessions expire.

Uploaded by

aji febrianto
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

Settingan Dasar Mikrotik 4 Port

The document configures a MikroTik router to provide WiFi hotspot services with different user packages that have varying session durations (1 hour, 2 hours, 6 hours, 1 day) and data limits (512KB, 1MB, 1.5MB, 2MB). It sets up the hotspot interface, security profiles, address pools, and schedules tasks to automatically update user profiles when their sessions expire.

Uploaded by

aji febrianto
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

# dec/05/2019 00:14:22 by RouterOS 6.45.

7
# software id = C37B-C6QF
#
#
#
/interface bridge
add comment=HOTSPOT name=bridge1-HOTSPOT
/interface ethernet
set [ find default-name=ether4 ] comment=LAN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip hotspot profile
add dns-name=tukangsetting.net hotspot-address=192.168.100.1 login-by=\
http-chap name=hsprof1
/ip hotspot user profile
add !idle-timeout !keepalive-timeout name=paket1-1-jam on-login=":put (\",rem,\
5000,1h,0,,Enable,\"); {:local date [ /system clock get date ];:local year\
\_[ :pick \$date 7 11 ];:local month [ :pick \$date 0 3 ];:local comment [\
\_/ip hotspot user get [/ip hotspot user find where name=\"\$user\"] comme\
nt]; :local ucode [:pic \$comment 0 2]; :if (\$ucode = \"vc\" or \$ucode =\
\_\"up\" or \$comment = \"\") do={ /sys sch add name=\"\$user\" disable=no\
\_start-date=\$date interval=\"1h\"; :delay 2s; :local exp [ /sys sch get \
[ /sys sch find where name=\"\$user\" ] next-run]; :local getxp [len \$exp\
]; :if (\$getxp = 15) do={ :local d [:pic \$exp 0 6]; :local t [:pic \$exp\
\_7 16]; :local s (\"/\"); :local exp (\"\$d\$s\$year \$t\"); /ip hotspot \
user set comment=\$exp [find where name=\"\$user\"];}; :if (\$getxp = 8) d\
o={ /ip hotspot user set comment=\"\$date \$exp\" [find where name=\"\$use\
r\"];}; :if (\$getxp > 15) do={ /ip hotspot user set comment=\$exp [find w\
here name=\"\$user\"];}; /sys sch remove [find where name=\"\$user\"]; [:l\
ocal mac \$\"mac-address\"; /ip hotspot user set mac-address=\$mac [find w\
here name=\$user]]}}" parent-queue=none rate-limit=512k/1m \
session-timeout=1d transparent-proxy=yes
add !idle-timeout !keepalive-timeout name=paket-2-2-jam on-login=":put (\",rem\
,10000,2h,0,,Enable,\"); {:local date [ /system clock get date ];:local ye\
ar [ :pick \$date 7 11 ];:local month [ :pick \$date 0 3 ];:local comment \
[ /ip hotspot user get [/ip hotspot user find where name=\"\$user\"] comme\
nt]; :local ucode [:pic \$comment 0 2]; :if (\$ucode = \"vc\" or \$ucode =\
\_\"up\" or \$comment = \"\") do={ /sys sch add name=\"\$user\" disable=no\
\_start-date=\$date interval=\"2h\"; :delay 2s; :local exp [ /sys sch get \
[ /sys sch find where name=\"\$user\" ] next-run]; :local getxp [len \$exp\
]; :if (\$getxp = 15) do={ :local d [:pic \$exp 0 6]; :local t [:pic \$exp\
\_7 16]; :local s (\"/\"); :local exp (\"\$d\$s\$year \$t\"); /ip hotspot \
user set comment=\$exp [find where name=\"\$user\"];}; :if (\$getxp = 8) d\
o={ /ip hotspot user set comment=\"\$date \$exp\" [find where name=\"\$use\
r\"];}; :if (\$getxp > 15) do={ /ip hotspot user set comment=\$exp [find w\
here name=\"\$user\"];}; /sys sch remove [find where name=\"\$user\"]; [:l\
ocal mac \$\"mac-address\"; /ip hotspot user set mac-address=\$mac [find w\
here name=\$user]]}}" parent-queue=none rate-limit=512k/1m \
session-timeout=1d transparent-proxy=yes
add !idle-timeout !keepalive-timeout name=paket-3-6-jam on-login=":put (\",rem\
,15000,6h,0,,Enable,\"); {:local date [ /system clock get date ];:local ye\
ar [ :pick \$date 7 11 ];:local month [ :pick \$date 0 3 ];:local comment \
[ /ip hotspot user get [/ip hotspot user find where name=\"\$user\"] comme\
nt]; :local ucode [:pic \$comment 0 2]; :if (\$ucode = \"vc\" or \$ucode =\
\_\"up\" or \$comment = \"\") do={ /sys sch add name=\"\$user\" disable=no\
\_start-date=\$date interval=\"6h\"; :delay 2s; :local exp [ /sys sch get \
[ /sys sch find where name=\"\$user\" ] next-run]; :local getxp [len \$exp\
]; :if (\$getxp = 15) do={ :local d [:pic \$exp 0 6]; :local t [:pic \$exp\
\_7 16]; :local s (\"/\"); :local exp (\"\$d\$s\$year \$t\"); /ip hotspot \
user set comment=\$exp [find where name=\"\$user\"];}; :if (\$getxp = 8) d\
o={ /ip hotspot user set comment=\"\$date \$exp\" [find where name=\"\$use\
r\"];}; :if (\$getxp > 15) do={ /ip hotspot user set comment=\$exp [find w\
here name=\"\$user\"];}; /sys sch remove [find where name=\"\$user\"]; [:l\
ocal mac \$\"mac-address\"; /ip hotspot user set mac-address=\$mac [find w\
here name=\$user]]}}" parent-queue=none rate-limit=512k/1m \
session-timeout=1d transparent-proxy=yes
add !idle-timeout !keepalive-timeout name=paket-4-1-hari on-login=":put (\",re\
m,20000,1d,0,,Disable,\"); {:local date [ /system clock get date ];:local \
year [ :pick \$date 7 11 ];:local month [ :pick \$date 0 3 ];:local commen\
t [ /ip hotspot user get [/ip hotspot user find where name=\"\$user\"] com\
ment]; :local ucode [:pic \$comment 0 2]; :if (\$ucode = \"vc\" or \$ucode\
\_= \"up\" or \$comment = \"\") do={ /sys sch add name=\"\$user\" disable=\
no start-date=\$date interval=\"1d\"; :delay 2s; :local exp [ /sys sch get\
\_[ /sys sch find where name=\"\$user\" ] next-run]; :local getxp [len \$e\
xp]; :if (\$getxp = 15) do={ :local d [:pic \$exp 0 6]; :local t [:pic \$e\
xp 7 16]; :local s (\"/\"); :local exp (\"\$d\$s\$year \$t\"); /ip hotspot\
\_user set comment=\$exp [find where name=\"\$user\"];}; :if (\$getxp = 8)\
\_do={ /ip hotspot user set comment=\"\$date \$exp\" [find where name=\"\$\
user\"];}; :if (\$getxp > 15) do={ /ip hotspot user set comment=\$exp [fin\
d where name=\"\$user\"];}; /sys sch remove [find where name=\"\$user\"]}}\
" parent-queue=none rate-limit=512k/1m session-timeout=1d \
transparent-proxy=yes
/ip pool
add name=hs-pool-5 ranges=192.168.100.2-192.168.100.254
add name=dhcp_pool2 ranges=192.168.1.2-192.168.1.254
/ip dhcp-server
add address-pool=hs-pool-5 disabled=no interface=bridge1-HOTSPOT lease-time=\
1h name=dhcp2
add address-pool=dhcp_pool2 disabled=no interface=ether4 name=dhcp1
/ip hotspot
add address-pool=hs-pool-5 disabled=no interface=bridge1-HOTSPOT name=\
hotspot1 profile=hsprof1
/lora servers
add address=eu.mikrotik.thethings.industries down-port=1700 name=TTN-EU \
up-port=1700
add address=us.mikrotik.thethings.industries down-port=1700 name=TTN-US \
up-port=1700
add address=eu.mikrotik.thethings.industries down-port=1700 name=TTN-EU \
up-port=1700
add address=us.mikrotik.thethings.industries down-port=1700 name=TTN-US \
up-port=1700
/tool user-manager customer
set admin access=\
own-routers,own-users,own-profiles,own-limits,config-payment-gw
/user group
add name=group1 policy="local,telnet,ssh,ftp,reboot,read,write,policy,test,pas\
sword,web,sniff,sensitive,api,romon,tikapp,!winbox,!dude" skin=user
/interface bridge port
add bridge=bridge1-HOTSPOT interface=ether2
add bridge=bridge1-HOTSPOT interface=ether3
/interface l2tp-server server
set enabled=yes
/interface pptp-server server
set enabled=yes
/ip address
add address=192.168.100.1/24 interface=bridge1-HOTSPOT network=192.168.100.0
add address=192.168.1.1/24 interface=ether4 network=192.168.1.0
/ip cloud
set update-time=no
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1
/ip dhcp-server network
add address=192.168.1.0/24 gateway=192.168.1.1
add address=192.168.100.0/24 comment="hotspot network" gateway=192.168.100.1
/ip dns
set allow-remote-requests=yes servers=8.8.8.8
/ip firewall filter
add action=passthrough chain=unused-hs-chain comment=\
"place hotspot rules here" disabled=yes
/ip firewall nat
add action=passthrough chain=unused-hs-chain comment=\
"place hotspot rules here" disabled=yes
add action=masquerade chain=srcnat out-interface=ether1
add action=masquerade chain=srcnat comment="masquerade hotspot network" \
src-address=192.168.100.0/24
/ip hotspot user
add name=admin
/ppp secret
add local-address=192.168.2.1 name=admin password=pantau remote-address=\
192.168.2.2 service=l2tp
add local-address=192.168.10.1 name=admin password=pantau remote-address=\
192.168.10.2 service=pptp
/system clock
set time-zone-autodetect=no time-zone-name=Asia/Jakarta
/system identity
set name="Tukang Setting"
/system lcd
set contrast=0 enabled=no port=parallel type=24x4
/system lcd page
set time disabled=yes display-time=5s
set resources disabled=yes display-time=5s
set uptime disabled=yes display-time=5s
set packets disabled=yes display-time=5s
set bits disabled=yes display-time=5s
set version disabled=yes display-time=5s
set identity disabled=yes display-time=5s
set bridge1-HOTSPOT disabled=yes display-time=5s
set ether4 disabled=yes display-time=5s
set ether1 disabled=yes display-time=5s
set ether2 disabled=yes display-time=5s
set ether3 disabled=yes display-time=5s
/system logging
add action=disk prefix=-> topics=hotspot,info,debug
/system scheduler
add comment="Monitor Profile paket1-1-jam" interval=2m45s name=paket1-1-jam \
on-event=":local dateint do={:local montharray ( \"jan\",\"feb\",\"mar\",\
\"apr\",\"may\",\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );\
:local days [ :pick \$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [\
\_:pick \$d 7 11 ];:local monthint ([ :find \$montharray \$month]);:local \
month (\$monthint + 1);:if ( [len \$month] = 1) do={:local zero (\"0\");:r\
eturn [:tonum (\"\$year\$zero\$month\$days\")];} else={:return [:tonum (\"\
\$year\$month\$days\")];}}; :local timeint do={ :local hours [ :pick \$t 0\
\_2 ]; :local minutes [ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes\
) ; }; :local date [ /system clock get date ]; :local time [ /system clock\
\_get time ]; :local today [\$dateint d=\$date] ; :local curtime [\$timein\
t t=\$time] ; :foreach i in [ /ip hotspot user find where profile=\"paket1\
-1-jam\" ] do={ :local comment [ /ip hotspot user get \$i comment]; :local\
\_name [ /ip hotspot user get \$i name]; :local gettime [:pic \$comment 12\
\_20]; :if ([:pic \$comment 3] = \"/\" and [:pic \$comment 6] = \"/\") do=\
{:local expd [\$dateint d=\$comment] ; :local expt [\$timeint t=\$gettime]\
\_; :if ((\$expd < \$today and \$expt < \$curtime) or (\$expd < \$today an\
d \$expt > \$curtime) or (\$expd = \$today and \$expt < \$curtime)) do={ [\
\_/ip hotspot user remove \$i ]; [ /ip hotspot active remove [find where u\
ser=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=dec/04/2019 start-time=05:34:46
add comment="Monitor Profile paket-2-2-jam" interval=2m31s name=paket-2-2-jam \
on-event=":local dateint do={:local montharray ( \"jan\",\"feb\",\"mar\",\
\"apr\",\"may\",\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );\
:local days [ :pick \$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [\
\_:pick \$d 7 11 ];:local monthint ([ :find \$montharray \$month]);:local \
month (\$monthint + 1);:if ( [len \$month] = 1) do={:local zero (\"0\");:r\
eturn [:tonum (\"\$year\$zero\$month\$days\")];} else={:return [:tonum (\"\
\$year\$month\$days\")];}}; :local timeint do={ :local hours [ :pick \$t 0\
\_2 ]; :local minutes [ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes\
) ; }; :local date [ /system clock get date ]; :local time [ /system clock\
\_get time ]; :local today [\$dateint d=\$date] ; :local curtime [\$timein\
t t=\$time] ; :foreach i in [ /ip hotspot user find where profile=\"paket-\
2-2-jam\" ] do={ :local comment [ /ip hotspot user get \$i comment]; :loca\
l name [ /ip hotspot user get \$i name]; :local gettime [:pic \$comment 12\
\_20]; :if ([:pic \$comment 3] = \"/\" and [:pic \$comment 6] = \"/\") do=\
{:local expd [\$dateint d=\$comment] ; :local expt [\$timeint t=\$gettime]\
\_; :if ((\$expd < \$today and \$expt < \$curtime) or (\$expd < \$today an\
d \$expt > \$curtime) or (\$expd = \$today and \$expt < \$curtime)) do={ [\
\_/ip hotspot user remove \$i ]; [ /ip hotspot active remove [find where u\
ser=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=dec/04/2019 start-time=03:14:39
add comment="Monitor Profile paket-3-6-jam" interval=2m28s name=paket-3-6-jam \
on-event=":local dateint do={:local montharray ( \"jan\",\"feb\",\"mar\",\
\"apr\",\"may\",\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"nov\",\"dec\" );\
:local days [ :pick \$d 4 6 ];:local month [ :pick \$d 0 3 ];:local year [\
\_:pick \$d 7 11 ];:local monthint ([ :find \$montharray \$month]);:local \
month (\$monthint + 1);:if ( [len \$month] = 1) do={:local zero (\"0\");:r\
eturn [:tonum (\"\$year\$zero\$month\$days\")];} else={:return [:tonum (\"\
\$year\$month\$days\")];}}; :local timeint do={ :local hours [ :pick \$t 0\
\_2 ]; :local minutes [ :pick \$t 3 5 ]; :return (\$hours * 60 + \$minutes\
) ; }; :local date [ /system clock get date ]; :local time [ /system clock\
\_get time ]; :local today [\$dateint d=\$date] ; :local curtime [\$timein\
t t=\$time] ; :foreach i in [ /ip hotspot user find where profile=\"paket-\
3-6-jam\" ] do={ :local comment [ /ip hotspot user get \$i comment]; :loca\
l name [ /ip hotspot user get \$i name]; :local gettime [:pic \$comment 12\
\_20]; :if ([:pic \$comment 3] = \"/\" and [:pic \$comment 6] = \"/\") do=\
{:local expd [\$dateint d=\$comment] ; :local expt [\$timeint t=\$gettime]\
\_; :if ((\$expd < \$today and \$expt < \$curtime) or (\$expd < \$today an\
d \$expt > \$curtime) or (\$expd = \$today and \$expt < \$curtime)) do={ [\
\_/ip hotspot user remove \$i ]; [ /ip hotspot active remove [find where u\
ser=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=dec/04/2019 start-time=03:54:40
add comment="Monitor Profile paket-4-1-hari" interval=2m23s name=\
paket-4-1-hari on-event=":local dateint do={:local montharray ( \"jan\",\"\
feb\",\"mar\",\"apr\",\"may\",\"jun\",\"jul\",\"aug\",\"sep\",\"oct\",\"no\
v\",\"dec\" );:local days [ :pick \$d 4 6 ];:local month [ :pick \$d 0 3 ]\
;:local year [ :pick \$d 7 11 ];:local monthint ([ :find \$montharray \$mo\
nth]);:local month (\$monthint + 1);:if ( [len \$month] = 1) do={:local ze\
ro (\"0\");:return [:tonum (\"\$year\$zero\$month\$days\")];} else={:retur\
n [:tonum (\"\$year\$month\$days\")];}}; :local timeint do={ :local hours \
[ :pick \$t 0 2 ]; :local minutes [ :pick \$t 3 5 ]; :return (\$hours * 60\
\_+ \$minutes) ; }; :local date [ /system clock get date ]; :local time [ \
/system clock get time ]; :local today [\$dateint d=\$date] ; :local curti\
me [\$timeint t=\$time] ; :foreach i in [ /ip hotspot user find where prof\
ile=\"paket-4-1-hari\" ] do={ :local comment [ /ip hotspot user get \$i co\
mment]; :local name [ /ip hotspot user get \$i name]; :local gettime [:pic\
\_\$comment 12 20]; :if ([:pic \$comment 3] = \"/\" and [:pic \$comment 6]\
\_= \"/\") do={:local expd [\$dateint d=\$comment] ; :local expt [\$timein\
t t=\$gettime] ; :if ((\$expd < \$today and \$expt < \$curtime) or (\$expd\
\_< \$today and \$expt > \$curtime) or (\$expd = \$today and \$expt < \$cu\
rtime)) do={ [ /ip hotspot user remove \$i ]; [ /ip hotspot active remove \
[find where user=\$name] ];}}}" policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-date=dec/04/2019 start-time=04:35:34
/tool user-manager database
set db-path=/user-manager

You might also like