MikroTik
How to Configure Keepalive on MikroTik: Step by Step
VPS 8GB RAM + 75GB NVMe — R$59/mês4 vCPUs · Tráfego ilimitado · Ubuntu Server LTS · Suporte para instalação incluso
Contratar agoraStep-by-Step Guide to Configure Keepalive on MikroTik
1. Access the MikroTik
- Conecte-se ao dispositivo via WinBox, SSH, ou interface Web.
2. Configure Keepalive on VPN Tunnels
- Para links como GRE, L2TP ou EOIP, o Keepalive pode ser ativado diretamente na interface do túnel:
RouterOS
/interface eoip set keepalive=10,3- Explicação dos parâmetros:
10: Intervalo entre os pacotes Keepalive (em segundos).3: Número de tentativas antes de considerar a conexão como inativa.
- Explicação dos parâmetros:
3. Verify the Keepalive Status on the Tunnel
- Monitore o estado do túnel para confirmar que o Keepalive está ativo:
RouterOS
/interface eoip print - An inactive tunnel will be displayed as "link down" when Keepalive detects failures.
4. Enable Netwatch to Monitor External IPs (optional)
- Configure o Netwatch para monitorar a conectividade de um IP remoto:
RouterOS
/tool netwatch add host=8.8.8.8 interval=10s timeout=5s up-script="/log info 'Conexão ativa com o Google DNS'" down-script="/log warning 'Conexão perdida com o Google DNS'"
5. Automate Corrective Actions
- Configure scripts para realizar ações em caso de falha de conexão, como reiniciar um túnel ou alternar para um link de backup:
RouterOS
/system script add name="ReiniciarEoIP" source="/interface eoip disable eoip-tunnel1; /interface eoip enable eoip-tunnel1" /tool netwatch set down-script="ReiniciarEoIP"
6. Test the Configuration
- Simulate a connection failure by physically disconnecting the link or blocking tunnel traffic.
- Verify that the configured actions are executed correctly.