Recursive Routing Example

Contents

Introduction

Let us suppose that we have several WAN links, and we want to monitor, whether the Internet is accessible through each of them. But what if your modem is up, and telephone line is down? What if one of your ISP has a problem inside it, so traceroute shows only a few hops - and then stops? Check-gateway can tell you your connection is down but maybe the problem is upstream?

Some people use NetWatch tool to monitor remote locations. Others use scripts to periodically ping remote hosts. And then disable routes or in some other way change the behavior of routing.

RouterOS has facilities that allow us to use only /ip routes to do such checking - no scripting and netwatch at all.

Implementation

Basic Setup

Let's suppose that we have two uplinks: GW1 , GW2 . It can be addresses of ADSL modems (like 192.168.1.1 and 192.168.2.1 ), or addresses of PPP interfaces (like pppoe-out1 and pptp-out1 ). Then, we have some policy routing rules, so all outgoing traffic is marked with ISP1 (which goes to GW1 ) and ISP2 (which goes to GW2 ) marks. And we want to monitor Host1 via GW1 , and Host2 via GW2 - those may be some popular Internet websites, like Google, Yahoo, etc.

Multiple host checking per Uplink

If Host1 or Host2 in #Basic Setup fails, corresponding link is considered failed too. For redundancy, we may use several hosts per uplink: let's monitor Host1A and Host1B via GW1 , and Host2A and Host2B via GW2 . Also, we'll use double recursive lookup, so that there were fewer places where HostN is mentioned.

Workaround 1

In ROS versions at least up to 4.10 there's a bug, and if your ethernet interface goes down (for example, your directly connected ADSL modem is powered off) and then brings up, recursive routes are not recalculated (or something) and all traffic still goes via another uplink. As a workaround, additional rules for each HostN may be used. When adding them, all is recalculated correctly: