COMO CONFIGURAR FAILOVER NO MIKROTIK | WISSAM QUEMEL

3 min read 4 months ago
Published on Aug 11, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

Introduction

This tutorial will guide you through the process of configuring failover on a MikroTik router. Failover is essential for ensuring continuous internet connectivity by automatically switching to a backup connection if the primary one fails. This configuration is particularly useful for businesses and home users who rely on stable internet access.

Step 1: Access the MikroTik Router

  • Connect your computer to the MikroTik router via Ethernet or Wi-Fi.
  • Open a web browser and enter the router's IP address (usually 192.168.88.1).
  • Log in using your username and password (default is often admin with no password).

Step 2: Configure WAN Interfaces

  • Navigate to the "Interfaces" section in the MikroTik interface.
  • Identify your primary and secondary WAN connections.
  • Rename the interfaces for clarity (e.g., WAN1 for primary and WAN2 for secondary).
  • Ensure both interfaces are enabled and properly configured to connect to your ISPs.

Step 3: Set Up DHCP Client on WAN Interfaces

  • Go to "IP" > "DHCP Client".
  • Click on "+" to add a new DHCP client.
  • Select the primary WAN interface (WAN1) from the interface list.
  • Enable the DHCP client and apply the settings.
  • Repeat this process for the secondary WAN interface (WAN2).

Step 4: Configure Routing

  • Navigate to "IP" > "Routes".
  • Click on "+" to add a new route for the primary connection.
    • Destination: 0.0.0.0/0
    • Gateway: IP address of your primary WAN interface.
    • Distance: Set to 1 (this is the preferred route).
  • Add a secondary route for failover:
    • Destination: 0.0.0.0/0
    • Gateway: IP address of your secondary WAN interface.
    • Distance: Set to 2 (this is the backup route).

Step 5: Set Up Netwatch for Monitoring

  • Go to "Tools" > "Netwatch".
  • Click on "+" to add a new Netwatch entry.
  • For Host, enter an external IP address (e.g., 8.8.8.8 for Google DNS).
  • Set the interval to check the connection (e.g., every 10 seconds).
  • In the "Up" script, add:
    /ip route enable [find distance=2]
    
  • In the "Down" script, add:
    /ip route disable [find distance=2]
    
  • This script will enable the backup route when the primary fails and disable it when it is back online.

Step 6: Test the Configuration

  • Disconnect the primary WAN connection to simulate a failure.
  • Check if your internet traffic switches to the secondary WAN interface.
  • Reconnect the primary connection and verify that the traffic returns to it.

Conclusion

You have successfully configured failover on your MikroTik router, ensuring stable internet connectivity. Regularly monitor the performance and adjust the settings as needed. Consider testing the setup periodically to ensure it functions as expected. For further enhancements, explore additional MikroTik features such as load balancing or advanced monitoring tools.