Os contêineres LXD não recebem IP

2

Eu queria começar a experimentar containers, então eu segui este tutorial e fez:

sudo apt-get install lxd lxd-client zfsutils-linux
sudo lxd init

e respondeu as perguntas da seguinte forma

Do you want to configure a new storage pool (yes/no) [default=yes]? yes
Name of the storage backend to use (dir or zfs) [default=zfs]: zfs
Create a new ZFS pool (yes/no) [default=yes]? yes
Name of the new ZFS pool [default=lxd]: lxd
Would you like to use an existing block device (yes/no) [default=no]? no
Size in GB of the new loop device (1GB minimum) [default=20]: 20
Would you like LXD to be available over the network (yes/no) [default=no]? no
Do you want to configure the LXD bridge (yes/no) [default=yes]? yes
---- following questions in a whiptail window (always accepting defaults)
Would you like to setup a network bridge for LXD containers now? yes
Bridge interface name? lxdbr0
Do you want to setup an IPv4 subnet? yes
IPv4 network address? 10.12.8.1
IPv4 CIDR mask? 24
First DHCP address? 10.12.8.2
Last DHCP address? 10.12.8.254
Max number of DHCP clients? 252
Do you want to NAT the IPv4 traffic? yes
Do you want to setup an IPv6 subnet? no

após o qual o comando termina com sucesso com

Warning: Stopping lxd.service, but it can still be activated by:
  lxd.socket
LXD has been successfully configured.

Agora, para testar o primeiro contêiner:

lxc launch ubuntu:x test
lxc list

cuja saída é

+------+---------+------+------+------------+-----------+
| NAME |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+------+---------+------+------+------------+-----------+
| test | RUNNING |      |      | PERSISTENT | 0         |
+------+---------+------+------+------------+-----------+

e, obviamente, o contêiner não tem acesso à rede. Então, comecei a procurar uma solução: há muitos relatórios de problemas semelhantes, como isso , isso ou este , mas nenhum deles parece ajudar no meu caso.

Informações do sistema, caso isso possa ser útil:

matpen@ubuntu:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS"
matpen@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-121-generic #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
matpen@ubuntu:~$ lxc --version
2.0.11
matpen@ubuntu:~$ lxc profile show default
config:
  environment.http_proxy: ""
  user.network_mode: dhcp
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: macvlan
    parent: lxdbr0
    type: nic
name: default
used_by: []
matpen@ubuntu:~$ ifconfig
enp2s0    Link encap:Ethernet  HWaddr 00:25:22:8f:49:82  
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fd1d:9e7b:b584::da3/128 Scope:Global
          inet6 addr: fd1d:9e7b:b584:0:5d78:aa1e:1955:9bc0/64 Scope:Global
          inet6 addr: fe80::f449:e467:b182:4668/64 Scope:Link
          inet6 addr: fd1d:9e7b:b584:0:60ab:f8f4:f1dc:eb1e/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:248459 errors:0 dropped:0 overruns:0 frame:0
          TX packets:167050 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:315015380 (315.0 MB)  TX bytes:34408870 (34.4 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6405 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6405 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:595013 (595.0 KB)  TX bytes:595013 (595.0 KB)

lxdbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:10.12.8.1  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::fc06:77ff:fe8f:f471/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:111 errors:0 dropped:0 overruns:0 frame:0
          TX packets:120 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:25968 (25.9 KB)  TX bytes:14451 (14.4 KB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
por matpen 27.04.2018 / 23:39

1 resposta

0

Após vários experimentos e confronto com os especialistas , ainda não temos certeza do que causa esse mau comportamento.

No entanto, a solução era simplesmente atualizar para o LXD 3.0 usando o pacote snap, seguindo as estas instruções .

    
por matpen 08.05.2018 / 12:02