---
tags: cloud-init
---
# Controlling cloud-init's fallback network configuration
For reference, [LP: #1878682](https://bugs.launchpad.net/bugs/1878682)
> > That said, I do think that cloud-init can make it easier to enable ipv6 where
> > it's desired (but without having to write your own network config). We're
> > looking into supporting a kernel parameter or cloud-config option to enable
> > the default config to block on ipv6 (note, we cannot use user-data to indicate
> > this preference as user-data is processed after networking is up as user-data
> > can be fetched via network URL).
>
> I think this would be a good compromise to get things moving. In my case of
> downloading the cloud image and specifying NoCloudNet via the SMBIOS serial
> number option, another key might be the simplest path. Something like:
>
> n=4 : configure IPv4 only (default now)
> n=6 : configure IPv6 only
> n=64 : configure both stacks
>
> I might then pass in:
> ds=nocloud-net;n=6;h=cloudtest;i=iid-local01;s=http://gemini.home.nivex.net/cidata/
I like this a lot. This example would only apply to NoCloud datasource
shorthand, which is fine, but we should expand this into a general form
where users can control the policy for any datasource.
I suspect we might bike-shed a bit on the long and short form of the config.
We internally refer to 'fallback' network config, and to express what the
current default configuration in long form:
```
network:
fallback:
enabled: true
ipv4:
enabled: true
ipv6:
enabled: false
```
For ipv6, there are several options for dynamic configuration:
* dhcp6-stateful
* dhcp6-stateless
* slaac
* accept-ra
The sub-configuration for 6 is in a tuple form:
(a=addr_mode, r=ra_mode)
For SLAAC, to ensure we'd wait for something, I think we'd want
slaac to imply accept-ra=1 by default
a=slaac,r=1
For stateful, the dhcp6 client will block for a response and it will
include any routing information needed. One can independently enable
or disable RAs;
a=stateful
a=stateful,r=0
a=stateful,r=1
For stateless, I think we want to default accept-ra=1 by default otherwise
we may not have additional route advertisements yet even if we get a v6 ip
from the dhcp server.
a=stateless,r=1
I'd adjust the NoCloud shortname to fbn, and for non-NoCloud we can
prefix with ci-fbn.
```
fbn=4 : configure IPv4 only (current default)
fbn=6 : configure IPv6 only (default to a=slaac,r=1)
fbn=6,a=slaac,r=1 : same as above ^
fbn=6,a=slaac,r=0 : configure IPv6 only with SLAAC, disable RAs
fbn=6,a=stateful : dhcp6-stateful, accept kernel ra default behavior
fbn=6,a=stateful,r=0 : dhcp6-stateful, disable accepting RAs
fbn=6,a=stateless : dhcp6-stateless, accept-ra=1 by default
fbn=6,a=stateless,r=1 : same as above ^
fbn=6,a=stateless,r=0 : dhcp6-stateless, disable accepting RAs
```
For non-command line config:
```
# fbn=4
network:
fallback:
enabled: true
ipv4:
enabled: true
ipv6:
enabled: false
# fbn=6,a=slaac,r=1
network:
fallback:
enabled: true
ipv4:
enabled: false
ipv6:
enabled: true
address_mode: slaac
ra_mode: true
# fbn=6; note this also enables addr=slaac and ra=1
network:
fallback:
enabled: true
ipv4:
enabled: false
ipv6:
enabled: true
# fbn=6,a=slaac,r=0
network:
fallback:
enabled: true
ipv4:
enabled: false
ipv6:
enabled: true
address_mode: slaac
ra_mode: false
# fbn=6,a=stateful
network:
fallback:
enabled: true
ipv4:
enabled: false
ipv6:
enabled: true
address_mode: stateful
# fbn=6,a=stateful,r=0
network:
fallback:
enabled: true
ipv4:
enabled: false
ipv6:
enabled: true
address_mode: stateful
ra_mode: false
# fbn=6,a=stateless
network:
fallback:
enabled: true
ipv4:
enabled: false
ipv6:
enabled: true
address_mode: stateful
ra_mode: false
```
We'd consolidate the parsing of fbn in cloudinit/net/cmdline.py and
DataSourceNoCloud.py existing short-form parser can leverage the fbn
parser from cloudinit.net