===============================================================
Single LAN edge deployment with failover
===============================================================

The following page explains how to set up an edge node deployment with failover
capability, connecting to both a primary and secondary remote node or
node group.

.. contents::
   :local:
   :depth: 1

Failover to secondary core node
===============================

.. graphviz::

    graph {
        rankdir=TB;
        newrank=true;
        fontname="Arial";
        splines=ortho;
        bgcolor="transparent";
        nodesep=0.25;
        ranksep=0.25;

        node [
            shape=box,
            style="filled,rounded",
            fontname="Arial",
            fontsize=12
        ];

        edge [
            penwidth=1.5,
            fontname="Arial",
            fontsize=10
        ];

        lan [label=<LAN: <font color="#333333">198.51.100.0/24</font><br align="left"/>LAN: <font color="#333333">2001:db8::/64</font><br align="left"/>>, fillcolor="#FFFFFF", color="#666666"];

        subgraph cluster_dc0 {
            label="Node: dc0 (Primary)";
            labelloc="t";
            style="filled,rounded";
            fillcolor="#E9F7EF";
            color="#1E8449";

            dc0_eth0 [
                label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">public</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">203.0.113.1/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8:1::1/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✔ (IPv4/IPv6)</font><br align="left"/>>,
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            dc0_peer [
                label=<<b>Peer: Default</b><br align="left"/>    Mode: <font color="#D4A90D">Listen</font><br align="left"/>>,
                fillcolor="#FEF9E7",
                color="#F1C40F"
            ];

            dc0_eth0 -- dc0_peer [labelangle=70, labeldistance=27, taillabel="The dashed nodes and\nedges correspond to\nthe failover node"];
        }

        subgraph cluster_dc1 {
            label="Node: dc1 (Failover)";
            labelloc="t";
            style="filled,rounded,dashed";
            fillcolor="#E9F7EF";
            color="#1E8449";

            dc1_eth0 [
                label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">public</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">192.0.2.1/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8:2::1/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✔ (IPv4/IPv6)</font><br align="left"/>>,
                style="filled,rounded,dashed",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            dc1_peer [
                label=<<b>Peer: Default</b><br align="left"/>    Mode: <font color="#D4A90D">Listen</font><br align="left"/>>,
                style="filled,rounded,dashed",
                fillcolor="#FEF9E7",
                color="#F1C40F"
            ];

            dc1_eth0 -- dc1_peer [style="dashed"];
        }

        subgraph cluster_cpe0 {
            label="Node: cpe0";
            labelloc="b";
            style="filled,rounded";
            fillcolor="#E9F7EF";
            color="#1E8449";

            cpe0_route1 [
                label=<<b>Route: 0.0.0.0/0</b><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    Nexthop: <font color="#333333">Default</font><br align="left"/>    Preference: <font color="#333333">500</font><br align="left"/>>,
                style="filled",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_route2 [
                label=<<b>Route: ::/0</b><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    Nexthop: <font color="#333333">Default</font><br align="left"/>    Preference: <font color="#333333">500</font><br align="left"/>>,
                style="filled",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_nexthop [
                label=<<b>Nexthop: Peer</b><br align="left"/>    Peer: <font color="#333333">Default</font><br align="left"/>>
                style="filled",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_peer [
                label=<<b>Peer: Default</b><br align="left"/>    Mode: <font color="#D4A90D">Connect</font><br align="left"/>    Interface: <font color="#D4A90D">eth1</font><br align="left"/>    Interface: <font color="#D4A90D">eth2</font><br align="left"/>    Remote (node): <font color="#D4A90D">dc0</font><br align="left"/>    Preference: <font color="#D4A90D">500</font><br align="left"/>    Remote (node): <font color="#D4A90D">dc1</font><br align="left"/>    Preference: <font color="#D4A90D">400</font><br align="left"/>>,
                fillcolor="#FEF9E7",
                color="#F1C40F"
            ];

            cpe0_eth0 [
                label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">lan0</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">198.51.100.1/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8::1/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✗</font><br align="left"/>>,
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_eth1 [
                label=<<b>Interface: eth1</b><br align="left"/>    Aliases: <font color="#484D4D">wan0</font><br align="left"/>    VRF: <font color="#484D4D">No VRF</font><br align="left"/>    IPv4: <font color="#484D4D">DHCP</font><br align="left"/>    Keep on shutdown: <font color="#484D4D">✔ (IPv4)</font><br align="left"/>>
            ];

            cpe0_eth2 [
                label=<<b>Interface: eth2</b><br align="left"/>    Aliases: <font color="#484D4D">wan1</font><br align="left"/>    VRF: <font color="#484D4D">No VRF</font><br align="left"/>    IPv4: <font color="#484D4D">DHCP</font><br align="left"/>    Keep on shutdown: <font color="#484D4D">✗</font><br align="left"/>>
            ];

            cpe0_peer -- cpe0_eth1 [weight=100];
            cpe0_peer -- cpe0_eth2 [weight=100];
            cpe0_route1 -- cpe0_route2 -- cpe0_eth0 [style=invis, weight=100];
            cpe0_route1 -- cpe0_eth0 [constraint=false];
            cpe0_route2 -- cpe0_eth0 [constraint=false];
            cpe0_route1 -- cpe0_nexthop [constraint=false];
            cpe0_route2 -- cpe0_nexthop [constraint=false];
            cpe0_nexthop -- cpe0_peer [constraint=false];
        }

        dc0_peer -- cpe0_peer [color="#F1C40F"];
        dc1_peer -- cpe0_peer [color="#F1C40F", style="dashed"];
        cpe0_eth0 -- lan;

        { rank=same; cpe0_route1 -- cpe0_route2 -- cpe0_nexthop -- cpe0_peer [style=invis] }
        { rank=same; cpe0_eth0 -- cpe0_eth1 -- cpe0_eth2 [style=invis] }
    }

|

Instructions
------------

#. Follow the instructions to `set up two core nodes
   <core-node-setup.html>`__ ``dc0`` (primary) and ``dc1`` (failover), with the
   following interface configuration on ``dc1``:

   - Name: ``eth0``

      - Aliases: ``public``
      - VRF: ``Global``
      - IPv4: ``192.0.2.1/24``
      - IPv6: ``2001:db8:2::1/64``
      - Keep on shutdown enabled on both addresses

#. Create a new node record on the management server with the name ``cpe0``.

#. Add the following interfaces to the newly created node:

   - Name: ``eth0``

      - Aliases: ``lan0``
      - VRF: ``Global``
      - IPv4: ``198.51.100.1/24``
      - IPv6: ``2001:db8::1/64``
      - Keep on shutdown disabled

   - Name: ``eth1``

      - Aliases: ``wan0``
      - VRF: ``No VRF``
      - IPv4: ``DHCP``
      - Keep on shutdown enabled

   - Name: ``eth2``

      - Aliases: ``wan1``
      - VRF: ``No VRF``
      - IPv4: ``DHCP``
      - Keep on shutdown disabled

#. Next, `add a peer <../peers/managing-peers.html>`__ to the node with two
   remote targets:

   - Name: ``Default``

      - Interface: ``eth1`` (Preference: ``500``)
      - Interface: ``eth2`` (Preference: ``500``)
      - Remote (node): ``dc0`` (Preference: ``500``)
      - Remote (node): ``dc1`` (Preference: ``400``)

#. Then, `add a nexthop <../routing-and-vrfs/nexthops/managing-nexthops.html>`__
   to the node:

   - Type: ``Peer``

      - Peer: ``Default``

#. Finally, `add two routes <../routing-and-vrfs/routes/managing-routes.html>`__
   to the node:

   - Destination: ``0.0.0.0/0``

      - VRF: ``Global``
      - Nexthop: ``Default`` (Preference: ``500``)

   - Destination: ``::/0``

      - VRF: ``Global``
      - Nexthop: ``Default`` (Preference: ``500``)

#. You now have a complete edge node configuration forming a peer connection
   with a remote node with failover to a secondary remote node.

Failover to secondary core node group
=====================================

.. graphviz::

    graph {
        rankdir=TB;
        newrank=true;
        fontname="Arial";
        splines=ortho;
        bgcolor="transparent";
        nodesep=0.25;
        ranksep=0.25;

        node [
            shape=box,
            style="filled,rounded",
            fontname="Arial",
            fontsize=12
        ];

        edge [
            penwidth=1.5,
            fontname="Arial",
            fontsize=10
        ];

        lan [label=<LAN: <font color="#333333">198.51.100.0/24</font><br align="left"/>LAN: <font color="#333333">2001:db8::/64</font><br align="left"/>>, fillcolor="#FFFFFF", color="#666666"];

        subgraph cluster_west {
            label="Group: West (Primary)";
            labelloc="t";
            style="filled,rounded";
            fillcolor="#EAECEE";
            color="#666666";

            subgraph cluster_dc1 {
                label="Node: dc1";
                labelloc="t";
                style="filled,rounded";
                fillcolor="#E9F7EF";
                color="#1E8449";

                dc1_eth0 [
                    label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">public</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">203.0.113.2/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8:1::2/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✔ (IPv4/IPv6)</font><br align="left"/>>,
                    fillcolor="#FFFFFF",
                    color="#666666"
                ];
            }

            subgraph cluster_dc0 {
                label="Node: dc0";
                labelloc="t";
                style="filled,rounded";
                fillcolor="#E9F7EF";
                color="#1E8449";

                dc0_eth0 [
                    label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">public</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">203.0.113.1/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8:1::1/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✔ (IPv4/IPv6)</font><br align="left"/>>,
                    fillcolor="#FFFFFF",
                    color="#666666"
                ];
            }

            west_peer [
                label=<<b>Peer: Default</b><br align="left"/>    Mode: <font color="#D4A90D">Listen</font><br align="left"/>>,
                fillcolor="#FEF9E7",
                color="#F1C40F"
            ];

            dc1_eth0 -- west_peer [labelangle=75, labeldistance=35.5, taillabel="The dashed nodes and\nedges correspond to\nthe failover group"];
            dc0_eth0 -- west_peer;
        }

        subgraph cluster_east {
            label="Group: East (Failover)";
            labelloc="t";
            style="filled,rounded,dashed";
            fillcolor="#EAECEE";
            color="#666666";

            subgraph cluster_dc3 {
                label="Node: dc3";
                labelloc="t";
                style="filled,rounded,dashed";
                fillcolor="#E9F7EF";
                color="#1E8449";

                dc3_eth0 [
                    label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">public</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">192.0.2.2/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8:2::2/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✔ (IPv4/IPv6)</font><br align="left"/>>,
                    style="filled,rounded,dashed",
                    fillcolor="#FFFFFF",
                    color="#666666"
                ];
            }

            subgraph cluster_dc2 {
                label="Node: dc2";
                labelloc="t";
                style="filled,rounded,dashed";
                fillcolor="#E9F7EF";
                color="#1E8449";

                dc2_eth0 [
                    label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">public</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">192.0.2.1/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8:2::1/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✔ (IPv4/IPv6)</font><br align="left"/>>,
                    style="filled,rounded,dashed",
                    fillcolor="#FFFFFF",
                    color="#666666"
                ];
            }

            east_peer [
                label=<<b>Peer: Default</b><br align="left"/>    Mode: <font color="#D4A90D">Listen</font><br align="left"/>>,
                style="filled,rounded,dashed",
                fillcolor="#FEF9E7",
                color="#F1C40F"
            ];

            dc3_eth0 -- east_peer [style="dashed"];
            dc2_eth0 -- east_peer [style="dashed"];
        }

        subgraph cluster_cpe0 {
            label="Node: cpe0";
            labelloc="b";
            style="filled,rounded";
            fillcolor="#E9F7EF";
            color="#1E8449";

            cpe0_route1 [
                label=<<b>Route: 0.0.0.0/0</b><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    Nexthop: <font color="#333333">Default</font><br align="left"/>    Preference: <font color="#333333">500</font><br align="left"/>>,
                style="filled",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_route2 [
                label=<<b>Route: ::/0</b><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    Nexthop: <font color="#333333">Default</font><br align="left"/>    Preference: <font color="#333333">500</font><br align="left"/>>,
                style="filled",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_nexthop [
                label=<<b>Nexthop: Peer</b><br align="left"/>    Peer: <font color="#333333">Default</font><br align="left"/>>
                style="filled",
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_peer [
                label=<<b>Peer: Default</b><br align="left"/>    Mode: <font color="#D4A90D">Connect</font><br align="left"/>    Interface: <font color="#D4A90D">eth1</font><br align="left"/>    Interface: <font color="#D4A90D">eth2</font><br align="left"/>    Remote (group): <font color="#D4A90D">West</font><br align="left"/>    Preference: <font color="#D4A90D">500</font><br align="left"/>    Remote (group): <font color="#D4A90D">East</font><br align="left"/>    Preference: <font color="#D4A90D">400</font><br align="left"/>>,
                fillcolor="#FEF9E7",
                color="#F1C40F"
            ];

            cpe0_eth0 [
                label=<<b>Interface: eth0</b><br align="left"/>    Aliases: <font color="#333333">lan0</font><br align="left"/>    VRF: <font color="#333333">Global</font><br align="left"/>    IPv4: <font color="#333333">198.51.100.1/24</font><br align="left"/>    IPv6: <font color="#333333">2001:db8::1/64</font><br align="left"/>    Keep on shutdown: <font color="#333333">✗</font><br align="left"/>>,
                fillcolor="#FFFFFF",
                color="#666666"
            ];

            cpe0_eth1 [label=<<b>Interface: eth1</b><br align="left"/>    Aliases: <font color="#484D4D">wan0</font><br align="left"/>    VRF: <font color="#484D4D">No VRF</font><br align="left"/>    IPv4: <font color="#484D4D">DHCP</font><br align="left"/>    Keep on shutdown: <font color="#484D4D">✔ (IPv4)</font><br align="left"/>>
            ];

            cpe0_eth2 [label=<<b>Interface: eth2</b><br align="left"/>    Aliases: <font color="#484D4D">wan1</font><br align="left"/>    VRF: <font color="#484D4D">No VRF</font><br align="left"/>    IPv4: <font color="#484D4D">DHCP</font><br align="left"/>    Keep on shutdown: <font color="#484D4D">✗</font><br align="left"/>>
            ];

            cpe0_peer -- cpe0_eth1 [weight=100];
            cpe0_peer -- cpe0_eth2 [weight=100];
            cpe0_route1 -- cpe0_route2 -- cpe0_eth0 [style=invis, weight=100];
            cpe0_route1 -- cpe0_eth0 [constraint=false];
            cpe0_route2 -- cpe0_eth0 [constraint=false];
            cpe0_route1 -- cpe0_nexthop [constraint=false];
            cpe0_route2 -- cpe0_nexthop [constraint=false];
            cpe0_nexthop -- cpe0_peer [constraint=false];
        }

        west_peer -- cpe0_peer [color="#F1C40F"];
        east_peer -- cpe0_peer [color="#F1C40F", style="dashed"];
        cpe0_eth0 -- lan;

        { rank=same; cpe0_route1 -- cpe0_route2 -- cpe0_nexthop -- cpe0_peer [style=invis] }
        { rank=same; cpe0_eth0 -- cpe0_eth1 -- cpe0_eth2 [style=invis] }
    }

|

Instructions
------------

#. Follow the instructions to `set up two core node groups
   <core-node-group-setup.html>`__ ``West`` (primary) and ``East`` (failover).
   For the ``East`` node group, call the first node ``dc2`` and give it the
   following interface configuration:

    - Name: ``eth0``

      - Aliases: ``public``
      - VRF: ``Global``
      - IPv4: ``192.0.2.1/24``
      - IPv6: ``2001:db8:2::1/64``
      - Keep on shutdown enabled on both addresses

   In the same node group, call the second node ``dc3`` and give it the
   following interface configuration:

    - Name: ``eth0``

      - Aliases: ``public``
      - VRF: ``Global``
      - IPv4: ``192.0.2.2/24``
      - IPv6: ``2001:db8:2::2/64``
      - Keep on shutdown enabled on both addresses

#. Next, follow the `instructions for connecting to a secondary failover node
   <single-lan-edge-deployment-with-failover.html#failover-to-secondary-core-node>`__,
   but when configuring the peer, set the remote targets to the two node groups
   you created.