📜 ⬆️ ⬇️

Configuring route switching between two providers on JunOS 11.1 or higher

In this short article I will describe the process of setting up functions for switching routes between two providers in case a physical link is present and even there is the presence of the local network of the provider, but there is no Internet itself.
Consider an example with 2 providers:

Configuration will consist of two stages:
  1. Configure rpm - which checks the availability of selected hosts
  2. Configuring ip-monitoring - which directly performs switching routing

Stage 1


As a rule, hosts are initially selected which are always available for icmp-ping in my example. For example, and not to follow, we will take to monitor the IP of large providers: 213.180.193.3, 209.85.148.104. I take 2 IPs for monitoring as one at a time false positives are possible. In a real situation, you can monitor both the provider’s network and the hops after its border routers.
Go to the configuration edit mode from the command line.
So:

set services rpm probe Probe-Servers test ya-test probe-type icmp-ping
We create a new server test section with the name Probe-Servers and a new name ya-test for the server test. Set test type to icmp-ping

set services rpm probe Probe-Servers test ya-test target address 213.180.193.3
We assign the target IP address for ping.
Attention! Make sure that people whom you ping do not mind or will not notice your tests in the general traffic flow and will not close this protocol to you.
')
set services rpm probe Probe-Servers test ya-test probe-count 5
Set the number of test packages for one test cycle.

set services rpm probe Probe-Servers test ya-test probe-interval 1
The interval between tests (test cycles).

set services rpm probe Probe-Servers test ya-test thresholds successive-loss 3
How many packets must be lost so that the test is considered not passed.

set services rpm probe Probe-Servers test ya-test destination-interface ge-0/0/1.0
Through which interface to send packets for verification - in our case it will be the interface of the main provider through which all the traffic goes.

set services rpm probe Probe-Servers test ya-test next-hop 1.1.1.1
Well, the routing for the next hop for the test package.

Similarly, configure the following go-test server:
set services rpm probe Probe-Servers test go-test probe-type icmp-ping
set services rpm probe Probe-Servers test go-test target address 209.85.148.104
set services rpm probe Probe-Servers test go-test probe-count 5
set services rpm probe Probe-Servers test go-test probe-interval 1
set services rpm probe Probe-Servers test go-test thresholds successive-loss 3
set services rpm probe Probe-Servers test go-test destination-interface ge-0/0/1.0
set services rpm probe Probe-Servers test go-test next-hop 1.1.1.1


By the way, the default routing table for the first provider with a metric below the default metric should be specified in the routing table. In my case, the metric is 50:
set routing-options static route 0.0.0.0/0 next-hop 1.1.1.1
set routing-options static route 0.0.0.0/0 metric 50


Stage 2


Setting up switching routing in case of unavailability of test servers.

set services ip-monitoring policy Server-Tracking match rpm-probe Probe-Servers
Installation of tracking tests with the name given above in Step 1.

set services ip-monitoring policy Server-Tracking then preferred-route route 0.0.0.0/0 next-hop 2.2.2.1
And in case of both servers crash, switch the routing to another provider.

Load the configuration and monitor the status with the command:
show services ip-monitoring status

The output of the command should be something like this:
Policy - Server-Tracking
RPM Probes:
Probe name Address Status
---------------------- ---------------- ---------
Probe-Servers 213.180.193.3 PASS
Probe-Servers 209.85.148.104 PASS
Route-Action:
route-instance route next-hop State
----------------- ----------------- ---------------- -------------
inet.0 0.0.0.0 2.2.2.1 NOT-APPLIED


Total


We set up provider switching based on the availability of certain hosts on the Internet. Many readers implemented this through perl or bash scripts. And of course, I don’t take a situation when BGP is configured with the provider, as in my example I don’t depend on the provider and to tomuzh very often you need to have services from two different competing providers with different channels to the outside world.

Source: https://habr.com/ru/post/135726/


All Articles