Juju and Fan networking

Fan networking addresses a need raised by the proliferation of container usage
in an IPv4 context: the ability to manage the address space such that network
connectivity among containers running on separate hosts is achieved.

Juju integrates with the Fan to provide network connectivity between containers
that was hitherto not possible. The typical use case is the seamless
interaction between deployed applications running within LXD containers on
separate Juju machines.

Fan overview

The Fan is a mapping between a smaller IPv4 address space (e.g. a /16 network)
and a larger one (e.g. a /8 network) where subnets from the smaller one (the
underlay network) are assigned to addresses on the larger one (the
overlay network). Connectivity between containers on the larger network is
enabled in a simple and efficient manner.

In the case of the above networks (/16 underlay and /8 overlay), each host
address on the underlay "provides" 253 addresses on the overlay. Fan networking
can thus be considered a form of "address expansion".

Cloud provider requirements

Juju autoconfigures Fan networking for both the AWS and GCE clouds. All that
is needed is a controller, which does not need any special Fan options passed
during its creation.

In principle, all public cloud types can utilize the Fan. Yet due to the myriad
ways a cloud may configure their subnets your mileage may vary. At the very
least, if you are using a cloud other than AWS or GCE, manual configuration at
the Juju level will be needed (the above model options). Adjustments at the
cloud level can also be expected. For guidance, the auto-configured clouds both
start with a /16 address space. Juju then maps it onto an /8.

Note that MAAS has LXD addressing built-in so there is no
point in applying the Fan in such a context.

Examples

Two examples are provided. Each will use a different cloud:

Rudimentary confirmation of the Fan using a GCE cloud

Deploying applications with the Fan using an AWS cloud

Rudimentary confirmation of the Fan using a GCE cloud

Fan networking works out-of-the-box with GCE. We'll use a GCE cloud to perform
a rudimentary confirmation that the Fan is in working order by creating two
machines with a LXD container on each. A network test will then be performed
between the two containers to confirm connectivity.

Deploying applications with the Fan using an AWS cloud

To use Fan networking with AWS a virtual private cloud (VPC) is required.
Fortunately, a working VPC is provided with every AWS account and is used, by
default, when creating regular EC2 instances.

Note:
You may need to create a new VPC if you are using an old AWS account (the
original VPC may be deficient). Some may simply prefer to have a
Juju-dedicated VPC. See Creating an AWS VPC for
instructions.

Whether you created a secondary VPC out of necessity or preference you will
need to inform Juju about it. See
AWS specific features for how to do this.

Here, Fan networking will be leveraged by deploying and relating applications
that are running in different LXD containers, where the containers are housed
on separate machines.