NetworkManager 重新启动时重新启动 VPN 服务

NetworkManager 重新启动时重新启动 VPN 服务

我需要wg-quick@mullvad-sg2在重新启动后手动重新启动我的 VPN 服务 ( ) NetworkManager,以便 DNS 查找正常工作。

如何重新NetworkManager启动我的 VPN 服务?

答案1

确定需要重新启动的服务NetworkManager- 在本例中为wg-quick@.

通过键入以下内容编辑override.conffor :wg-quick@

sudo systemctl edit wg-quick@

添加以下内容:

[Unit]
# Restart / Stop with NetworkManager
PartOf=NetworkManager.service

# Wait until network is really up before trying to have Wireguard connect
# https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/
Requires=NetworkManager-wait-online.service
After=NetworkManager-wait-online.service

相关内容