A imagem da nuvem do Ubuntu 18.04 não recebe o endereço IPv4 do DHCP

3

Estou testando a imagem da nuvem Ubuntu 18.04 LTS (20180426.2) em um host KVM. Existe um servidor DHCP v4 em execução, mas o IPv6 não é suportado. Ao inicializar a imagem da nuvem, ela não receberá um endereço IPv4. O serviço systemd-networkd-wait-online falhou ao iniciar:

root@ubuntu:~# systemctl status systemd-networkd-wait-online.service
● systemd-networkd-wait-online.service - Wait for Network to be Configured
   Loaded: loaded (/lib/systemd/system/systemd-networkd-wait-online.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2018-04-30 11:08:47 UTC; 12min ago
     Docs: man:systemd-networkd-wait-online.service(8)
  Process: 669 ExecStart=/lib/systemd/systemd-networkd-wait-online (code=exited, status=1/FAILURE)
 Main PID: 669 (code=exited, status=1/FAILURE)

Apr 30 11:06:47 ubuntu systemd[1]: Starting Wait for Network to be Configured...
Apr 30 11:08:47 ubuntu systemd-networkd-wait-online[669]: Event loop failed: Connection timed out
Apr 30 11:08:47 ubuntu systemd[1]: systemd-networkd-wait-online.service: Main process exited, code=exited, status=1/FAILURE
Apr 30 11:08:47 ubuntu systemd[1]: systemd-networkd-wait-online.service: Failed with result 'exit-code'.
Apr 30 11:08:47 ubuntu systemd[1]: Failed to start Wait for Network to be Configured.

systemd-network não ativou o IPv4:

root@ubuntu:~# journalctl -u systemd-networkd
[...]
-- Reboot --
Apr 30 11:06:47 ubuntu systemd[1]: Starting Network Service...
Apr 30 11:06:47 ubuntu systemd-networkd[651]: Enumeration completed
Apr 30 11:06:47 ubuntu systemd[1]: Started Network Service.
Apr 30 11:06:47 ubuntu systemd-networkd[651]: lo: Link is not managed by us
Apr 30 11:06:47 ubuntu systemd-networkd[651]: ens6: IPv6 successfully enabled
Apr 30 11:06:47 ubuntu systemd-networkd[651]: ens6: Gained carrier
Apr 30 11:06:49 ubuntu systemd-networkd[651]: ens6: Gained IPv6LL

root@ubuntu:~# networkctl status ens6
● 2: ens6
       Link File: /run/systemd/network/10-netplan-ens6.link
    Network File: /run/systemd/network/10-netplan-ens6.network
            Type: ether
           State: degraded (configuring)
          Driver: virtio_net
          Vendor: Red Hat, Inc.
           Model: Virtio network device
      HW Address: 02:01:a5:2e:fe:bf
         Address: fe80::1:a5ff:fe2e:febf

Mas o DHCP v4 está configurado:

root@ubuntu:~# cat /etc/netplan/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:
        ens6:
            dhcp4: true
            match:
                macaddress: 02:01:a5:2e:fe:bf
            set-name: ens6
root@ubuntu:~# cat /run/systemd/network/10-netplan-ens6.link
[Match]
MACAddress=02:01:a5:2e:fe:bf

[Link]
Name=ens6
WakeOnLan=off
root@ubuntu:~# cat /run/systemd/network/10-netplan-ens6.network 
[Match]
MACAddress=02:01:a5:2e:fe:bf
Name=ens6

[Network]
DHCP=ipv4

[DHCP]
UseMTU=true
RouteMetric=100

Quando eu abro dhclient manualmente, o dispositivo de rede obtém um endereço IPv4 e é alcançável (como esperado):

root@ubuntu:~# dhclient
root@ubuntu:~# networkctl status ens6
● 2: ens6
       Link File: /run/systemd/network/10-netplan-ens6.link
    Network File: /run/systemd/network/10-netplan-ens6.network
            Type: ether
           State: routable (configuring)
            Path: pci-0000:00:06.0
          Driver: virtio_net
          Vendor: Red Hat, Inc.
           Model: Virtio network device
      HW Address: 02:01:a5:2e:fe:bf
         Address: 87.106.172.51
                  fe80::1:a5ff:fe2e:febf
         Gateway: 87.106.172.1

Alguém sabe por que o systemd-networkd não exibe o IPv4 corretamente? Isso é um bug que eu devo reportar (contra systemd-networkd)?

    
por Benjamin Drung 30.04.2018 / 13:43

1 resposta

2

Eu experimentei o mesmo problema na minha instalação do RasPi 2 do Ubuntu Server 18.04 LTS (armhf).

O

dhclient corrige o problema temporariamente, mas a reinicialização do sistema desabilita o IPv4 novamente.

Eu adicionarei isso ... Consegui habilitar uma solução alternativa adicionando o seguinte cronjob para iniciar o dhclient na inicialização:

@reboot /bin/sh dhclient
    
por TheIrishFrog 10.05.2018 / 19:40