Before proceeding with this guide, make sure you have completed the WireGuard Server Configuration setup. This guide assumes you have a functioning WireGuard server.
Connecting WireGuard Clients (Android, macOS, Windows)
1. Install WireGuard on Your Device
Android
- Download WireGuard from the Google Play Store.
- Open the app and tap on
+
to create a new tunnel.
macOS
- Download WireGuard from the App Store.
- Open the app and click on
+
to add a new tunnel.
Windows
- Download WireGuard from the official website.
- Install the application and open it.
- Click on
Add Tunnel
>Add Empty Tunnel
.
2. Generate Client Configuration on the Server
To add a new peer (client) to the WireGuard server:
- Connect to your server via SSH.
- Generate a new key pair for the client:
wg genkey | tee client_private.key | wg pubkey > client_public.key
- Create a new configuration file for the client (e.g.,
client.conf
):[Interface] PrivateKey = <Client Private Key> Address = 10.8.0.2/24 DNS = 8.8.8.8 [Peer] PublicKey = <Server Public Key> Endpoint = <Your Server IP>:51820 AllowedIPs = 0.0.0.0/0, ::/0 PersistentKeepalive = 25
- Add the peer to the server’s WireGuard configuration (
/etc/wireguard/wg0.conf
):[Peer] PublicKey = <Client Public Key> AllowedIPs = 10.8.0.2/32
- Apply the changes by restarting WireGuard:
wg syncconf wg0 <(wg-quick strip wg0)
3. Import Configuration on the Client
Once the configuration file (client.conf
) is created, import it into the WireGuard app:
Android/macOS:
- Open WireGuard and tap
+
>Import from file or archive
. - Select the
client.conf
file.
Windows:
- Click
Add Tunnel
>Import Tunnel from File
. - Select the
client.conf
file.
4. Activate the VPN
- Tap
Activate
orEnable
in the WireGuard app. - You should now be connected to your WireGuard VPN.
Adding New Peers to the Server
If you need to add multiple clients, repeat these steps:
- Generate new key pairs.
- Assign a unique IP (
10.8.0.X/32
for each client). - Append the new peer configuration to the server’s
wg0.conf
file. - Restart WireGuard.
That’s it! Your clients are now securely connected to your WireGuard VPN. 🎉 If you encounter issues, check logs using:
wg show
journalctl -u wg-quick@wg0 --no-pager | tail -n 50
0 Comments