Add the following:
If you’re using WireGuard on Ubuntu and notice that your wg0 interface
does not start automatically after reboot, you’re not alone. This is a common issue—and fortunately, an easy one to fix.
🚨 Problem
After rebooting your Ubuntu system, the WireGuard interface wg0 is down,
even though it worked perfectly before restarting.
🤔 Why This Happens
When you manually start WireGuard using:
sudo wg-quick up wg0
it only activates the VPN for the current session. It does not persist across reboots
because the service has not been enabled in systemd.
✅ Solution: Enable WireGuard Auto-Start
To ensure WireGuard starts automatically when your system boots, run:
sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0
This registers WireGuard as a system service and ensures wg0 starts at boot.
🔍 Verify It’s Working
sudo systemctl status wg-quick@wg0
ip a show wg0
If everything is configured correctly, you should see the interface active.
⚠️ Common Issues & Fixes
1. Incorrect Config File Location
Ensure your configuration file exists at:
/etc/wireguard/wg0.conf
2. File Permissions
sudo chmod 600 /etc/wireguard/wg0.conf
3. Network Not Ready at Boot
Sometimes WireGuard starts before the network is fully initialized.
Fix this by delaying startup:
sudo systemctl edit wg-quick@wg0
[Unit]
After=network-online.target
Wants=network-online.target
sudo systemctl daemon-reexec
4. DNS Issues
If you’re using the DNS= option in your config, ensure your system supports it
(e.g., systemd-resolved or resolvconf).
📊 Diagram: How WireGuard Startup Works
┌───────────────┐
│ System Boot │
└──────┬────────┘
│
▼
┌──────────────────────┐
│ systemd initializes │
└──────┬───────────────┘
│
▼
┌──────────────────────────────┐
│ wg-quick@wg0.service enabled?│
└──────┬───────────────┬───────┘
│ YES │ NO
▼ ▼
┌───────────────┐ ┌──────────────┐
│ Start wg0 VPN │ │ wg0 stays OFF│
└───────────────┘ └──────────────┘
📌 Summary
systemctl enable wg-quick@wg0
💡 Final Thoughts
Enabling WireGuard at boot ensures your VPN connection is always active without manual intervention.
This is especially important for servers, remote access setups, and privacy-focused configurations.
Leave a Reply