Pré-Requisitos:
RouterOS com versão 7.1.12
Mikrotik com Link de Internet já configurado e operacional
Acesso ao Mikrotik com permissões de admin ou super usuário.
Início da Configuração:
Vá em Bridge clique em "New"
Escolha um Nome para identificação posterior e clique em Apply e depois em OK
Vá em IP > Addresses
Clique em New e Preencha da seguinte forma:
Address: defina o IP que servirá de gateway para o hotspot e sua respectiva Netmask
Interface: Escolha a Bridge que acabou de criar
Clique em Apply e OK
Abra IP > Hotspot
Vá na aba Servers e Escolha Hotspot Setup
Na janela do Hotpost Setup escolha a interface Bridge que foi criada para o Hotpost e clique em Next.
Mantenha a configuração herdada do Addresses e mantenha o Masquerade Network Ativo e clique em Next
Mantenha o Pool de IP de acordo com a configuração herdada e clique em Next
Deixe Select Certificate = none e clique em Next
Deixe o SMTP 0.0.0.0 e clique em Next
Configure os Servidores DNS caso não tenha feito ainda e clique em Next
Deixe o DNS Name em branco e clique em Next
Na configuração de User manter conforme a configuração padrão abaixo e clique em Next
Após isso o setup estará completo.
Ainda na aba Servers edite o hotspot1 que foi criado com o setup acima
Altere o Name para ThinkWiFi
Idle Timeout configure conforme sua necessidade
Addresses per Mac altere para 1
Na sequência clique em Apply e OK
Alterne para a aba Server Profiles edite o server profile criado pelo hotspot setup vá na aba Login e deixe apenas a opção HTTP PAP marcado
Troque para a aba RADIUS e marque a opção Use RADIUS
Clique em Apply e OK
Agora é necessário criar os arquivos de Login, Logout e Redirect com o MAC da ether1
Primeiro apague todos os arquivos no Files que foi gerado no Hotspot Setup
E faça upload da pasta com os arquivos HTML corretos
Download dos Arquivos Base do Mikrotik
Após o download edite os seguintes Arquivos login.html, logout.html e status.html em cada arquivo será necessário alterar o MAC no parâmetro Called para o MAC da Ether 1 do Mikrotik e salve as alterações em cada arquivo. ** IMPORTANTE edite exatamente os 3 arquivos **
Uma vez com os arquivos salvos, faça o upload na pasta flash do Mikrotik caso ela exista, se não existir basta inserir diretamente no files do Mikrotik
Após o upload vai ficar com essa estrutura abaixo:
Feito o upload volte em IP > Hotspot e selecione a aba Server Profiles, edite o perfil criado e altere o HTML Directory selecione a pasta hotspot/thinkwifi
Abra o terminal e execute os Scripts abaixo:
Criação dos Radius:
/radius add address=52.73.98.38 comment="THINK RADIUS PRI" secret=zoox@zoox** service=hotspot timeout=3s add address=50.16.222.31 comment="THINK RADIUS SEC" secret=zoox@zoox** service=hotspot timeout=3s
Script para configuração do Walled Garden:
/ip hotspot walled-garden add comment="LIBERA PAGINA DE LOGIN" dst-host=portal.zooxwifi.com add comment="place hotspot rules here" disabled=yes add dst-host=*.1e100.net add dst-host=*.airfrance.com add dst-host=*.akamai.net add dst-host=*.akamaiedge.net add dst-host=*.akamaihd.net add dst-host=*.akamaitechnologies.com add dst-host=*.amazonws.com add dst-host=*.bam.nr-data.net add dst-host=*.cloudflare.com add dst-host=*.cloudfront.com add dst-host=*.cloudfront.net add dst-host=*.doubleclick.com add dst-host=*.doubleclick.net* add dst-host=*.edgecastcdn.net add dst-host=*.edgekey.net add dst-host=*.facebook.com* add dst-host=*.fastly.net add dst-host=*.fbcdn.net add dst-host=*.google-analytics.com* add dst-host=*.instagram.com* add dst-host=*.intvbrasil.com.br add dst-host=*.js-agent.newrelic.com add dst-host=*.licdn.net add dst-host=*.linkedin.com add dst-host=*.ngrok.io add dst-host=*.twimg.com add dst-host=*.twitter.com add dst-host=*.vimeo.com add dst-host=*.vimeocdn.com add dst-host=*airport.us add dst-host=*amazonaws.com* add dst-host=*cdn.zooxwifi.com* dst-port=80,443 add dst-host=*cloudflare.com dst-port=443 add dst-host=*cloudflare.com* add dst-host=*code.jquery.com* add dst-host=*doubleclick.net add dst-host=*facebook.com add dst-host=*googleapis.com add dst-host=*.fbsbx.com add dst-host=*googleads.g.doubleclick.net* dst-port=443 add dst-host=*google-analytics.com* add dst-host=*googlevideo.com add dst-host=*ibook.info add dst-host=*itools.info add dst-host=*jquery.com* add dst-host=*s3-sa-east-1.amazonaws.com* add dst-host=*s3-sa-east-1.amazonaws.com/static-intv* add dst-host=*sa-east-1.amazonaws.com add dst-host=*stats.g.doubleclick.net* add dst-host=*zoox.com.br* add dst-host=*zooxwifi.com dst-port=80,443 add dst-host=.cloudfront.net add dst-host=.facebook.com add dst-host=ad.doubleclick.net add dst-host=fbcdn.com add dst-host=fbcdn.net add dst-host=.google-analytics.com* add dst-host=.instagram.com add dst-host=ad.doubleclick.net add dst-host=amazonaws.com add dst-host=cdn.zooxwifi.com dst-port=80,443 add dst-host=google.com/analytics/web/inpage/pub add dst-host=google.com/analytics/web/inpage/pub dst-port=443 add dst-host=google-analytics.com/analytics add dst-host=google-analytics.com/analytics dst-port=443 add dst-host=google-analytics.com/analytics.js add dst-host=google-analytics.com/analytics.js dst-port=443 add dst-host=google-analytics.com/collect add dst-host=google-analytics.com/collect dst-port=443 add dst-host=google-analytics.com/gtm/ add dst-host=google-analytics.com/gtm/ dst-port=443 add dst-host=google-analytics.com/plugins/ add dst-host=google-analytics.com/plugins/ dst-port=443 add dst-host=google-analytics.com/r add dst-host=google-analytics.com/r dst-port=443 add dst-host=google-analytics.com/r/collect add dst-host=google-analytics.com/r/collect dst-port=443 add dst-host=intvbrasil.com.br add dst-host=s3.amazonaws.com add dst-host=s3.amazonws.com add dst-host=s3-sa-east-1.amazonaws.com add dst-host=stats.g.doubleclick.net add dst-host=stats.g.doubleclick.net/r/collect add dst-host=stats.g.doubleclick.net/r/collect dst-port=443 add dst-host=twitter.com add dst-host=wifiads.intvbrasil.com.br add dst-host=wifiads.intvbrasil.com.br add dst-host=*zoox.com.br add dst-host=*.zoox.login add dst-host=*.zooxsmart.com add dst-host=thinkdigital.portal.zooxwifi.com /ip hotspot walled-garden ip add comment="Hotspot" dst-address= 10.5.50.1 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.64.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.65.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.66.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.67.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.68.52/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.69.240/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.70.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.71.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.72.52/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.73.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.74.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.75.52/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.76.81/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.77.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.78.53/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.79.195/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.80.53/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.81.53/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.82.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.83.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.84.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.85.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.86.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.87.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.88.49/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.90.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.91.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.92.52/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.93.51/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 31.13.95.63/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.22.198.204/30 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.22.210.32/30 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.22.210.128/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.22.225.64/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.22.235.248/30 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.22.240.160/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.23.90.128/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 50.97.57.128/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 75.126.39.32/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.174.0/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.176.192/26 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.177.0/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.180.96/27 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.254.65/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.255.224/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 108.168.255.227/32 /ip hotspot walled-garden ip add comment="whatsapp" dst-address= 158.85.0.96/27 /ip hotspot walled-garden ip add action=accept comment=AMAZON disabled=no dst-address=52.0.0.0/8 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment=AMAZON disabled=no dst-address=54.0.0.0/8 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=31.13.24.0/21 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=31.13.64.0/18 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=45.64.40.0/22 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=66.220.144.0/20 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=69.63.176.0/20 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=69.171.224.0/19 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=74.119.76.0/22 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=103.4.96.0/22 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=129.134.0.0/16 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=157.240.0.0/16 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=173.252.64.0/18 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=179.60.192.0/22 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=185.60.216.0/22 !dst-address-list !dst-port !protocol !src-address !src-address-list add action=accept comment="FACE / INSTAGRAM" disabled=no dst-address=204.15.20.0/22 !dst-address-list !dst-port !protocol !src-address !src-address-list
Criação dos Scripts e Schedulers:
/system script add dont-require-permissions=no name=statusAPZOOXWIFI owner=think policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":lo\ g warning \"INICIANDO SCRIPT Status Access Point ZOOXWIFI...\"\r\ \n\r\ \n#PEGA O MAC A PARTIR DA ETHER1\r\ \n:local mac [/interface ethernet get [/interface ethernet find default-name\ =ether1] mac-address ]\r\ \n\r\ \n#INICIALIZA AS VARI\C1VEIS\r\ \n:local lineEnd 0;\r\ \n:local lastEnd 0;\r\ \n:local line \"\";\r\ \n:local ipvazio \"\";\r\ \n:local x 0;\r\ \n:global strListIp \"\";\r\ \n#CRIA O ARQUIVO \"getipapzw.txt\" \r\ \n/tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154-f6\ 4f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/list/ap/\$mac\" ds\ t-path=getipapzw.txt\r\ \n:delay 5\r\ \n\r\ \n#GUARDA O CONTE\DADO DO ARQUIVO \"getipapzw.txt\" \r\ \n:local content [/file get [/file find name=getipapzw.txt] contents];\r\ \n\r\ \n#GUARDA O TAMANHO DO CONTE\DADO DO ARQUIVO\r\ \n:local contentLen [ :len \$content ] ;\r\ \n\r\ \n:while (\$lineEnd < \$contentLen) do={\r\ \n# PEGA O FIM DA LINHA, TOMANDO COMO BASE, A POSI\C7\C3O DE \"/n\". \r\ \n# PARA ISSO, A BUSCA \C9 FEITA A PARTIR DO \DALTIMO FIM ENCONTRADO (lastEn\ d)\r\ \n# SE N\C3O ENCONTRAR \"/n\", O VALOR DE lineEnd SER\C1 IGUAL AO TAMANHO TO\ TAL DE \$content (FIM DO ARQUIVO)\r\ \n :set lineEnd [:find \$content \"\\n\" \$lastEnd] ;\r\ \n :if (\$lineEnd <=0) do={:set lineEnd \$contentLen}\r\ \n\r\ \n# PEGA O IP DA LINHA\r\ \n :set line [:pick \$content \$lastEnd \$lineEnd] ;\r\ \n :set lastEnd ( \$lineEnd + 1 ) ;\r\ \n :local ip [:pick \$line 0 \$lineEnd]\r\ \n\r\ \n# FAZ O PING 3 VEZES. SE p N\C3O RETORNAR COM O VALOR 3, CONSIDERO OFF-LIN\ E\r\ \n :if ([/ping \$ip count=3]=0) do={ \r\ \n :if (\$strListIp=\"\") do={:set strListIp \$ip} else={:set strListIp\ \_(\$strListIp . \",\" . \$ip)}\r\ \n :set x (\$x+1);\r\ \n }\r\ \n\r\ \n :if (x=50) do={\r\ \n :set x 0;\r\ \n :set strListIp \"\";\r\ \n :log warning (\"Lista: \" . \$strListIp);\r\ \n :log warning \"ENVIANDO LISTA DE IPs OFF-LINE PARA O SERVIDOR\";\r\ \n /tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349\ 154-f64f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/offline/ap/\ \$mac\?list=\$strListIp\" keep-result=no\r\ \n }\r\ \n} \r\ \n\r\ \n:if (\$contentLen > 0) do={\r\ \n :log warning (\"Lista: \" . \$strListIp);\r\ \n :log warning \"ENVIANDO LISTA DE IPs OFF-LINE PARA O SERVIDOR\";\r\ \n /tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154\ -f64f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/offline/ap/\$ma\ c\?list=\$strListIp\" keep-result=no\r\ \n}\r\ \n:log warning \"TERMINANDO SCRIPT Status Access Point ZOOXWIFI...\"" add dont-require-permissions=no name=statusHOTSPOTZOOXWIFI owner=think policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":lo\ g warning \"INICIANDO SCRIPT Status Hotspot ZOOXWIFI...\"\r\ \n\r\ \n#PEGA O MAC A PARTIR DA ETHER1\r\ \n:local mac [/interface ethernet get [/interface ethernet find default-name\ =ether1] mac-address ]\r\ \n\r\ \n#INICIALIZA AS VARI\C1VEIS\r\ \n:local lineEnd 0;\r\ \n:local lastEnd 0;\r\ \n:local line \"\";\r\ \n:local ipvazio \"\";\r\ \n:local x 0;\r\ \n:local strListHotspot \"\";\r\ \n\r\ \n#CRIA O ARQUIVO \"getiphszw.txt\" \r\ \n/tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154-f6\ 4f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/list/hotspot/\$mac\ \" dst-path=getiphszw.txt\r\ \n:delay 5\r\ \n\r\ \n#GUARDA O CONTE\DADO DO ARQUIVO \"getiphszw.txt\" \r\ \n:local content [/file get [/file find name=getiphszw.txt] contents];\r\ \n\r\ \n#GUARDA O TAMANHO DO CONTE\DADO DO ARQUIVO\r\ \n:local contentLen [ :len \$content ] ;\r\ \n\r\ \n:while (\$lineEnd < \$contentLen) do={\r\ \n# PEGA O FIM DA LINHA, TOMANDO COMO BASE, A POSI\C7\C3O DE \"/n\". \r\ \n# PARA ISSO, A BUSCA \C9 FEITA A PARTIR DO \DALTIMO FIM ENCONTRADO (lastEn\ d)\r\ \n# SE N\C3O ENCONTRAR \"/n\", O VALOR DE lineEnd SER\C1 IGUAL AO TAMANHO TO\ TAL DE \$content (FIM DO ARQUIVO)\r\ \n :set lineEnd [:find \$content \"\\n\" \$lastEnd] ;\r\ \n :if (\$lineEnd <=0) do={:set lineEnd \$contentLen}\r\ \n\r\ \n# PEGA O NOME DO HOTSPOT NA LINHA\r\ \n :set line [:pick \$content \$lastEnd \$lineEnd] ;\r\ \n :set lastEnd ( \$lineEnd + 1 ) ;\r\ \n :local hotspotName [:pick \$line 0 \$lineEnd]\r\ \n\r\ \n# VERIFICA SE EST\C1 \"DISABLED\" E ACRESCENTA EM UMA LISTA (\"DISABLED\" \ = TRUE) \r\ \n :local st [ip hotspot get \$hotspotName];\r\ \n :local statusHotspot [ip hotspot get \$hotspotName disabled];\r\ \n :if (\$statusHotspot=true) do={ \r\ \n :if (\$strListHotspot=\"\") do={:set strListHotspot \$hotspotName} e\ lse={:set strListHotspot (\$strListHotspot . \",\" . \$hotspotName)}\r\ \n :set x (\$x+1);\r\ \n }\r\ \n}\r\ \n# FAZ SOMENTE SE ALGUM HOTSPOT RETORNOU NA LISTA\r\ \n:if (\$contentLen > 0) do={\r\ \n :log warning (\"Lista: \" . \$strListHotspot);\r\ \n :log warning \"ENVIANDO LISTA DE HOTSPOTs OFF-LINE PARA O SERVIDOR\";\r\ \n /tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154\ -f64f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/offline/hotspot\ /\$mac\?list=\$strListHotspot\" keep-result=no\r\ \n\r\ \n}\r\ \n:log warning \"TERMINANDO SCRIPT Status Hotspot ZOOXWIFI...\"\r\ \n" add dont-require-permissions=no name=statusLINKZOOXWIFI owner=think policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":lo\ g warning \"INICIANDO SCRIPT Status Links ZOOXWIFI...\"\r\ \n\r\ \n#PEGA O MAC A PARTIR DA ETHER1\r\ \n:local mac [/interface ethernet get [/interface ethernet find default-name\ =ether1] mac-address ]\r\ \n\r\ \n#INICIALIZA AS VARI\C1VEIS\r\ \n:local lineEnd 0;\r\ \n:local lastEnd 0;\r\ \n:local line \"\";\r\ \n:local ipvazio \"\";\r\ \n:global strListLink \"\";\r\ \n\r\ \n### NAO MUDAR NADA ABAIXO DESSE COMENTARIO ###\r\ \n:global ip1a 8.8.8.8;\r\ \n:global ip1b 4.2.2.2;\r\ \n:global ip2a 8.8.4.4;\r\ \n:global ip2b 4.2.2.1;\r\ \n:global latencia 1000ms;\r\ \n\r\ \n\r\ \n#CRIA O ARQUIVO \"getlinkszw.txt\" \r\ \n#/tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154-f\ 64f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/list/link/\$mac\"\ \_dst-path=getlinkszw.txt\r\ \n#:delay 5\r\ \n#GUARDA O CONTE\DADO DO ARQUIVO \"getlinkszw.txt\" \r\ \n#:local content [/file get [/file find name=getlinkszw.txt] contents];\r\ \n\r\ \n#INFORMAR MANUALMENTE A LISTA DE LINKS E SUAS ROTAS\r\ \n:local content (\"ether1, CITTA\".\"\\n\".\"ether2, VOGEL\");\r\ \n\r\ \n#GUARDA O TAMANHO DO CONTE\DADO DO ARQUIVO\r\ \n:local contentLen [ :len \$content ] ;\r\ \n\r\ \n:while (\$lineEnd < \$contentLen) do={\r\ \n# PEGA O FIM DA LINHA, TOMANDO COMO BASE, A POSI\C7\C3O DE \"/n\". \r\ \n# PARA ISSO, A BUSCA \C9 FEITA A PARTIR DO \DALTIMO FIM ENCONTRADO (lastEn\ d)\r\ \n# SE N\C3O ENCONTRAR \"/n\", O VALOR DE lineEnd SER\C1 IGUAL AO TAMANHO TO\ TAL DE \$content (FIM DO ARQUIVO)\r\ \n :set lineEnd [:find \$content \"\\n\" \$lastEnd] ;\r\ \n :if (\$lineEnd <=0) do={:set lineEnd \$contentLen}\r\ \n\r\ \n# PEGA O IP DA LINHA\r\ \n :set line [:pick \$content \$lastEnd \$lineEnd] ;\r\ \n :set lastEnd ( \$lineEnd + 1 ) ;\r\ \n :local tmpArray [:toarray \$line] ;\r\ \n :local porta ([:pick \$tmpArray 0]);\r\ \n :local rota ([:pick \$tmpArray 1]);\r\ \n :if (\$rota!=\"null\") do={\r\ \n# FAZ O PING\r\ \n :log warning (\"TESTANDO LINK \". \$porta . \" \" .\$rota);\r\ \n \r\ \n :if ([/ping \$ip1a routing-table=\$rota interface=\$porta interval=\ \$latencia count=3]=0 && [/ping \$ip1b routing-table=\$rota interface=\$port\ a interval=\$latencia count=3]=0 && [/ping \$ip2a routing-table=\$rota inter\ face=\$porta interval=\$latencia count=3]=0 && [/ping \$ip2b routing-table=\ \$rota interface=\$porta interval=\$latencia count=3]=0) do={\r\ \n :if (\$strListLink=\"\") do={:set strListLink \$porta} else={:set\ \_strListLink (\$strListLink . \",\" . \$porta)}\r\ \n }\r\ \n }\r\ \n}\r\ \n\r\ \n# FAZ SOMENTE SE ALGUM LINK RETORNOU NA LISTA\r\ \n:if (\$contentLen > 0) do={\r\ \n :log warning (\"Lista: \" . \$strListLink);\r\ \n :log warning \"ENVIANDO LISTA DE LINKs OFF-LINE PARA O SERVIDOR\";\r\ \n /tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154\ -f64f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/offline/link/\$\ mac\?list=\$strListLink\" keep-result=no\r\ \n}\r\ \n:log warning \"TERMINANDO SCRIPT Status LINKs ZOOXWIFI...\"" add dont-require-permissions=no name=statusMKZOOXWIFI owner=think policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":lo\ g warning \"INICIANDO SCRIPT Status MIKROTIK...\"\r\ \n\r\ \n#PEGA O MAC A PARTIR DA ETHER1\r\ \n:local mac [/interface ethernet get [/interface ethernet find default-name\ =ether1] mac-address ]\r\ \n\r\ \n:log warning \"ENVIANDO Status do MIKROTIK PARA O SERVIDOR...\"\r\ \n/tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154-f6\ 4f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/online/router/\$ma\ c\" keep-result=no\r\ \n:delay 3\r\ \n:log warning \"TERMINANDO SCRIPT Status MIKROTIK...\"" add dont-require-permissions=yes name=CHECK_ACTIVE_HOTSPOT owner=think policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":gl\ obal data [/system clock get date];\r\ \n:global hora [/system clock get time];\r\ \n:global nome [/system identity get name];\r\ \n:global ipexteno [ip cloud get \"public-address\"] \r\ \n:global ddnscloud [ip cloud get \"dns-name\"]\r\ \n:global smtpzw [:put [:resolve \"smtp.gmail.com\"]];\r\ \n:global fromEmail \"Alerta Zoox - Active Hotspot Status\"\r\ \n:global EmailZW support@zooxsmart.com\r\ \n:global Pass tecnologia123\r\ \n:global VpnZW1 [interface ovpn-client get [ find connect-to=52.72.45.157]\ \_name];\r\ \n:global vpnZW2 [ip address get [find interface=\$VpnZW1 ] address ]; \r\ \n:global IpZW [:pick \$vpnZW2 0 [:find \$vpnZW2 \"/\"]] \r\ \n:global EmailCheckAtictive1 suporte@zooxsmart.com\r\ \n:global EmailCheckAtictive2 julio.lima@zooxsmart.com\r\ \n:global EmailCheckAtictive3 edson.oliveira@zooxsmart.com\r\ \n:global EmailCheckAtictive4 thalles.domingues@zooxsmart.com\r\ \n:global EmailCheckAtictive5 humberto.oliveira@zooxsmart.com\r\ \n:global ActiveHotspotParametro 0\r\ \n:global ActiveHotspotCounter [ ip hotspot active print count-only] \r\ \n\r\ \n#### AJUSTAR AQUI O NOME DO HOTSPOT ##################\r\ \n:global HotspotName ZooxWiFi\r\ \n\r\ \n:if (\$ActiveHotspotCounter<=(\$ActiveHotspotParametro)) do={ /tool e-mail\ \_send password=\$Pass port=587 server=\$smtpzw user=\$EmailZW from=\$fromEm\ ail to=\"\$EmailCheckAtictive1\" cc=\"\$EmailCheckAtictive2, \$EmailCheckAti\ ctive3, \$EmailCheckAtictive4, \$EmailCheckAtictive5\" subject=\"\$nome Acti\ ve Hotspot Zerado \$data as \$hora\" body=\"Active Hotspot Zerado, Suporte F\ avor verificar com Urgencia - IP Externo: \$ipexteno - DNS Cloud \$ddnsclou\ d - IP_Vpn \$IpZW\" start-tls=yes; };" add dont-require-permissions=no name=scriptZOOXWIFIDEVICES owner=think policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source=":lo\ g warning \"INICIANDO SCRIPT Status MONITORAMENTO ZOOXWIFI...\"\r\ \n\r\ \n#PEGA O MAC A PARTIR DA ETHER1\r\ \n:local mac [/interface ethernet get [/interface ethernet find default-name\ =ether1] mac-address ]\r\ \n\r\ \n#INICIALIZA AS VARI\C1VEIS\r\ \n:local lineEnd 0;\r\ \n:local lastEnd 0;\r\ \n:local line \"\";\r\ \n:local ipvazio \"\";\r\ \n:local x 0;\r\ \n:local strListIp \"\";\r\ \n\r\ \n#CRIA O ARQUIVO \"getipdevzw.txt\" \r\ \n/tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154-f6\ 4f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/list/device/\$mac\ \" dst-path=getipdevzw.txt\r\ \n:delay 5\r\ \n\r\ \n#GUARDA O CONTE\DADO DO ARQUIVO \"getipdevzw.txt\" \r\ \n:local content [/file get [/file find name=getipdevzw.txt] contents];\r\ \n\r\ \n#GUARDA O TAMANHO DO CONTE\DADO DO ARQUIVO\r\ \n:local contentLen [ :len \$content ] ;\r\ \n\r\ \n:while (\$lineEnd < \$contentLen) do={\r\ \n# PEGA O FIM DA LINHA, TOMANDO COMO BASE, A POSI\C7\C3O DE \"/n\". \r\ \n# PARA ISSO, A BUSCA \C9 FEITA A PARTIR DO \DALTIMO FIM ENCONTRADO (lastEn\ d)\r\ \n# SE N\C3O ENCONTRAR \"/n\", O VALOR DE lineEnd SER\C1 IGUAL AO TAMANHO TO\ TAL DE \$content (FIM DO ARQUIVO)\r\ \n :set lineEnd [:find \$content \"\\n\" \$lastEnd] ;\r\ \n :if (\$lineEnd <=0) do={:set lineEnd \$contentLen}\r\ \n\r\ \n# PEGA O IP DA LINHA\r\ \n :set line [:pick \$content \$lastEnd \$lineEnd] ;\r\ \n :set lastEnd ( \$lineEnd + 1 ) ;\r\ \n :local ip [:pick \$line 0 \$lineEnd]\r\ \n\r\ \n# FAZ O PING 3 VEZES. SE p N\C3O RETORNAR COM O VALOR 3, CONSIDERO OFF-LIN\ E\r\ \n :if ([/ping \$ip count=3]=0) do={ \r\ \n :if (\$strListIp=\"\") do={:set strListIp \$ip} else={:set strListIp\ \_(\$strListIp . \",\" . \$ip)}\r\ \n :set x (\$x+1);\r\ \n }\r\ \n}\r\ \n# FAZ SOMENTE SE ALGUM DEVICE RETORNOU NA LISTA\r\ \n:if (\$contentLen > 0) do={\r\ \n :log warning (\"Lista: \" . \$strListIp);\r\ \n :log warning \"ENVIANDO LISTA DE MONITORAMENTO OFF-LINE PARA O SERVIDOR\ \";\r\ \n /tool fetch user=465c48db-b582-4423-a518-82315f6eecfa password=7d349154\ -f64f-4f4f-bb86-8c58d6075f3c url=\"https://ping.zooxwifi.com/offline/device/\ \$mac\?list=\$strListIp\" keep-result=no\r\ \n}\r\ \n:log warning \"TERMINANDO SCRIPT Status MONITORAMENTO ZOOXWIFI...\"\r\ \n" /system scheduler add interval=1m name=ScriptZOOXWIFIDEVICES on-event=ScriptZOOXWIFIDEVICES \ policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=1m name=StatusAPZOOXWIFI on-event=StatusAPZOOXWIFI policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=1m name=StatusHOTSPOTZOOXWIFI on-event=StatusHOTSPOTZOOXWIFI \ policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=1m name=StatusLINKZOOXWIFI on-event=StatusLINKZOOXWIFI policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=1m name=StatusMKZOOXWIFI on-event=StatusMKZOOXWIFI policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=2h name=CHECK_ACTIVE_HOTSPOT on-event=CHECK_ACTIVE_HOTSPOT \ policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=2h name=GMAIL on-event=GMAIL policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=3d name=BACKUP on-event=BACKUP policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=2h name=USUARIO_SUPORTE on-event=USUARIO_SUPORTE policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup add interval=5m name=VPN_ZW on-event=VPN_ZW policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \ start-time=startup
Após todas as configurações acima volte na Bridge Criada para o Hotpsot e faça o Link das interfaces que deseja propagar o hotspot, sendo uma interface Física ou VLAN previamente configurada.
Comentários
0 comentário
Por favor, entre para comentar.