VPN 断开后,/etc/resolv.conf 无法正确重新生成

VPN 断开后,/etc/resolv.conf 无法正确重新生成

我正在运行 Ubuntu 20.04.3 LTS。

启动后,连接到我的 VPN 之前,我的/etc/resolv.conf外观如下:

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad

当我连接到我的 VPN 时它会发生改变并且看起来像这样:

# Perimeter81 Custom DNS
nameserver 10.127.248.1

但是当我断开与 VPN 的连接时,它无法正确重新生成,最终只留下一条评论:

# Generated by resolvconf

...当然,查找功能不起作用。我必须断开/重新连接我的 wifi,然后它就会恢复到原来的状态。

因此,似乎 VPN 断开时触发的重新生成 resolv.conf 的操作与最初设置的操作不同。我该如何修复它?

相关内容