WireGuard is a modern, secure, and lightning-fast VPN protocol that provides a simple yet highly efficient way to encrypt your internet traffic. In this guide, we’ll show you how to install and configure WireGuard as a client on Ubuntu. If you don’t have a WireGuard VPN account yet, you can sign up here using my referral link:
👉 Get a WireGuard VPN Account
Step 1: Install WireGuard on Ubuntu
To install WireGuard, open a terminal and run:
sudo apt update && sudo apt install -y wireguard
Once installed, verify that WireGuard is available by checking its version:
wg --version
If installed correctly, you’ll see output similar to:
wireguard-tools v1.x.x
Step 2: Obtain Your WireGuard VPN Configuration
Before connecting to a WireGuard VPN, you need a configuration file from your VPN provider.
👉 If you don’t have a WireGuard VPN yet, sign up here:
Surfshark WireGuard VPN
Once you sign up, download your WireGuard configuration file (wg0.conf
or similar) from your VPN provider’s dashboard.
Step 3: Set Up the WireGuard Configuration File
- Move the configuration file to the correct directory:
sudo mv ~/Downloads/wg0.conf /etc/wireguard/
- Secure the configuration file:
sudo chmod 600 /etc/wireguard/wg0.conf
- View the configuration (optional):
cat /etc/wireguard/wg0.conf
A typical WireGuard configuration file looks like this:[Interface] PrivateKey = YOUR_PRIVATE_KEY Address = 10.66.66.2/24 DNS = 1.1.1.1 [Peer] PublicKey = YOUR_VPN_PROVIDER_PUBLIC_KEY Endpoint = vpn.example.com:51820 AllowedIPs = 0.0.0.0/0, ::/0 PersistentKeepalive = 25
Step 4: Connect to the WireGuard VPN
To activate the VPN connection, run:
sudo wg-quick up wg0
You can check the connection status with:
sudo wg
To disconnect from the VPN, use:
sudo wg-quick down wg0
Step 5: Enable WireGuard on Boot (Optional)
If you want WireGuard to start automatically when your system boots, enable the service with:
sudo systemctl enable wg-quick@wg0
To disable auto-start, use:
sudo systemctl disable wg-quick@wg0
Step 6: Verify Your VPN Connection
To confirm that your traffic is being routed through the VPN, check your public IP address before and after connecting:
curl ifconfig.me
If the IP address changes to your VPN provider’s IP, your connection is working! 🎉
Get a WireGuard VPN (Recommended Provider)
If you don’t have a WireGuard VPN account yet, I recommend Surfshark, which supports WireGuard and provides fast, encrypted connections. Sign up using my referral link below:
Conclusion
By following these steps, you’ve successfully installed and configured WireGuard on Ubuntu as a client. You can now enjoy a secure and private internet experience with minimal configuration.
If you have any questions, drop them in the comments. Happy browsing! 🚀