Community discussions

MikroTik App
 
lucasrmt
just joined
Topic Author
Posts: 1
Joined: Thu Feb 04, 2021 3:50 pm

hEX Lite Failover Troubles

Thu Feb 04, 2021 4:00 pm

Hey everyone, iam new on this forum i wonder if i can get any help with this config iam doing atm.
Trying to make a 2 WANs DHCP and Failover between them. When i unplugg the cable from Ether1 or 2 its ok the failover works sweet, but when the link stay on and the ISP is down, netwatch tell me about Host 8.8.8.8 or 8.8.4.4 is down but dont switch to the other client.
Thx in advance and sorry for my english.

# feb/04/2021 10:37:19 by RouterOS 6.47.6
# software id = PVKU-6DLX
#
# model = RB750r2
# serial number = XXXXXXXXXX
/interface ethernet
set [ find default-name=ether1 ] name=ether1-WAN1
set [ find default-name=ether2 ] name=ether2-WAN2
set [ find default-name=ether3 ] name=ether3-LAN
set [ find default-name=ether4 ] disabled=yes name=ether4-LAN
set [ find default-name=ether5 ] disabled=yes
/interface list
add name=WANs
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip pool
add name=dhcp_pool0 ranges=192.168.128.100-192.168.128.230
/ip dhcp-server
add address-pool=dhcp_pool0 disabled=no interface=ether3-LAN name=dhcp1
/interface list member
add interface=ether1-WAN1 list=WANs
add interface=ether2-WAN2 list=WANs
/ip address
add address=192.168.128.1/24 interface=ether3-LAN network=192.168.128.0
/ip dhcp-client
add comment=WAN1-FIBER !dhcp-options disabled=no interface=ether1-WAN1 \
script="{\r\
\n :local rmark \"WAN1\"\r\
\n :local count [/ip route print count-only where comment=\"WAN1-FIBER\
\"]\r\
\n :if (\$bound=1) do={\r\
\n :if (\$count = 0) do={\r\
\n /ip route add dst-address=8.8.8.8 gateway=\$\"gateway-addres\
s\" comment=\"WAN1-FIBER\"\r\
\n } else={\r\
\n :if (\$count = 1) do={\r\
\n :local test [/ip route find where comment=\"WAN1-FIBER\"\
]\r\
\n :if ([/ip route get \$test gateway] != \$\"gateway-addre\
ss\") do={\r\
\n /ip route set \$test gateway=\$\"gateway-address\"\r\
\n }\r\
\n } else={\r\
\n :error \"Multiple routes found\"\r\
\n }\r\
\n }\r\
\n } else={\r\
\n /ip route remove [find comment=\"WAN1-FIBER\"]\r\
\n }\r\
\n}" use-peer-dns=no use-peer-ntp=no
add comment=WAN2-WILTEL default-route-distance=2 !dhcp-options disabled=no \
interface=ether2-WAN2 script="{\r\
\n :local rmark \"WAN2\"\r\
\n :local count [/ip route print count-only where comment=\"WAN2-WILTEL\
\"]\r\
\n :if (\$bound=1) do={\r\
\n :if (\$count = 0) do={\r\
\n /ip route add dst-address=8.8.4.4 gateway=\$\"gateway-addres\
s\" comment=\"WAN2-WILTEL\"\r\
\n } else={\r\
\n :if (\$count = 1) do={\r\
\n :local test [/ip route find where comment=\"WAN2-WILTEL\
\"]\r\
\n :if ([/ip route get \$test gateway] != \$\"gateway-addre\
ss\") do={\r\
\n /ip route set \$test gateway=\$\"gateway-address\"\r\
\n }\r\
\n } else={\r\
\n :error \"Multiple routes found\"\r\
\n }\r\
\n }\r\
\n } else={\r\
\n /ip route remove [find comment=\"WAN2-WILTEL\"]\r\
\n }\r\
\n}" use-peer-dns=no use-peer-ntp=no
/ip dhcp-server network
add address=192.168.128.0/24 dns-server=8.8.8.8 gateway=192.168.128.1
/ip dns
set servers=8.8.8.8,8.8.4.4
/ip firewall nat
add action=masquerade chain=srcnat out-interface-list=WANs
/ip route
add comment=WAN2-WILTEL distance=1 dst-address=8.8.4.4/32 gateway=\
192.168.27.1
add comment=WAN1-FIBER distance=1 dst-address=8.8.8.8/32 gateway=192.168.1.1
/system clock
set time-zone-autodetect=no time-zone-name=America/Argentina/Buenos_Aires
/system clock manual
set time-zone=-03:00
/tool e-mail
set address=imap.gmail.com from=<RouterMikrotikRR> password=XXXXXX port=993 \
start-tls=yes user=xxxxxx@gmail.com
/tool netwatch
add comment=WAN1 down-script="log error \"WAN-1 fall\"\r\
\n/ip dhcp-cl set add-def=no [find comment=\"WAN1-FIBER\"] \r\
\n/tool e-mail send to=\"xxxxxxx@xxxxxxxx.com\" subject=\"El\
\_Link del IPS Ver FIBER\"\r\
\n" host=8.8.8.8 interval=30s up-script="log error \"WAN-1 Came back\"\r\
\n/ip dhcp-cl set add-def=yes [find comment=\"WAN1-FIBER\"] \r\
\n/tool e-mail send to=\"xxxxxxx@xxxxxxxx.com.com\" subject=\
\"El Link del ISP1 FIBER Came back\""
add comment=WAN2 down-script="log error \"WAN2 cayo\"\r\
\n/ip dhcp-cl set add-def=no [find comment=\"WAN2-WILTEL\"] \r\
\n/tool e-mail send to=\"xxxxxxx@xxxxxxxx.com.com\" subject=\"El\
\_Link de WILTEL fall\"" host=8.8.4.4 interval=30s up-script="log error \"\
WAN-2 fall\"\r\
\n/ip dhcp-cl set add-def=yes [find comment=\"WAN2-WILTEL\"] \r\
\n/tool e-mail send to=\"xxxxxxx@xxxxxxxx.com.com\" subject=\"E\
l Link de WILTEL Came back\""

Who is online

Users browsing this forum: Gongy and 51 guests