Cloud-init networking doesn't work for instances on lxdbr0

This configuration is ignored how do I prepend a DNS server/search to lxdbr0 for DHCP instances?

network:
version: 2
renderer: NetworkManager
ethernets:
eth0:
dhcp4: true
dhcp6: false
nameservers:
addresses:
- 10.51.2.11
- 10.51.2.12
- 10.254.225.1
search:
- cbl.local
- lxd

Bridge networks have some options that might help you with this problem. These options can be set by lxc network config set <key> <value>:

  • dns.domain: Domain to advertise to DHCP clients and use for DNS resolution
  • dns.search: Full domain search list (accepts a comma-separated list of domains)

If I have a more detailed description of your use case I can try to provide detailed steps to proceed.

Also, what exactly do you mean by “This configuration is ignored”?

Hi

Please take a look at our cloud-init docs here:

https://documentation.ubuntu.com/lxd/en/latest/cloud-init/#how-to-specify-network-configuration-data

There’s some more info on cloud-init here:

https://cloudinit.readthedocs.io/en/latest/reference/network-config.html

When I say ignored I can add a network section to my cloud-init which has zero effect and if I modify the dns.domain and dns.search parameters and it has zero effect also on the instance.

Thats because I require to set a custom search which isn’t passed through to the OS…

Of course I can ping or connect to any IP address via the bridge but I can’t resolve hostnames using search.

Only method I’ve found that works is replacing the ifcfg-eth0 file in /etc/sysconfig/network-scripts/

That file is created by distrobuilder when it creates the LXD image so I’m pre-supposing it was a short-cut.