FANCTL(8) | FANCTL(8) |
fanctl - fan bridge administration
fanctl up [<options>...]
fanctl down [<options>...]
fanctl up -a
fanctl down -a
fanctl down -e
fanctl show
fanctl help
fanctl is used to set up, tear down, and inspect Fan bridge mappings and devices in the linux kernel.
A network Fan is a mechanism for expanding the range of IP addresses available to a system. It is most useful for containers such as Docker and LXC/LXD, but it can be used in other contexts as well. Fan works by creating a bridge that uses a mathematical mapping between the host's (or underlay's) /16 address and the Fan's (or overlay's) /8 address. By mapping addresses in this way, a 253-fold increase in address space can be achieved. For example, if the host machine uses a subnet of 172.16.0.0/16 and assigns a 250.0.0.0/8 Fan to an IP address of 172.16.3.4, the hosts's Fan overlay addresses will be in the 250.3.4.0/24 subnet, where 250 is derived from the user defined overlay network prefix.
# fanctl show Bridge Underlay Overlay Flags fan-250 172.16.3.4/16 250.0.0.0/8 dhcp host-reserve 1
The Fan mapping is defined by a combination of the underlay and overlay addresses. Each is defined as a CIDR network address. For example:
# fanctl up -u 172.16.3.4/16 -o 250.0.0.0/8
This example defines an overlay of 250.0.0.0/8 and an underlay of 172.16.3.4/16. When mapping an address in the 250.0.0.0/8 subnet, we take the 16 bits of destination address starting at bit 8 and replace the bottom 16 bits of the underlay address with it. For example, attempting to talk to 250.3.4.15 will trigger the packet to be sent to 172.16.3.4 for delivery.
It is not always possible to know the local underlay address at the time the configuration is generated (such as when a common configuration is desired on all systems). In this case we can specify the underlay address using only the underlay prefix, or by reference to an interface.
For example, to bring up a Fan bridge slice for each address in the 172.16.0.0/16 subnet, the following example examines each interface as it is currently configured and configures a matching slice at that time:
# fanctl up -u 172.16.0.0/16 -o 250.0.0.0/8
To bring up Fan slices corresponding to the addresses on a specific interface we can substitute the interface name:
# fanctl up -u ens3/16 -o 250.0.0.0/8
To bring up Fan slices corresponding to the addresses on the primary network interface (the interface with the default route), the keyword default can be substituted:
# fanctl up -u default/16 -o 250.0.0.0/8
Currently Fan can only apply overlay addresses with a /8 network mask, and underlay addresses with a /16 network mask. We expect to relax this limitation in a later update.
NOTE: The location and content of the configuration files should still be considered unstable as they could change in future. Use of fanatic is highly recommended as this command will make any necessary changes to the right config files.
Fan mappings are configured via /etc/network/fan by pairs of local (underlay) and overlay network addresses. The first element of each pair specifies the underlay range which should be mapped into the overlay network specified by the second element. For example:
# RFC1918 - we recommend you use these for easy interop with # other FAN users on small private networks. They provide # around 250 IP's per 192.168.0.0/16 address, or 16 per # 172.16.0.0/12 address. # local overlay 192.168.0.0/16 250.0.0.0/8 172.16.0.0/12 251.0.0.0/8
Comments are introduced via a hash (#), and blank lines are ignored.
Note, that the local (underlay) range does not need to match the subnet mask of the interface as long as all addresses of the larger scope are routeable. If for example the interface is configured as 192.168.122.2/24 but can reach all 192.168.0.0/16 addresses that will be part of the Fan network, the local (underlay) address of 192.168.0.0/16 can be used regardless.
It is expected that the /etc/network/fan configuration is globally managed ensuring that all hosts have consistent overlay to underlay mappings. Local deviation is managed via the fanctl config subcommand. This allow a local host to record additional flags against a specific overlay/underlay combination. For example:
# fanctl config set -u 172.16.0.0/16 -o 250.0.0.0/8 --enable
will set the --enable option to the local host configuration, triggering this Fan to be configured when the host interface is configured.
By default each Fan bridge represents a Fan overlay network which is expressed locally on the machine. The Fan bridge will have the various slice addresses mapped to it.
In legacy sliced mode each Fan bridge represents a slice of a Fan overlay network which is expressed locally on the machine. The Fan bridge will have the overlay addresses representing one local IP address mapped to it. A machine may have more than one local address on the underlay network, enabling it to have more than one such slice mapped. It may also have more than one overlay range defined for each local IP address.
Each Fan bridge is a separate broadcast domain, with routing between the bridges both locally and globally within the Fan.
Each Fan bridge appears as a bridge on the system, named for the overlay subnet hosted by that particular Fan bridge and the underlay address prefix for which it carries traffic. For our 250.0.0.0/8 on 172.16.3.4 example, the bridge would be named fan-250 and would carry all traffic for 250.3.4.0/24.
fanatic(8), /usr/share/doc/ubuntu-fan/README
Andy Whitcroft <apw@canonical.com>,
Stefan Bader <stefan.bader@canonical.com>
July 24, 2017 |