In this short reference post , I will post some WAN link fail over scenarios. For example If you have two DSL wan links, and one of link goes down , What will happen? If your DSL modem is down – then check-gateway=pingcan save your packets from being sent to that link , But what if your modem is up, and telephone line is down? Or one of your ISP has a problem from there end ????

There are several method that you can use to sort this problem, either by using NetWatch tool to monitor WAN link , or you can use use scripts to periodically ping remote hosts. And then disable/enable routes.

Following is a very simple method you can use for fail over.

▼

SCENARIO #1

FAIL OVER for Dual WAN links without Load Balancing & without Scripting

We have two WAN links and we want to use second WAN for fail over ONLY, No load balancing is required.

To achieve fail-over follow the below

Example:

LAN = 192.168.0.1WAN1 GW= 192.168.1.1WAN2 GW= 192.168.2.1

External Host ip that we want to monitor for the WAN status. (You can use your ISP’s DNS / Web server ip also or any one which is more reliable and preferably closer to you)

Google DNS = 8.8.8.8TW DNS (PK) = 221.132.112.8

Following is complete script.

1# Make sure you change the interface names and IP addresses according to your network,2# In DNS section, Use your ISP’s DNS ip addresses3# You can use different host ip addresses for monitoring, preferably your primary ISP’s reliable servers like DNS or other. You can use other web sites ips too.

#### Following is ROUTE section where we will be using check-gateway function to monitor external hosts from each wan

/ip route

add dst-address=8.8.8.8 gateway=192.168.1.1 scope=10

add dst-address=221.132.112.8 gateway=192.168.2.1 scope=10

add distance=1 gateway=8.8.8.8 check-gateway=ping

add distance=2 gateway=221.132.112.8 check-gateway=ping

The above fail over method works fine,when the WAN1 link will fail , it will automatically fail over to secondary link, and when the wan1 link becomes available all load will shift back to wan1 link. The only negative is that we are using single wan host to monitor, if that particular host (e.g 8.8.8.8) ping goes down and the rest is fine , wan1 link will still shift to secondary link. To avoid it use multiple hosts to monitor wan connectivity.

▼

▼

SCENARIO #2

FAIL OVER for Dual WAN links without Load Balancing using NETWATCH SCRIPT

If you have 2 WAN Links , and you want to use PrimaryLink for Main internet usage, and in case PrimaryLink [WAN1] Looses its connectivity with the INTERNET (For example problem with the link between your modem and ISP or Problem between ISP link and the internet), then Secondary Link take its place, and when Primarylink [WAN1] restores, it will become active again. You can use the following scripts.

Netwatch SCRIPT to monitor Primary Link status

You will see following entries in LOG when WAN link goes DOWN and UP. You can also configure actions to email or SMS you if any link goes down for tack purposes, or if you want to be informed about the WAN status.

As showed in the image below . .

Script is good , because you can control the frequency and lot of other functions too.

.

.

.

.

SCENARIO #3

The following script does the two wan load balancing using PCC method, also if any of WAN link will fail , it will automatically fail over to secondary link, and when the particular failed link becomes available load will be start distributing among both links (remember it will not shift back previously made connections like downloads via idm etc. new packets will be distributed) .The only negative is that we are using single wan host to monitor, if that particular host (e.g 8.8.8.8) ping goes down and the rest is fine , wan1 link will still shift to secondary link. To avoid it use multiple hosts to monitor wan connectivity.

1# Make sure you change the interface names and IP addresses according to your network,2# In DNS section, Use your ISP’s DNS ip addresses3# You can use different host ip addresses for monitoring, preferably your primary ISP’s reliable servers like DNS or other. You can use other web sites ips too.