Skip to main content

How to use an IPsec as the last level of failover

An IPsec VPN of the same VNet can be the last level of the failover of a Direct Connect connection: if no Direct Connect peer answers, all the static routes of the connection go into the IPsec tunnel. It works with or without a backup peer: the order is primary peer, backup peer (if any), IPsec.

The general rules of the failover (monitoring, profiles, pause, history) are in How to set up failover for a Direct Connect connection. This page covers what is specific to the IPsec.

How it works​

  • On standby. While a Direct Connect peer carries the traffic, the IPsec stays connected but does not carry the static routes of the connection. The VNet router pings a Monitor IP on your side through the tunnel all the time, from its own address in a local subnet of the IPsec, to know whether the IPsec could take over.
  • Failover. The IPsec is the last resort: it only takes over when every Direct Connect peer configured (the primary and, if there is one, the backup) is down and the IPsec is up. Then the static routes move into the tunnel at once. Degradation never sends the traffic to the IPsec: it only switches between the Direct Connect peers.
  • Only its own routes. The IPsec takes over exactly the static routes of this connection. The same IPsec can be the failover of more than one connection; each one moves only its own routes.
  • No automatic return. The traffic never leaves the IPsec on its own. When a Direct Connect peer stays stable for the recovery time of the profile, the state shows Primary recovered or Backup recovered and you get a notice. Switch back when you are ready.
  • Automatic reconnection. When you save, the platform turns on the automatic reconnection of the chosen IPsec, so the tunnel comes back on its own if it drops.

Before you start​

  • A connection with the status BOUND and its static routes already created: the IPsec takes over exactly those routes. Without them, the section shows Add the static routes of this Direct Connect first: the IPsec takes over exactly those routes., with the Manage Routes button, which opens the Static routes tab of the page.
  • An IPsec in the same VNet, connected. Its remote subnets must cover the static routes of the connection, and its local subnets must cover the subnets of the VNet. What stays out does not cross the tunnel.
  • A host on your side, reached through the IPsec, that answers ping: it will be the Monitor IP. It must be inside one of the static routes and inside the remote subnets of the IPsec.
  • The customer-connect:direct_connect:manage permission and a permission to view IPsec connections (customer-connect:ipsec:view, or a broader one such as customer-connect:view). Without the second, the list says You need permission to view IPsec connections to choose one.
  • The virtual router of the VNet on an updated release. Otherwise the section shows The virtual router of this VNet needs release 1.0.6 before an IPsec can be used as failover. Ask support to update it.

Prepare your router​

When the traffic moves to the IPsec, your side must send the replies for this VNet back through the IPsec too. If your router keeps sending them through the Direct Connect, which is down, the replies are lost.

This change is on your side: the platform cannot make it for you. On your router, send the traffic for the VNet through the IPsec when the Direct Connect is down, using one of these:

  • a floating static route, the usual way: a route to the VNet through the IPsec with a higher administrative distance than the route through the Direct Connect, so it only takes over when the Direct Connect route goes away;
  • IP SLA tracking (or the equivalent of your vendor) that removes the Direct Connect route when it stops answering;
  • a routing policy that chooses the IPsec when the Direct Connect is down.

With any of these, your router keeps answering through the Direct Connect while it is up, and that is expected:

  • the IPsec card shows Up, with a yellow warning that the replies are coming back outside the tunnel;
  • the health test gives Works, with risks and shows the Action needed on your router box, because from here the platform cannot see your router switching when the Direct Connect goes down. You can save after accepting the risk;
  • when every Direct Connect peer goes down, the IPsec takes over and your router starts sending the traffic for the VNet through it.

Action needed on your router box, saying that replies came back through the Direct Connect, how to adjust your router and how to route the test address through the IPsec

Optional: prove the way back too​

To have the health test and the monitoring also prove the way back through the tunnel, route the address the tests leave from through the IPsec at all times, with a /32 route on your router. It is the address of the VNet router in a local subnet of the IPsec:

  • in the health test result, it is the first address of each test, one for each local subnet of the IPsec;
  • on the IPsec card, it is the address after from in the line about the monitoring, such as 10.20.1.1.

With this route the replies to the tests come back through the tunnel: the test gives Ready (when the IPsec also covers all the static routes and subnets), the warning leaves the card and the monitoring follows the way back through the tunnel all the time. The rest of the traffic of the VNet keeps following your floating route. This route is also on your side.

Choose and test the IPsec​

  1. Open the page of the connection: in Active Connections, click the name of the VNet (see Where the failover is).

  2. On the Failover tab, in IPsec failover, click Choose an IPsec.

  3. Under IPsec of this VNet, choose the IPsec. Each one shows its status, the remote peer and how much it covers, such as Covers all static routes · all VNet subnets or Covers 1 of 2 static routes, 1 only in part. An IPsec that covers none of the routes shows Can't be used: it covers none of the static routes of this Direct Connect. and cannot be chosen. If the VNet has no IPsec, the list says This VNet has no IPsec yet. and offers Go to IPsec.

  4. Fill in the Monitor IP, such as 10.50.0.10.

  5. (Optional) In Test addresses, enter a host in each route to test it too, up to 16. The test runs from every local subnet of the IPsec. A route that the IPsec does not cover shows Not covered by this IPsec; one covered only in part shows what is left out.

  6. Click Run health test. It can take up to a minute.

    IPsec failover section with the recife-vpn IPsec chosen, the Monitor IP 10.50.0.10 filled in and the Run health test button, numbered in order

The result shows under the button. Read it as explained in Read the health test result and, if needed, fix what it points out and click Run the test again.

Save​

  1. If the result is Works, with risks, read the Continue at your own risk? box and tick I understand what stays out of the IPsec and want to save it anyway, at my own risk.
  2. Click Save Changes, at the bottom of the tab. Above the button, recife-vpn will be saved as the IPsec failover when you click Save Changes. confirms what will be saved.

The platform only saves the IPsec with a test that:

  • was run on the same IPsec and with the same Monitor IP;
  • is still valid: nothing changed after it (static routes, subnets of the IPsec or Monitor IP);
  • is less than one hour old;
  • is not Not ready.

When something is missing, the text above Save Changes says what, such as Run the IPsec health test before saving. or Confirm that you continue at your own risk to save. Who accepted the risk, and when, stays on record: it shows on the IPsec card and in the History tab, as a settings change that lists the accepted risks.

Saving other settings later (profile, thresholds, backup peer) does not ask for a new test, as long as the IPsec and its Monitor IP stay the same.

Read the health test result​

The test pings each target (the Monitor IP and the test addresses) through the tunnel, from each local subnet of the IPsec, and checks whether the answer came back through the tunnel.

Health test result Works, with risks: the Action needed on your router box, what the IPsec covers, the test that came back through the Direct Connect and the risk acceptance ticked

Verdict​

VerdictWhat it meansCan save?
ReadyEvery test went and came back through the IPsec, and it covers all static routes and subnets.Yes
Works, with risksThe IPsec answers, but part of the traffic would not be protected by it: something is left out of the IPsec, or replies came back through the Direct Connect.Yes, after accepting the risk
Not readySome tests failed.No

Under the verdict, Tested shows when and by whom, and the state of the VPN.

What the IPsec covers​

  • Static routes of this Direct Connect, against the remote subnets of the IPsec.
  • Subnets of this VNet, against the local subnets of the IPsec.

Each network shows Covered, Partly covered or Not covered, and Left out lists the part outside. What is left out keeps going to the Direct Connect when the traffic moves to the IPsec, so it will not reach the other side. To cover it, add those networks to the IPsec subnets on both sides and test again.

Tests through the tunnel​

Each line shows the source address, the target (with MONITOR for the Monitor IP), the result, how many replies came back and the average latency. The tests that failed come first; Show the test that passed shows the others.

ResultWhat it meansWhat to do
Through the IPsecThe traffic went and came back through the IPsec.Nothing.
VPN downThe VPN is not established.Connect the IPsec or open its diagnostics.
Subnets not negotiatedThe subnets of this pair were not negotiated with the other side.Check the subnets configured on the remote device.
Came back through the Direct ConnectThe reply came back through the Direct Connect, not through the IPsec.Expected with a floating route while the Direct Connect is up: see Prepare your router. Allowed with risk acceptance, or route the source address through the IPsec with a /32 to get Through the IPsec (see Optional: prove the way back too).
Nothing came backThe packet went into the tunnel and nothing came back.The router on the other side needs a route back to this VNet through the IPsec, or a firewall there is blocking it.
Stopped on the wayThe traffic reached an address and stopped after it.Check the firewall or the routes of that device.
Host not answeringThe network of the host answers, but the host does not.Check that the host is on and that its firewall allows ICMP.
BlockedA device refused the packet (administratively blocked).Allow, on that firewall, the traffic coming from this VNet.

For Stopped on the way, Host not answering, Blocked and Nothing came back, Path, hop by hop shows each hop with its address and what it answered (Passed through, Destination answered, Unreachable, Blocked or No reply). The last hop that answered is highlighted.

Not ready result: the Monitor IP test stopped on the way after 10.50.0.254, with the path hop by hop open

A notice over the result tells when it no longer counts for saving: something changed after the test, the test is more than one hour old, or it used another Monitor IP. Run the test again.

After saving​

The IPsec shows as level 3 in Failover order, and the IPsec failover section shows its card.

IPsec card on standby, with the connection, the remote peer, the Monitor IP, the latency and loss, the warning that the replies come back through the Direct Connect, the risk accepted and the last health test

  • IPSEC with ACTIVE or STANDBY and its health.
  • Connection (a link to the IPsec), Remote peer and Monitor IP.
  • Avg latency, Packet loss and Last check, and a line saying which address the router pings, from which address and how often.
  • Risks accepted by, when the risk was accepted, and Last health test, which opens the last result.

The IPsec counts as up when the Monitor IP answers the pings sent through the tunnel. Two warnings can show on the card:

  • The tunnel is not established for the subnets of the probe. The pings cannot cross the tunnel, so the IPsec goes down. Check the IPsec connection and the subnets negotiated with the other side.
  • Replies are coming back outside the tunnel, through the Direct Connect. The IPsec stays Up: with a floating static route this is expected while the Direct Connect is up. As always, the IPsec only takes over when every Direct Connect peer is down, and then your router must send the traffic for this VNet through the IPsec. To have the monitoring follow the way back too, see Optional: prove the way back too.

What happens when the traffic goes to the IPsec​

The state becomes On IPsec and a yellow notice, on the Direct Connect page and on the page of the connection, says which IPsec is carrying the traffic and since when, and reminds you that While on the IPsec, your router must send the traffic for this VNet through it, not through the Direct Connect. When a peer is up again, the notice offers Switch to primary or Switch to backup; otherwise it offers View details.

Page of the connection with the traffic on the recife-vpn IPsec: the yellow notice, the On IPsec state and the IPsec card active in Failover order

You get a notice in the bell and an e-mail titled Traffic moved to the IPsec VPN. Later, when a peer stays stable, you get Primary peer recovered or Backup peer recovered; the traffic stays on the IPsec until you switch. If the IPsec also stops answering, you get All paths are down.

To move the traffic manually, use Switch to IPsec, Switch to primary or Switch to backup in Failover order, on the page of the connection. For the IPsec, the dialog asks Switch traffic to IPsec followed by the name, and the routes show via IPsec followed by the name. See Switch paths manually.

Change or remove the IPsec​

On the IPsec card:

  • Change IPsec opens the same editor. Choosing another IPsec or another Monitor IP asks for a new health test before saving. Keep current IPsec closes the editor without changes.
  • Remove IPsec asks for a second click. With a backup peer, the confirmation says Click again to remove the IPsec; the backup peer stays as failover; without one, Click again to remove the IPsec and turn automatic failover off.

While the traffic is on the IPsec, both are blocked and the card shows Change or remove the IPsec · switch traffic to a Direct Connect peer first.

An IPsec that is the failover of a connection cannot be deleted. Remove it from the failover first; otherwise the IPsec page refuses with a message such as The IPsec recife-vpn is the failover of the Direct Connect dc-recife. Remove it from the Direct Connect failover before deleting it.