============================
Managed mesh space protocols
============================

Space protocols are a method of dynamically defining which VLAN interfaces and
addresses will be used on aggregators, as well as which dynamic routing
protocols will run.

The configuration is split into 3 sections:

* **Routing group VLAN assignments** manage the VLAN ID used for VLAN interfaces
  on aggregators in this routing group, along with the pool of addresses from
  which to assign IPs on these interfaces.
* **Persistent aggregators** which will run the VLAN interfaces and
  protocols even without any bonds from this space assigned to them.
* **Protocols and filters** which define how routing protocols will run in
  which routing group for this space, and how networks are filtered for
  dynamic routing protocols.

If you require more customization than this provides, it is recommended to
manage any interfaces and protocols manually on aggregators.

Routing group VLAN assignments
-------------------------------

The routing group VLAN assignment controls which VLAN interfaces will be
created for an aggregator in a space, along with what IP addresses to assign to
it. Each routing group may have at most one VLAN assignment for any particular
space.

VLAN interface addresses can be either assigned dynamically from a pool, or
statically assigned, or a combination of both. There are tradeoffs to each
approach.

Dynamic pool addressing
+++++++++++++++++++++++

The most efficient method is to use a pool in combination with space dynamic
routing protocols such as BGP, OSPF, or Babel. This allows for direct routing
between each aggregator and the gateway. However, this requires setting up the
routing protocol on the gateway. There are 2 pools that can be assigned to
draw addresses from, one for IPv4 and one for IPv6. Either can be omitted if
not needed for the space.

With this configured, any aggregator hosting a bond in the space will configure
a VLAN interface with a matching VLAN ID and addresses out of any pools
configured.

Static addressing
+++++++++++++++++

When dynamic routing is not feasible, a static address with a can be
configured along with gateway address instead. The gateway can be simply
configured to route internal networks to the given static address. The static
address will be configured on one of the aggregators in the routing group. If
a bond in the space is on another aggregator, there will be an additional hop
in the internal routing making it a little bit less efficient.

However, the chosen aggregator will be the one with the most bonds from the
space assigned to it to avoid excessive indirect routing. The chosen
aggregator may change as bonds are moved around manually or through aggregator
failover.

.. _persistent aggregators:

Persistent aggregators
-----------------------

Persistent aggregators are only necessary if you will ever run into the scenario
where no aggregators in a routing group with trunk interfaces are hosting
bonds. This can be useful if the gateway for a space is in a different routing
group than any of the aggregators bonds in that space are assigned to, for
example.

An aggregator defined as a persistent aggregator will always run the VLAN
interfaces, as well as any dynamic routing protocols.

Protocols and filters
----------------------

Much like the `protocols
<../../dynamic-routing/configuring-dynamic-routing-in-bonding.html>`__
available on nodes, these protocols will be adapted with any local addresses or
interface names from the routing group VLAN assignments before being applied on
any relevant aggregators. Any interface-specific configuration is unavailable
in the configuration here due to the generic nature of figuring out which
interface to use.
