Indice   FAQ  
Iscriviti  Login
Indice RouterOS RouterOS

[RISOLTO] failover due wan un bridge

Tutto su questo sistema operativo linux based - Configurazioni, dubbi, problematiche &....

[RISOLTO] failover due wan un bridge

Messaggioda matteofuolega » dom 14 lug 2019, 16:38

Buongiorno ho creato questa configurazione per il failover tra due adsl ethr1 ethr2
ogni tanto durante il giorno la linea principale ethr1 commuta sulla ethr2 anche se la adsl 1 è sempre presente
probabilmente ho sbagliato qualcosa ma non riesco a capire dove
riuscite a farmi ragionare sull'errore grazie

Codice: Seleziona tutto
/interface bridge

add name=bridge

/interface ethernet

set [ find default-name=ether1 ] advertise=100M-half,100M-full,1000M-half,1000M-full comment=TELECOM

set [ find default-name=ether2 ] advertise=100M-half,100M-full,1000M-half,1000M-full comment=EOLO speed=100Mbps

set [ find default-name=ether3 ] speed=100Mbps

set [ find default-name=ether4 ] speed=100Mbps

set [ find default-name=ether5 ] speed=100Mbps

/interface list

add name=WAN

add name=LAN

/interface wireless security-profiles

set [ find default=yes ] supplicant-identity=MikroTik

/ip hotspot profile

set [ find default=yes ] html-directory=flash/hotspot

/ip pool

add name=dhcp ranges=192.168.1.115-192.168.1.149

/ip dhcp-server

add address-pool=dhcp disabled=no interface=bridge lease-time=15m name=dhcp1

/interface bridge port

add bridge=bridge hw=no interface=ether3

add bridge=bridge hw=no interface=ether4

add bridge=bridge hw=no interface=ether5

add bridge=bridge interface=sfp1

/interface list member

add comment=telecom interface=ether1 list=WAN

add comment="lan interna" interface=bridge list=LAN

add comment=eolo interface=ether2 list=WAN

/ip address

add address=192.168.1.1/24 interface=bridge network=192.168.1.0

add address=192.168.5.1/24 interface=bridge network=192.168.5.0

add address=192.168.4.1/24 interface=bridge network=192.168.4.0

/ip cloud

set ddns-update-interval=12h

/ip dhcp-client

add dhcp-options=hostname,clientid disabled=no interface=ether1

add dhcp-options=hostname,clientid disabled=no interface=ether2

/ip dhcp-server network

add address=192.168.1.0/24 dns-server=8.8.8.8,1.1.1.1 gateway=192.168.1.1 netmask=24

/ip dns

set allow-remote-requests=yes cache-max-ttl=1d max-concurrent-queries=500 max-concurrent-tcp-sessions=200 servers=8.8.8.8,1.1.1.1

/ip firewall mangle

add action=accept chain=prerouting dst-address=192.168.2.0/24 in-interface=bridge

add action=accept chain=prerouting dst-address=192.168.3.0/24 in-interface=bridge

add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether1 new-connection-mark=no-mark passthrough=yes

add action=mark-connection chain=prerouting connection-mark=no-mark in-interface=ether2 new-connection-mark=no-mark passthrough=yes

add action=accept chain=prerouting dst-address=192.168.5.0/24 in-interface=bridge

add action=accept chain=prerouting disabled=yes dst-address=192.168.1.0/24 in-interface=bridge

add action=accept chain=prerouting dst-address=192.168.4.0/24 in-interface=bridge

/ip route

add distance=2 gateway=192.168.2.1

/ip service

set telnet disabled=yes

set ftp disabled=yes

set ssh disabled=yes

set api disabled=yes

set api-ssl disabled=yes
matteofuolega
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 28
Iscritto il: dom 21 dic 2014, 15:20
Uso routerOS dalla Versione: v3.x
Certificazioni Mikrotik: MTCNA N°2009NA2216 presso SICE TELECOM
MTCRE
MTCSE
MTCSWE
Preferred Training Centre: SICE TELECOM

Re: failover due wan un bridge

Messaggioda matteofuolega » dom 14 lug 2019, 18:05

mi sono dimenticato di copiare anche queste due regole nat
Codice: Seleziona tutto

/ip firewall nat

add action=masquerade chain=srcnat out-interface=ether1

add action=masquerade chain=srcnat out-interface=ether2
matteofuolega
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 28
Iscritto il: dom 21 dic 2014, 15:20
Uso routerOS dalla Versione: v3.x
Certificazioni Mikrotik: MTCNA N°2009NA2216 presso SICE TELECOM
MTCRE
MTCSE
MTCSWE
Preferred Training Centre: SICE TELECOM

Re: failover due wan un bridge

Messaggioda ppraz » dom 14 lug 2019, 19:20

Non vedo dove hai configurato il failover
Manca un pezzo di configurazione?
Ad esempio non vedo gli IP sulle ether1 e ether2, non vedo il netwatch per fare il failover, non vedo le rotte statiche per cambiare il default gateway...
ppraz
Staff rosIT
Staff rosIT
 
Messaggi: 997
Iscritto il: sab 12 mar 2011, 14:13
Uso routerOS dalla Versione: v3.x

Re: failover due wan un bridge

Messaggioda matteofuolega » dom 14 lug 2019, 19:43

grazie della risposta ppraz
la configurazione è tutta quella che ho pubblicato
gli ip delle ether 1 e 2 sono in dhcp client quindi vengono rilasciati dei rispettivi modem per il resto non ho trovato come configurare il failover o per lo meno pensavo di averlo fatto
riesci a darmi una dritta su dove trovarlo che possa fare al caso mio grazie, mi sono passato al setaccio tutto il forum
matteofuolega
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 28
Iscritto il: dom 21 dic 2014, 15:20
Uso routerOS dalla Versione: v3.x
Certificazioni Mikrotik: MTCNA N°2009NA2216 presso SICE TELECOM
MTCRE
MTCSE
MTCSWE
Preferred Training Centre: SICE TELECOM

Re: failover due wan un bridge

Messaggioda ppraz » dom 14 lug 2019, 22:04

No certo allora non hai un failover, hai solo 2 gateway, ma nessuna logica per decidere quale usare.
La logica deve farti usare il preferenziale se funzionante, l'altro in caso il primo fallisca.

Codice: Seleziona tutto
/interface ethernet
set [ find default-name=ether4 ] comment=main
set [ find default-name=ether5 ] comment=backup
/ip dhcp-client
add default-route-distance=10 dhcp-options=hostname,clientid disabled=no \
    interface=ether5
/ip address
add address=192.168.10.254/24 interface=ether4


Fin qui tutto chiaro, no?
ether4 è la mia ADSL principale
ether5 è la backup
ether4 ho messo ip statico per comodità
ether5 DHCP

Codice: Seleziona tutto
/ip route
add comment=DF distance=1 gateway=192.168.10.1
add distance=1 dst-address=1.0.0.1/32 gateway=192.168.10.1


Qua imposto il default gateway sulla ether4, ip 192.168.10.1
Inoltre imposto una rotta statica per l'IP 1.0.0.1, che userò come spia per verificare lo stato della ADSL main

Codice: Seleziona tutto
/tool netwatch
add down-script="ip route set [find comment=DF] distance=100" host=1.0.0.1 \
    timeout=5s up-script="ip route set [find comment=DF] distance=1"


Questo ti manca proprio, pingo tramite il netwatch l'IP 1.0.0.1, che uscirà sempre tramite ADSL main, se il ping va a buon fine imposto a 1 la distanza del default gateway, se invece fallisce imposto la distanza a 100, di contro il gateway secondario (quello preso tramite DHCP) prevale e diventa il nuovo gateway
ppraz
Staff rosIT
Staff rosIT
 
Messaggi: 997
Iscritto il: sab 12 mar 2011, 14:13
Uso routerOS dalla Versione: v3.x

Re: failover due wan un bridge

Messaggioda matteofuolega » dom 14 lug 2019, 23:00

grazie ppraz
ho modificato le tre regole per adattarle alla mia routerboard
io ho sulla ether 1 telecom 192.168.3.1 modem
sulla ether 2 eolo 192.168.2.1 modem
e sul bridge dhcp server 192.168.1.1/24
dovrebbe andare bene cosi
la provo su una routerboard di prova e domani faccio le modifiche su quella installata


Codice: Seleziona tutto
/interface ethernet
set [ find default-name=ether1 ] comment=main telecom
set [ find default-name=ether2 ] comment=backup eolo
/ip dhcp-client
add default-route-distance=10 dhcp-options=hostname,clientid disabled=no \
    interface=ether2
/ip address
add address=192.168.3.2/24 interface=ether1


/ip route
add comment=DF distance=1 gateway=192.168.3.1
add distance=1 dst-address=1.0.0.1/32 gateway=192.168.10.1


/tool netwatch
add down-script="ip route set [find comment=DF] distance=100" host=1.0.0.1 \
    timeout=5s up-script="ip route set [find comment=DF] distance=1"
matteofuolega
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 28
Iscritto il: dom 21 dic 2014, 15:20
Uso routerOS dalla Versione: v3.x
Certificazioni Mikrotik: MTCNA N°2009NA2216 presso SICE TELECOM
MTCRE
MTCSE
MTCSWE
Preferred Training Centre: SICE TELECOM

Re: failover due wan un bridge

Messaggioda ppraz » lun 15 lug 2019, 13:49

matteofuolega ha scritto:/ip route
add comment=DF distance=1 gateway=192.168.3.1
add distance=1 dst-address=1.0.0.1/32 gateway=192.168.3.1


Occhio al gateway per pingare la sonda esterna
ppraz
Staff rosIT
Staff rosIT
 
Messaggi: 997
Iscritto il: sab 12 mar 2011, 14:13
Uso routerOS dalla Versione: v3.x

failover due wan un bridge

Messaggioda matteowifi » lun 15 lug 2019, 19:56

Grazie ppraz me ne sono accorto anch’io grazie dell’appunto , una domanda l’indirizzo 1.0.0.1/32 è un server tipo 8.8.8.8 di Google? Serve solo per capire se la connessione internet è funzionante? Effettua un Ping se riceve risposta bene altrimenti nega la regola.


Inviato dal mio iPhone utilizzando Tapatalk
matteowifi
Mikrotik-User 10° Liv
Mikrotik-User 10° Liv
 
Messaggi: 26
Iscritto il: sab 11 apr 2015, 7:47

Re: failover due wan un bridge

Messaggioda pioccd » lun 15 lug 2019, 20:09

Si esatto, è un dns cloudflare tipo google
pioccd
Mikrotik-User 4° Liv
Mikrotik-User 4° Liv
 
Messaggi: 217
Iscritto il: mer 25 feb 2015, 18:58
Uso routerOS dalla Versione: v6.x

Re: failover due wan un bridge

Messaggioda ppraz » lun 15 lug 2019, 21:54

pioccd ha scritto:Si esatto, è un dns cloudflare tipo google


Confermo, serve a garantire che l'host sia sempre UP
Potresti usare un altro IP, io ho preferito quello perché poco usato e sempre attivo
ppraz
Staff rosIT
Staff rosIT
 
Messaggi: 997
Iscritto il: sab 12 mar 2011, 14:13
Uso routerOS dalla Versione: v3.x


Prossimo

Torna a RouterOS

Chi c’è in linea

Visitano il forum: Nessuno e 26 ospiti