Wireguard
1. Install WireGuard on the VPS
Update the system:
Copy
Install WireGuard:
On Debian/Ubuntu:
Copy
On CentOS/RHEL:
Copy
On Fedora:
Copy
2. Generate Keys for the Server
Create the WireGuard directory:
Copy
Generate private and public keys:
Copy
Note the keys:
Copy
3. Configure the WireGuard Server
Create a WireGuard configuration file:
Copy
Add the following content:
Copy
Replace
<server_private_key>
with the content ofserver_private.key
. Replace<client_public_key>
with the public key generated for the client in the next step.Enable IP forwarding:
Copy
4. Generate Keys for the Client
On the VPS, generate client keys:
Copy
Retrieve the keys:
Copy
5. Add Client Configuration to the Server
Edit the server configuration file /etc/wireguard/wg0.conf
and add a new peer block:
Copy
6. Start and Enable the WireGuard Service
Start WireGuard:
Copy
Enable WireGuard to start on boot:
Copy
Check the WireGuard status:
Copy
7. Configure the Client Device
On Linux
Install WireGuard:
Copy
Create the client configuration file:
Copy
Add the following content:
Copy
Replace
<client_private_key>
with the client private key,<server_public_key>
with the server public key, and<server_ip>
with the IP of your VPS.Start WireGuard:
Copy
On Windows
Download and install WireGuard for Windows.
Import the
client.conf
file and connect.
On Android/iOS
Install the WireGuard app from the app store.
Import the
client.conf
file using QR code or file transfer.Connect to the server.
8. Verify Connection
On the client device, check your public IP:
Copy
The IP should now reflect your VPS's IP, confirming the VPN is active.
Last updated