4 WAN FAILOVER (DHCP) MIKROTIK RB750Gr3
Setting up a failover configuration for your MikroTik RB750Gr3 router can ensure uninterrupted internet connectivity even if one of your WAN connections fails. In this guide, we will walk you through the steps to configure a failover setup using DHCP for your 4 WAN connections.
Step 1: Understanding Failover
Failover is a feature that allows your router to automatically switch to a backup internet connection when the primary connection becomes unavailable. This ensures that your network remains online even in the event of a failure.
Step 2: Connect your WAN connections
Connect all four WAN connections to the respective ports on your MikroTik RB750Gr3 router. Ensure that each connection is properly configured and working before proceeding to the next step.
Step 3: Configure DHCP Client
1. Open the Winbox application and connect to your MikroTik router.
/ip dhcp-client add interface=ether1 disabled=no
2. Repeat the above command for each of the four WAN interfaces (ether2, ether3, ether4, and ether5).
Step 4: Create a Script for Failover
1. Go to the "System" menu and select "Scripts".
2. Click on the "+" button to add a new script.
3. Enter a name for the script (e.g., "failover-script") and paste the following code into the "Source" field:
:local wan1 [/ip dhcp-client get [find interface=ether1] address]
:local wan2 [/ip dhcp-client get [find interface=ether2] address]
:local wan3 [/ip dhcp-client get [find interface=ether3] address]
:local wan4 [/ip dhcp-client get [find interface=ether4] address]
:if ($wan1="0.0.0.0/0") do={
/interface set ether1 disabled=yes
/interface set ether2 disabled=no
/interface set ether3 disabled=yes
/interface set ether4 disabled=yes
/interface set ether5 disabled=yes
}
:if ($wan2="0.0.0.0/0") do={
/interface set ether1 disabled=yes
/interface set ether2 disabled=yes
/interface set ether3 disabled=no
/interface set ether4 disabled=yes
/interface set ether5 disabled=yes
}
:if ($wan3="0.0.0.0/0") do={
/interface set ether1 disabled=yes
/interface set ether2 disabled=yes
/interface set ether3 disabled=yes
/interface set ether4 disabled=no
/interface set ether5 disabled=yes
}
:if ($wan4="0.0.0.0/0") do={
/interface set ether1 disabled=yes
/interface set ether2 disabled=yes
/interface set ether3 disabled=yes
/interface set ether4 disabled=yes
/interface set ether5 disabled=no
}
Step 5: Schedule the Failover Script
1. Go to the "System" menu and select "Scheduler".
2. Click on the "+" button to add a new scheduler.
3. Enter a name for the scheduler (e.g., "failover-scheduler") and set the "Interval" to the desired time interval for checking the WAN connections (e.g., 10 seconds).
4. In the "On Event" field, enter the following command:
/system script run failover-script
Step 6: Test the Failover Configuration
Disconnect one of the WAN connections and check if your MikroTik router automatically switches to the backup connection. Repeat this step for each WAN connection to ensure the failover configuration is working correctly.
Congratulations! You have successfully set up a failover configuration using DHCP for your 4 WAN connections on the MikroTik RB750Gr3 router. This ensures uninterrupted internet connectivity even if one of your WAN connections fails.
References
| Number | Source |
|---|---|
| 1 | https://wiki.mikrotik.com/wiki/Manual:Interface |
| 2 | https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Client |
| 3 | https://wiki.mikrotik.com/wiki/Manual:System/Scheduler |