我刚将一台机器迁移到Ubuntu22.04。网络配置仍然是通过/etc/网络/接口进行的:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
# iface eth0 inet dhcp
iface eth0 inet static
address 192.168.1.105
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.100 192.168.1.104
dns-search example.com
dns-domain example.com问题是,在从20.04升级到22.04之后,DNS解析不再有效。未解析DNS名称。
/etc/resv.conf:
# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 127.0.0.53
search DOMAINS决议的输出:
# resolvectl
Global
Protocols: -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: foreign
DNS Domain: DOMAINS
Link 2 (eth0)
Current Scopes: none
Protocols: -DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
DNS Domain: DOMAINS我试图通过在/etc/netplan中创建一个新的netplan配置来修复这个问题,并删除/etc/ netplan /接口,但这使我完全没有工作的网络配置(即使安装了netplan)。
那么,我如何启用网络计划和/etc/网络/接口呢?(我希望这能解决当前网络配置中出现的任何问题--但我想,迁移到当前首选的包应该不是什么大问题。)
FYI,为netplan创建的yaml,但这无助于名称解析:
network:
ethernets:
ens18:
dhcp4: no
addresses: [192.168.1.117/24]
routes:
- to: default
via: 192.168.1.1
nameservers:
search: [example.com]
addresses: [192.168.1.100,192.168.1.104]
version: 2编辑:如果我将netplan配置更改为dhcp,则网络正在工作。我仍然想知道如何才能使这个更新的系统进入netplan与静态地址一起工作的状态。我对Ubuntu22.04的新安装中的netplan静态地址没有问题。
发布于 2022-09-07 08:40:53
你错过了大门。你一定有这样的东西:
network:
ethernets:
ens18:
dhcp4: no
addresses: [192.168.1.117/24]
gateway4: 192.168.1.1
nameservers:
search: [example.com]
addresses: [192.168.1.100,192.168.1.104]
version: 2https://askubuntu.com/questions/1427643
复制相似问题