[lxc-users] bionic image not getting IPv4 address
David Favor
david at davidfavor.com
Thu May 3 13:13:45 UTC 2018
Fajar A. Nugraha wrote:
> On Thu, May 3, 2018 at 7:57 PM, Tomasz Chmielewski <mangoo at wpkg.org> wrote:
>> Indeed, I can confirm it's some netplan-related issue with
>> /etc/netplan/10-lxc.yaml.
>>
>> Working version for bionic containers set up before 2018-May-02:
>>
>> network:
>> ethernets:
>> eth0: {dhcp4: true}
>> version: 2
>>
>>
>>
>> Broken version for bionic containers set up after 2018-May-02:
>>
>> network:
>> ethernets:
>> eth0: {dhcp4: true}
>> version: 2
>>
>>
>> Please note that the broken one has no indentation (two spaces) before
>> "version: 2", this is the only thing that differs and which breaks DHCPv4.
>
> Ah, sorry, I was not thorough enough when comparing my resulting
> /etc/netplan/10-lxc.yaml. It looks like this now:
>
> # cat /etc/netplan/10-lxc.yaml
> network:
> version: 2
> ethernets:
> eth0: {dhcp4: true}
>
> So the new image update apparently fixed the bug.
>
This must be some custom Netplan setup.
This file is best generated via cloud-init or subtle trouble will likely ensue.
Default cloud-init generated file is...
lxd: net10-template-ubuntu-bionic-lamp # cat 50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
version: 2
ethernets:
eth0:
dhcp4: true
Which is identical to your file, it's just that using a /etc/netplan/10-lxc.yaml
may conflict with future cloud-init updates.
Be sure if you do use a custom file, you follow the 50-cloud-init.yaml instructions
to disable cloud-init generating it's own file, which is where conflicts may arise
in the future.
More information about the lxc-users
mailing list