:: krowemoh

Friday | 13 DEC 2024
Posts Links Other About Now

previous
next

WireGuard Configuration

2024-11-17
sysadmin, wireguard, vpn

You can use wg-quick with wireguard configuration files to quickly get a point

You will need a private and public key for wireguard.

Generate a private key

wg genkey

Once you have the private key, generate the public key:

echo "pRiVaTeKeY" | wg pubkey

These two keys will then be used the wg configuration.

WireGuard configuration files go under /etc/wireguard/wg0.conf

Example:

[Interface]
Address = 10.0.0.2/24
PrivateKey = pRiVaTeKeY= 
ListenPort = 51820

[Peer]
PublicKey = pUbLiCkEy 
AllowedIPs = 10.0.0.1/32
Endpoint = ip.addr.ess:51820

You can then use wg-quick:

wg-quick up wg0

To shut it down:

wg-quick down wg0

To enable on boot:

systemctl enable wg-quick@wg0.service
systemctl start wg-quick@wg0.service