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
Touch seeded packages, which is subscribed to lxc in Ubuntu.
https://bugs.launchpad.net/bugs/1661825

Title:
  interfaces always dhcp in ubuntu template

Status in lxc package in Ubuntu:
  Won't Fix

Bug description:
  The ubuntu template always set the containers interfaces to dhcp for
  eth0, even if you have lxc.network.ipv4 specified. It should be either
  set to static and the same settings, or more preferred manual.

  The missing bit is dns server for the guest. Not sure how we would
  like to get that set in the guest.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1661825/+subscriptions

-- 
Mailing list: https://launchpad.net/~touch-packages
Post to     : touch-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~touch-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to