最近,我在我的服务器上安装了 DevStack(OpenStack 发行版)。我上传了 Ubuntu Server 20.04 LTS 云镜像以及 Ubuntu Server 22.04 LTS 云镜像。这些镜像来自https://cloud-images.ubuntu.com/。现在,当我运行 Ubuntu Server 20.04 VM 时,一切正常,systemd-resolved.service 正在正常运行。我可以 pingwww.google.com等等。但是当我运行 Ubuntu 22.04 LTS 时,systemd-resolved.service 无法启动,并显示以下消息:
ubuntu@test:~$ sudo systemctl status systemd-resolved.service
× systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2023-04-05 14:53:46 UTC; 47s ago
Docs: man:systemd-resolved.service(8)
man:org.freedesktop.resolve1(5)
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Process: 569 ExecStart=/lib/systemd/systemd-resolved (code=exited, status=1/FAILURE)
Main PID: 569 (code=exited, status=1/FAILURE)
Error: 99 (Cannot assign requested address)
CPU: 79ms
Apr 05 14:53:46 test systemd[1]: systemd-resolved.service: Main process exited, code=exited, status=1/FAILURE
Apr 05 14:53:46 test systemd[1]: systemd-resolved.service: Failed with result 'exit-code'.
Apr 05 14:53:46 test systemd[1]: Failed to start Network Name Resolution.
Apr 05 14:53:46 test systemd[1]: systemd-resolved.service: Scheduled restart job, restart counter is at 5.
Apr 05 14:53:46 test systemd[1]: Stopped Network Name Resolution.
Apr 05 14:53:46 test systemd[1]: systemd-resolved.service: Start request repeated too quickly.
Apr 05 14:53:46 test systemd[1]: systemd-resolved.service: Failed with result 'exit-code'.
Apr 05 14:53:46 test systemd[1]: Failed to start Network Name Resolution.
我甚至使用 multipass 在主机上创建了一个装有 Ubuntu 22.04 LTS 的虚拟机,并且 systemd-resolved.service 正确启动。然后我将 multipass Ubuntu 22.04 LTS 映像上传到 OpenStack,出现了同样的错误。
我还尝试在 OpenStack 中运行 Ubuntu 20.04 LTS VM,以检查 systemd-resolved.service 是否运行正常。结果正确,因此我决定使用 将 Ubuntu 升级到 22.04 sudo do-release-upgrade -d
。升级后,systemd-resolved.service 再次启动失败。
我不知道如何修复它,也不知道在哪里可以找到任何提示。我觉得我缺乏 DevStack 知识以及 systemd 知识来解决这个问题。任何帮助都将不胜感激!
答案1
此问题直接归因于 openstack 通过 cloud-init 发布路由
127.0.0.53 dev ens3 proto dhcp scope host metric 100
systemd-resloved 无法绑定到 127.0.0.53。Systemd-resloved 不绑定到 127.0.0.53。
根本原因是 openstack 中的 ml2 插件没有明确配置 [ovn] dns_servers,导致 openstack 控制器/etc/resolv.conf
泄漏到实例
看到这个
因此,配置 netutron ml2 插件并重新启动一切以修复它!