Yes, probably, it is a mess…
# dec/08/2020 17:51:32 by RouterOS 6.47.8
# software id = 03Q9-KY1R
#
# model = RouterBOARD 3011UiAS
# serial number = 7810087375DE
/interface lte
set [ find ] name=lte1
/interface pppoe-client
add disabled=no interface=ether1 keepalive-timeout=disabled name=\
pppoe-telecom_dados user=XXXXXXXXXXXX
/interface ethernet switch
set 0 mirror-source=ether1 mirror-target=ether5
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
add name=CCTV
add name=DMZ
add name=WLAN
add name=AIRVPN_OUT
add name=AIRVPN_IN
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip ipsec mode-config
add address=10.0.77.2 address-prefix-length=32 name=rodpp split-include=\
10.0.0.0/16 static-dns=10.0.2.1 system-dns=no
/ip ipsec policy group
add name=ike2-policies
/ip ipsec profile
add name=ike2
/ip ipsec peer
add exchange-mode=ike2 name=ike2 passive=yes profile=ike2
/ip ipsec proposal
add name=ike2 pfs-group=none
/ip pool
add name=default-dhcp ranges=192.168.88.10-192.168.88.254
add name=wlan_dhcp_pool ranges=10.0.1.201-10.0.1.250
add name=lan_dhcp_pool ranges=10.0.2.201-10.0.2.250
add name=cctv_dhcp_pool ranges=10.0.3.201-10.0.3.250
add name=dmz_dhcp_pool ranges=10.0.4.201-10.0.4.250
add name=ike2-pool ranges=10.0.77.2-10.0.77.254
add name=lan5_dhcp_pool ranges=10.0.5.210-10.0.5.250
/ip dhcp-server
add address-pool=wlan_dhcp_pool disabled=no interface=ether6 name=\
wlan_dhcp_server
add address-pool=lan_dhcp_pool disabled=no interface=ether7 name=\
lan_dhcp_server
add address-pool=cctv_dhcp_pool disabled=no interface=ether8 name=\
cctv_dhcp_server
add address-pool=dmz_dhcp_pool disabled=no interface=ether9 name=\
dmz_dhcp_server
add address-pool=lan5_dhcp_pool disabled=no interface=ether10 name=\
lan5_dhcp_server
/ip ipsec mode-config
add address-pool=ike2-pool address-prefix-length=32 name=ike2-conf
/ip neighbor discovery-settings
set discover-interface-list=LAN
/interface list member
add interface=ether7 list=LAN
add interface=pppoe-telecom_dados list=WAN
add interface=ether6 list=WLAN
add interface=ether8 list=CCTV
add interface=ether9 list=DMZ
add interface=lte1 list=WAN
/ip address
add address=10.0.1.1/24 interface=ether6 network=10.0.1.0
add address=10.0.2.1/24 interface=ether7 network=10.0.2.0
add address=10.0.3.1/24 interface=ether8 network=10.0.3.0
add address=10.0.4.1/24 interface=ether9 network=10.0.4.0
add address=10.0.5.1/24 interface=ether10 network=10.0.5.0
add address=10.1.0.2/24 interface=ether3 network=10.1.0.0
/ip dhcp-client
add add-default-route=no disabled=no interface=lte1
/ip dhcp-server network
add address=10.0.1.0/24 comment=WLAN dns-server=10.0.4.2 gateway=10.0.1.1
add address=10.0.2.0/24 comment=LAN dns-server=10.0.4.2 gateway=10.0.2.1
add address=10.0.3.0/24 comment=CCTV dns-server=10.0.4.2 gateway=10.0.3.1
add address=10.0.4.0/24 comment=DMZ dns-server=8.8.8.8 gateway=10.0.4.1
add address=10.0.5.0/24 comment="LAN 5" dns-server=8.8.8.8 gateway=10.0.5.1
add address=192.168.88.0/24 comment=defconf gateway=192.168.88.1
/ip dns
set servers=10.0.4.2
/ip firewall address-list
add address=10.0.2.0/24 list=lan_address_list
add address=10.0.1.0/24 list=wlan_address_list
add address=10.0.3.0/24 list=cctv_address_list
add address=10.0.4.0/24 list=dmz_address_list
add address=10.0.2.120 list=nvr_lan_address_list
add address=10.0.3.120 list=nvr_cctv_address_list
add address=10.0.3.190 list=gosat_pro_address_list
add address=10.0.2.100 list=rodrigo_desktopl_address_list
add address=10.0.2.10 list=linux_server_address_list
add address=10.0.2.20 list=printer_address_list
add address=10.0.4.2 list=pi-hole_address_list
add address=10.0.5.0/24 list=vpn_address_list
/ip firewall filter
add action=drop chain=output comment="Test Failover - TelecomDados OFF" \
disabled=yes dst-address=8.8.8.8 out-interface=pppoe-telecom_dados
add action=drop chain=output comment="Test Failover - 4G OFF" disabled=yes \
dst-address=8.8.8.8 out-interface=lte1
add action=accept chain=input comment=\
"defconf: accept established,related,untracked" connection-state=\
established,related,untracked
add action=drop chain=input comment="defconf: drop invalid" connection-state=\
invalid
add action=accept chain=input comment="defconf: accept ICMP" protocol=icmp
add action=accept chain=input comment=\
"defconf: accept to local loopback (for CAPsMAN)" disabled=yes \
dst-address=127.0.0.1
add action=accept chain=input comment="Allow DNS queries for all, except WAN" \
dst-port=53 in-interface-list=!WAN protocol=tcp
add action=accept chain=input comment="Allow DNS queries for all, except WAN" \
dst-port=53 in-interface-list=!WAN protocol=udp
add action=accept chain=input comment=\
"Allow DHCP queries for all, except WAN" dst-port=67 in-interface-list=\
!WAN protocol=udp
add action=accept chain=input comment="Accept input from LAN" \
src-address-list=lan_address_list
add action=accept chain=input comment="Accept input from WLAN" disabled=yes \
in-interface-list=WLAN
add chain=input comment="ipsec policy matcher" in-interface=\
pppoe-telecom_dados ipsec-policy=in,ipsec
add action=accept chain=input comment=VPN dst-port=500,4500 protocol=udp
add action=drop chain=input comment="DROP ALL INPUT" log-prefix="[INPUT] "
add action=drop chain=forward comment="Disable WAN" disabled=yes \
out-interface-list=WAN
add action=drop chain=forward comment="Disable TelecomDados" disabled=yes \
out-interface=pppoe-telecom_dados
add action=drop chain=forward comment="Disable 4G" disabled=yes \
out-interface=lte1
add action=accept chain=forward comment="defconf: accept in ipsec policy" \
ipsec-policy=in,ipsec
add action=accept chain=forward comment="defconf: accept out ipsec policy" \
ipsec-policy=out,ipsec
add action=accept chain=forward comment=\
"defconf: accept established,related, untracked" connection-state=\
established,related,untracked
add action=accept chain=forward comment="Allow LAN 5 access to Internet" \
out-interface-list=WAN src-address-list=vpn_address_list
add action=accept chain=forward comment=\
"Allow the test computer forward to everywhere" src-address=10.0.1.228
add action=accept chain=forward comment=\
"#####Begin Pi-hole#### - Allow access to TCP port 53 on Pi-hole " \
dst-address-list=pi-hole_address_list dst-port=53 protocol=tcp
add action=accept chain=forward comment=\
"Allow access to UDP port 53 on Pi-hole " dst-address-list=\
pi-hole_address_list dst-port=53 protocol=udp
add action=accept chain=forward comment="Allow Desktop access Pi-hole Admin" \
dst-address-list=pi-hole_address_list dst-port=80 protocol=tcp \
src-address-list=rodrigo_desktopl_address_list
add action=accept chain=forward comment=\
"Allow Rodrigo's Desktop access Pi-Hole SSH" dst-address-list=\
pi-hole_address_list dst-port=22 protocol=tcp src-address-list=\
rodrigo_desktopl_address_list
add action=accept chain=forward comment="Allow external DNS access from DMZ" \
dst-port=53 protocol=udp src-address-list=dmz_address_list
add action=drop chain=forward comment=\
"Only allow Pi-hole access external TCP DNS" dst-port=53 protocol=tcp \
src-address=!10.0.4.2
add action=drop chain=forward comment=\
"Only allow Pi-hole access external UDP DNS" dst-port=53 protocol=udp \
src-address=!10.0.4.2
add action=drop chain=forward comment=\
"#####End Pi-hole#### - Drop to Pi-hole" dst-address=10.0.4.2
add action=accept chain=forward comment=\
"#####Begin CCTV#### - Allow Desktop access CCTV" dst-address-list=\
cctv_address_list src-address-list=rodrigo_desktopl_address_list
add action=accept chain=forward comment="Access NTP server" dst-address=\
201.49.148.135 dst-port=123 protocol=udp src-address-list=\
nvr_lan_address_list
add action=accept chain=forward comment="Access NTP server" dst-address=\
201.49.148.135 dst-port=123 protocol=udp src-address-list=\
nvr_cctv_address_list
add action=accept chain=forward comment="Allow NVR(lan) access CCTV" \
dst-address-list=cctv_address_list src-address-list=nvr_lan_address_list
add action=accept chain=forward comment="Allow CCTV access NVR(lan) " \
dst-address-list=nvr_lan_address_list src-address-list=cctv_address_list
add action=drop chain=forward comment="Drop (LAN) NVR forward" \
src-address-list=nvr_lan_address_list
add action=accept chain=forward comment=\
"GoSat Pro (CCTV network) forward only to WAN" out-interface-list=WAN \
src-address-list=gosat_pro_address_list
add action=drop chain=forward comment="Drop from CCTV" src-address-list=\
cctv_address_list
add action=drop chain=forward comment="#####End CCTV#### - Drop to CCTV" \
dst-address-list=cctv_address_list
add action=accept chain=forward comment="Allow LAN forward to all except DMZ" \
dst-address-list=!dmz_address_list src-address-list=lan_address_list
add action=accept chain=forward comment=\
"Allow WLAN forward to all except DMZ" dst-address-list=!dmz_address_list \
src-address-list=wlan_address_list
add action=accept chain=forward comment="Internet access for DMZ" \
in-interface-list=DMZ out-interface-list=WAN
add action=accept chain=forward comment="Internet access for WLAN " disabled=\
yes in-interface-list=WLAN out-interface-list=WAN
add action=accept chain=forward comment="Allow WLAN access NVR" disabled=yes \
dst-address-list=nvr_lan_address_list in-interface-list=WLAN
add action=accept chain=forward comment="Allow WLAN access printer" disabled=\
yes dst-address-list=printer_address_list in-interface-list=WLAN
add action=accept chain=forward comment="Allow WLAN access Linux Server" \
disabled=yes dst-address-list=linux_server_address_list \
in-interface-list=WLAN
add action=accept chain=forward comment="Allow WLAN access Plex Server" \
disabled=yes dst-address-list=linux_server_address_list dst-port=\
32469,32400 protocol=tcp src-address-list=wlan_address_list
add action=accept chain=forward comment="Allow WLAN access Plex Server" \
disabled=yes dst-address-list=linux_server_address_list dst-port=\
1900,32414,32413,32412,32410,5353 protocol=udp src-address-list=\
wlan_address_list
add action=accept chain=forward comment="Allow NAT forward from WAN " \
connection-nat-state=dstnat in-interface-list=WAN
add action=drop chain=forward comment="DROP ALL FORWARD" log=yes log-prefix=\
"[FORWARD] "
/ip firewall mangle
add action=mark-connection chain=prerouting connection-mark=no-mark \
dst-address-type=!local new-connection-mark=AIRVPN_conn passthrough=yes \
src-address=10.0.1.228
add action=mark-routing chain=prerouting connection-mark=AIRVPN_conn \
new-routing-mark=to_AIRVPN
/ip firewall nat
add action=masquerade chain=srcnat comment="defconf: masquerade" \
ipsec-policy=out,none out-interface-list=WAN
add action=dst-nat chain=dstnat comment="NVR NAT" dst-port=18000 log=yes \
log-prefix="[NVR] " protocol=tcp to-addresses=10.0.2.120 to-ports=18000
/ip ipsec identity
add auth-method=digital-signature certificate=server1 generate-policy=\
port-strict match-by=certificate mode-config=rodpp peer=ike2 \
policy-template-group=ike2-policies remote-certificate=rw-rodpp
add auth-method=digital-signature certificate=server1 generate-policy=\
port-strict mode-config=ike2-conf peer=ike2 policy-template-group=\
ike2-policies
/ip ipsec policy
add dst-address=10.0.77.0/24 group=ike2-policies proposal=ike2 src-address=\
0.0.0.0/0 template=yes
/ip route
add distance=1 gateway=10.1.0.1 pref-src=10.1.0.2 routing-mark=to_AIRVPN
add distance=1 gateway=pppoe-telecom_dados
add distance=2 gateway=10.1.0.1 pref-src=10.1.0.2
add distance=30 gateway=192.168.0.1
/lcd
set backlight-timeout=never default-screen=stats touch-screen=disabled
/lcd screen
set 1 disabled=yes
set 2 disabled=yes
set 3 disabled=yes
set 4 disabled=yes
set 5 disabled=yes
/system clock
set time-zone-name=America/Sao_Paulo
/system logging
add disabled=yes topics=ipsec,!debug
add disabled=yes prefix="[DHCP]" topics=dhcp
/system scheduler
add interval=5s name=failover on-event=failover policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup
/system script
add dont-require-permissions=no name=failover owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_------------------- header -------------------\r\
\n# Script by Tomas Kirnak, version 1.0.7\r\
\n# If you use this script, or edit and\r\
\n# re-use it, please keep the header intact.\r\
\n#\r\
\n# For more information and details about\r\
\n# this script please visit the wiki page at\r\
\n# http://wiki.mikrotik.com/wiki/Failover_Scripting\r\
\n# ------------------- header -------------------\r\
\n\r\
\n\r\
\n\r\
\n# ------------- start editing here -------------\r\
\n# Edit the variables below to suit your needs\r\
\n\r\
\n# Please fill the WAN interface names\r\
\n:local InterfaceISP1 pppoe-telecom_dados\r\
\n:local InterfaceISP2 lte1\r\
\n\r\
\n# Please fill the gateway IPs (or interface names in case of PPP)\r\
\n:local GatewayISP1 pppoe-telecom_dados\r\
\n:local GatewayISP2 192.168.0.1\r\
\n\r\
\n# Please fill the ping check host - currently: resolver1.opendns.com\r\
\n:local PingTarget 8.8.8.8\r\
\n\r\
\n# Please fill how many ping failures are allowed before fail-over happen\
ds\r\
\n:local FailTreshold 3\r\
\n\r\
\n# Define the distance increase of a route when it fails\r\
\n:local DistanceIncrease 2\r\
\n\r\
\n# Editing the script after this point may break it\r\
\n# -------------- stop editing here --------------\r\
\n\r\
\n\r\
\n\r\
\n# Declare the global variables\r\
\n:global PingFailCountISP1\r\
\n:global PingFailCountISP2\r\
\n\r\
\n# This inicializes the PingFailCount variables, in case this is the 1st \
time the script has ran\r\
\n:if ([:typeof \$PingFailCountISP1] = \"nothing\") do={:set PingFailCount\
ISP1 0}\r\
\n:if ([:typeof \$PingFailCountISP2] = \"nothing\") do={:set PingFailCount\
ISP2 0}\r\
\n\r\
\n# This variable will be used to keep results of individual ping attempts\
\r\
\n:local PingResult\r\
\n\r\
\n\r\
\n\r\
\n# Check ISP1\r\
\n:set PingResult [ping \$PingTarget count=1 interface=\$InterfaceISP1]\r\
\n:put \$PingResult\r\
\n\r\
\n:if (\$PingResult = 0) do={\r\
\n\t:if (\$PingFailCountISP1 < (\$FailTreshold+2)) do={\r\
\n\t\t:set PingFailCountISP1 (\$PingFailCountISP1 + 1)\r\
\n\t\t\r\
\n\t\t:if (\$PingFailCountISP1 = \$FailTreshold) do={\r\
\n\t\t\t:log warning \"ISP1 has a problem en route to \$PingTarget - incre\
asing distance of routes.\"\r\
\n\t\t\t:foreach i in=[/ip route find gateway=\$GatewayISP1 && static] do=\
\\\r\
\n\t\t\t\t{/ip route set \$i distance=([/ip route get \$i distance] + \$Di\
stanceIncrease)}\r\
\n\t\t\t:log warning \"Route distance increase finished.\"\r\
\n /system script run beep_s\
ound_bt_\r\
\n /system script run beep_s\
ound_cl\r\
\n\t\t}\r\
\n\t}\r\
\n #/system script run beep_sound_nil\r\
\n}\r\
\n:if (\$PingResult = 1) do={\r\
\n\t:if (\$PingFailCountISP1 > 0) do={\r\
\n\t\t:set PingFailCountISP1 (\$PingFailCountISP1 - 1)\r\
\n\t\t\r\
\n\t\t:if (\$PingFailCountISP1 = (\$FailTreshold -1)) do={\r\
\n\t\t\t:log warning \"ISP1 can reach \$PingTarget again - bringing back o\
riginal distance of routes.\"\r\
\n\t\t\t:foreach i in=[/ip route find gateway=\$GatewayISP1 && static] do=\
\\\r\
\n\t\t\t\t{/ip route set \$i distance=([/ip route get \$i distance] - \$Di\
stanceIncrease)}\r\
\n\t\t\t:log warning \"Route distance decrease finished.\"\r\
\n /system script run beep_\
sound_cfm\r\
\n\t\t}\r\
\n\t}\r\
\n}\r\
\n\r\
\n\r\
\n\r\
\n# Check ISP2\r\
\n:set PingResult [ping \$PingTarget count=1 interface=\$InterfaceISP2]\r\
\n:put \$PingResult\r\
\n\r\
\n:if (\$PingResult = 0) do={\r\
\n\t:if (\$PingFailCountISP2 < (\$FailTreshold+2)) do={\r\
\n\t\t:set PingFailCountISP2 (\$PingFailCountISP2 + 1)\r\
\n\t\t\r\
\n\t\t:if (\$PingFailCountISP2 = \$FailTreshold) do={\r\
\n\t\t\t:log warning \"ISP2 has a problem en route to \$PingTarget - incre\
asing distance of routes.\"\r\
\n\t\t\t:foreach i in=[/ip route find gateway=\$GatewayISP2 && static] do=\
\\\r\
\n\t\t\t\t{/ip route set \$i distance=([/ip route get \$i distance] + \$Di\
stanceIncrease)}\r\
\n\t\t\t:log warning \"Route distance increase finished.\"\r\
\n\t\t}\r\
\n\t}\r\
\n}\r\
\n:if (\$PingResult = 1) do={\r\
\n\t:if (\$PingFailCountISP2 > 0) do={\r\
\n\t\t:set PingFailCountISP2 (\$PingFailCountISP2 - 1)\r\
\n\t\t\r\
\n\t\t:if (\$PingFailCountISP2 = (\$FailTreshold -1)) do={\r\
\n\t\t\t:log warning \"ISP2 can reach \$PingTarget again - bringing back o\
riginal distance of routes.\"\r\
\n\t\t\t:foreach i in=[/ip route find gateway=\$GatewayISP2 && static] do=\
\\\r\
\n\t\t\t\t{/ip route set \$i distance=([/ip route get \$i distance] - \$Di\
stanceIncrease)}\r\
\n\t\t\t:log warning \"Route distance decrease finished.\"\r\
\n\t\t}\r\
\n\t}\r\
\n}"
add dont-require-permissions=no name=beep_sound_sos owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Morse SOS\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 300ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;"
add dont-require-permissions=no name=beep_sound_nil owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Morse NIL - NOTHING HEARD \r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;"
add dont-require-permissions=no name=beep_sound_cl owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Morse CL - CLOSING\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;"
add dont-require-permissions=no name=beep_sound_cfm owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Morse CFM - I ACKNOWLEDGE\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n"
add dont-require-permissions=no name=beep_sound_bt_ owner=admin policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon source="#\
\_Morse BT\\ - BREAK\r\
\n:delay 300ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=50ms;\r\
\n:delay 100ms;\r\
\n:beep frequency=800 length=150ms;\r\
\n:delay 200ms;\r\
\n:delay 300ms;"
/tool mac-server
set allowed-interface-list=LAN
/tool mac-server mac-winbox
set allowed-interface-list=LAN
/tool sms
set port=lte1 receive-enabled=yes
Thank you very much!