Category Archives: Wireguard

Wireguard. Installation

Hi,

these are the steps to install and configure wireguard on a raspberry pi as server.

michael@debdev ~ # sudo apt install wireguard

Generate the server private key

michael@debdev ~ # wg genkey
cNJnQwITOsONCZLpp1G6daBSvgvUBd3gzqQXLMuijmc=

And generate the clients private key

michael@debdev ~ # wg genkey

Create the servers config file

michael@debdev ~ # vi /etc/wireguard/wg0.conf
[Interface]
Address =  10.10.2.1/24
ListenPort = 58888
PrivateKey = cF6Yl9k661OSZFzgBlN7OPEotc9qAS0+GzB14wh16UU=

# Peer 1: WorkingLaptop
[Peer]
PublicKey = WtEJQKNTlX4HfIihoUW630rseGG+3KM6lC1Xv7ewrUQ=
AllowedIPs = 10.10.2.10/32

Enable config wg0

michael@debdev ~ # sudo systemctl enable wg-quick@wg0
michael@debdev ~ # sudo systemctl start wg-quick@wg0

Create a client config

[Interface]
PrivateKey = EDk0yjxBltW0kyJfCzysBqRXWB2X+8mmvN1VylOSZ1g=
Address = 10.10.2.10/24
DNS = 10.10.2.1

[Peer]
PublicKey = AsQUJtZLgHdgKBw0i6X1CiQZ/j7yF/vJl02OVZ4Ai1k=
Endpoint = myyour.vpnserver.org:58888
# Route all traffic through VPN
# AllowedIPs = 0.0.0.0/0
# Route only specific subnets through VPN. Pushing routes from server not possible
AllowedIPs = 10.11.1.0/24, 172.16.31.0/24
michael@debdev ~ # 

Windows Hints

"C:\Program Files\WireGuard\wireguard.exe" /installtunnelservice  %~dp0home.conf

sc stop WireGuardTunnel$home
sc start WireGuardTunnel$home

sc config  WireGuardTunnel$home start=disabled

"C:\Program Files\WireGuard\wg.exe" show

Linux