[lxc-users] LXD static IP confusion
Serge E. Hallyn
serge at hallyn.com
Mon Aug 29 02:27:44 UTC 2016
On Sun, Aug 28, 2016 at 09:59:42AM +0100, Matt Green wrote:
> Hi Guys,
>
> I've currently got a 14.04 server running LXC, and I'm planning to use the
> upgrade to 16.04 as an excuse to switch to LXD.
>
> In the interim I thought I'd upgrade my proxy server and move it's services
> to LXD so I'm not messing with my pre-existing services.
>
> Anyway...
>
> I have a 16.04 server with LXD installed, I've set it up to bridge to my
> network interface (so the server isn't doing NAT, DHCP, etc.) and I've
> installed my first container with "lxc launch ubuntu:16.04 proxy".
>
> Now I want to give that container a static IP address.
> In LXC on 14.04 I've just edited /etc/network/interfaces manually.
> In LXD on 16.04 I see that there's a file
> called /etc/network/interfaces.d/50-cloud-init.cfg which is controlling the
> interface config and apparently I shouldn't edit it manually.
>
> According to https://github.com/lxc/lxd/issues/1168 LXD doesn't have
> anything to do with the host address config, but then what's this
> cloud-init thing?
>
> I'm not sure what to do now. Should I bypass cloud-init and configure my
> interface manually? Or is there a better way I should be doing this?
If you use the linuxcontainers.org images instead of the ubuntu: images,
you shouldn't have cloud-init (iirc). You can remove it by hand. It's
purpose is to support automated post-install customizations in a cloud
environment.
Now, in general the recommended way to get a 'static' ip address would be
to configure the dhcp server to hand the desired address to the container,
but of course /etc/network/interfaces should still work (if you drop
cloud-init)
More information about the lxc-users
mailing list