- Install the necessary packages
pkg_add wireguard-tools vim
- Enable IP Forwarding
sysctl net.inet.ip.forwarding=1
echo 'net.inet.ip.forwarding=1' >> /etc/sysctl.conf
- Make a directory to store your wg keys
mkdir ~/wg && cd wg
wg genkey | tee .private | wg pubkey > .public
- Create the wireguard interface
vim /etc/hostname.<INTERFACE_NAME>
- In the interface file setup the basics
# Server setup
inet <IP_ADDRESS> <SUBNET_MASK>
wgkey <SERVER_PRIVATE_KEY>
wgport <WG_PORT>
# Peer setup
wgpeer <CLIENT_PUBLIC_KEY> wgaip <ALLOWED_IP>/32