Well-known configuration paths:
- Linux:
/etc/wireguard
- mac with homebrew:
/opt/homebrew/etc/wireguard
Generate keypair
wg genkey | tee privatekey-filename | wg pubkey > publickey-filename
Fill below configuration and save as .conf
file to configuration path. Usually, named as wg[n].conf
(like wg0.conf
)
[Interface]
Address = [vpn-ip @ this]
PrivateKey = [privatekey-[target] @ this]
[Peer]
PublicKey = [publickey-[target] @ server]
AllowedIps = [vpn network ip]/24
Endpoint = [public endpoint @ server]
PersistentKeepalive = 5
For example:
[Interface]
Address = 10.0.1.11
PrivateKey = iFdkwo349102J4Jd4J5d23Jdij23JKfdsd23DMad3d3=
[Peer]
PublicKey = Jij2F3JKfdsd5d23Jddk49102J4wo3d3id4d3J23DMa=
AllowedIps = 10.0.1.0/24
Endpoint = 223.130.200.219
PersistentKeepalive = 5
Note
PrivateKey, PublicKey has made by random-type, Endpoint is ip of naver.com
wg-quick up [config-name]
If there is wg0.conf
:
wg-quick up wg0.conf
sudo systemctl enable wg-quick@[config-name]
sudo systemctl start wg-quick@[config-name]
Modify and apply plist configuration to /Library/LaunchDaemons
.
sudo chmod 644 /Library/LaunchDaemons com.wireguard.wg[n].plist
sudo launchctl enable system/com.wireguard.wg[n].plist
sudo launchctl bootstrap system /Library/LaunchDaemons/com.wireguard.wg0.plist
sudo launchctl print system/com.wireguard.wg0