Setup
DNS-Refresh für Ubuntu 24 Client
To refresh or update the DNS server settings used by a WireGuard client on Ubuntu 24.04, you need to ensure both your WireGuard configuration and your system's DNS resolver are correctly set up. Ubuntu 24.04 uses systemd-resolved by default, which changes how DNS settings are applied compared to older releases.
Use systemd-resolved with PostUp (Recommended for Ubuntu 24.04)
The DNS = … line in the config is only processed if the system is set up to use resolvconf or openresolv. On Ubuntu 24.04, systemd-resolved is the default resolver and does not process the DNS = … line automatically
Instead, use a PostUp command in your config to set the DNS server via resolvectl:
[Interface] PrivateKey = ... Address = ... # DNS = 10.10.0.2 PostUp = resolvectl dns %i 10.10.0.2 PostUp = resolvectl domain %i ~. PostDown = resolvectl revert %i
This tells systemd-resolved to use the specified DNS server for the WireGuard interface when it comes up, and to revert the setting when the interface goes down
Restart wireguard to apply settings
- Verify DNS Settings
Check the DNS settings applied to your WireGuard interface:
resolvectl status wg0
Look for the DNS Servers line to confirm your changes took effect
OrangePi
apt install -y linux-headers-current-sunxi qrencode dirmngr apt install -y wireguard-tools