1 wireguard
Markus Bergholz edited this page 4 months ago

Side by Side

No traffic is routed. Just to access each other securely.

Both need a private- and a public-key. Where the public key needs to be shared to each other.

umask 077
wg genkey | tee privatekey | wg pubkey > publickey

Server

/etc/wireguard/wg0.conf

[Interface]
Address = 192.168.2.1
PrivateKey = {{ SERVER_PRIVATE_KEY }}
ListenPort = 51820

[Peer]
PublicKey = {{ CLIENT_PUBLIC_KEY }}
AllowedIPs = 192.168.2.2/32

wg-quick up wg0

Client

/etc/wireguard/wg0.conf

[Interface]
Address = 192.168.2.2
PrivateKey = {{ CLIENT_PRIVATE_KEY }}
ListenPort = 21841

[Peer]
PublicKey = {{ SERVER_PUBLIC_KEY }}
Endpoint = {{ SERVER_HOSTNAME_OR_IP }}:51820
AllowedIPs = 192.168.2.0/24

# This is for if you're behind a NAT and
# want the connection to be kept alive.
PersistentKeepalive = 25

wg-quick up wg0