How To Add new Peer To your WireGuard VPN

This is a quick guide to add new peer to your WireGuard VPN.

First, generate the key pair

wg genkey | tee client-privatekey_rm_android_phone | wg pubkey > client-publickey_rm_android_phone

This will create two files (private key and public key) at the same directory where you run the command.

Still on the VPN server, run:

sudo wg set wg0 peer YOUR_PEER_PUBLIC_KEY allowed-ips YOUR_PEER_DESIRED_IP/32

Now, create a config file with this new info

[Interface]
PrivateKey = your_private_key
Address = 192.168.10.13/24 # <- your desired IP
DNS = 1.1.1.1

[Peer]
PublicKey = your_vpn_server_public_key
AllowedIPs = 192.168.10.0/24 # <- adjust accordingly to your VPN CIDR
Endpoint = xx.xx.xx.xx:53 # <- your sever VPN ip and port
PersistentKeepalive = 25

On your device (phones, laptop), import this file

And you are done!

One caution on WireGuard mobile, when importing a file and you got “Invalid Name”, just rename the file to something short without special characters (only a-z, no hyphen).

Leave a Comment