It's not realistic to do this: - lxc-create is only called when the container is created whereas lxc.network.* can be changed at any point in time - The Ubuntu template maintains a cache of the generated system, so we'd need to do these as an extra step when re-using the cache as we sure wouldn't want to cache the generated file - The expanded configuration (with all includes) isn't provided to the template script or even computed by LXC at that point - A bunch of Linux distributions (and Ubuntu is/was one of those) will freak out when the ip and routing table is pre-filled, causing a boot failure. - There is indeed no way to configure DNS, nor will there be one as it's not something that's tied to a network namespace in the kernel, but is a pure userspace thing which can differ based on distros and therefore is out of scope for LXC itself.
The way we allow people to do such things with LXD is by feeding cloud-init with yaml network configuration which will then be applied to the distro's configuration on first boot. This could be made to work with the ubuntu-cloud template which supports passing cloud-init configuration already (but doesn't support network- config right now) but that wouldn't be tied to the lxc.network.* config, instead just passing static configuration to cloud-init and have it record it all in /etc/network/interfaces on first boot. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1661825 Title: interfaces always dhcp in ubuntu template To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1661825/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
