VPS / virtual private servers > Virtual servers - general
Quick guide Debian Setting up wireguard on a server (wireguard-go)
(1/1)
vs2-free-users:
Quick guide Debian Setting up wireguard on a server (wireguard-go)
Preface
Since you cannot currently use the standard wireguard on the vs2-free (not active in the kernel), I have taken a look at how you can still use wireguard. In my instructions I have used 2 vs2-free hosts. Of course you can also use the normal wireguard at home.
Structure
Host A vs2-free with booked and configured IPv4. OS Debian 12 (Bookworm) - 64Bit - minimal v4.
Host B vs2-cloud with booked and configured IPv4. OS Debian 12 (Bookworm) - 64Bit - minimal v4.
wireguard-go (Version 0.0.20220316, the current one did not work because Debian does not yet have golang 1.20)
https://github.com/WireGuard/wireguard-go
Preparation
Update Debian packages and reboot if necessary.
--- Code: ---apt update
apt upgrade
reboot
--- End code ---
Set up host A (ends up with IP 10.0.0.1 via wireguard)
- install golang and wireguard-tools
--- Code: ---apt install golang wireguard-tools
--- End code ---
- Download wireguard-go and make it executable
--- Code: ---wget -O /usr/bin/wireguard-go https://12-u.vs2-free-users.de/mirror/wireguard-go/debian12/wireguard-go
chmod +x /usr/bin/wireguard-go
--- End code ---
- Create wireguard keys (private and public)
--- Code: ---mkdir -p /etc/wireguard/
cd /etc/wireguard/
wg genkey | tee privatekey | wg pubkey > publickey
--- End code ---
- create wireguard config (wg0)
--- Code: ---vim /etc/wireguard/wg0.conf
--- End code ---
Content
--- Code: ---[Interface]
PrivateKey = <Previously created private key>
ListenPort = 51820
[Peer]
PublicKey = <Public key from host B>
AllowedIPs = 10.0.0.2/32
Endpoint = <Official IP Host B>:51820
--- End code ---
- Create start script
--- Code: ---vim /etc/wireguard/wg0-up.bash
--- End code ---
Content
--- Code: ---#!/bin/bash
sleep 60
wireguard-go wg0
wg setconf wg0 /etc/wireguard/wg0.conf
ip address add 10.0.0.1/24 dev wg0
ip link set wg0 up
--- End code ---
- Make script executable
--- Code: ---chmod +x /etc/wireguard/wg0-up.bash
--- End code ---
- Create autostart via cron
--- Code: ---echo '@reboot root /etc/wireguard/wg0-up.bash' >> /etc/crontab
--- End code ---
- Reboot (after which everything is configured)
--- Code: ---reboot
--- End code ---
Set up host B (ends up with IP 10.0.0.2 via wireguard)
- install golang and wireguard-tools
--- Code: ---apt install golang wireguard-tools
--- End code ---
- Download wireguard-go and make it executable
--- Code: ---wget -O /usr/bin/wireguard-go https://12-u.vs2-free-users.de/mirror/wireguard-go/debian12/wireguard-go
chmod +x /usr/bin/wireguard-go
--- End code ---
- Create wireguard keys (private and public)
--- Code: ---mkdir -p /etc/wireguard/
cd /etc/wireguard/
wg genkey | tee privatekey | wg pubkey > publickey
--- End code ---
- create wireguard config (wg0)
--- Code: ---vim /etc/wireguard/wg0.conf
--- End code ---
Content
--- Code: ---[Interface]
PrivateKey = <Previously created private key>
ListenPort = 51820
[Peer]
PublicKey = <Public key from host A>
AllowedIPs = 10.0.0.1/32
Endpoint = <Official IP Host A>:51820
--- End code ---
- Create start script
--- Code: ---vim /etc/wireguard/wg0-up.bash
--- End code ---
Content
--- Code: ---#!/bin/bash
sleep 60
wireguard-go wg0
wg setconf wg0 /etc/wireguard/wg0.conf
ip address add 10.0.0.2/24 dev wg0
ip link set wg0 up
--- End code ---
- Make script executable
--- Code: ---chmod +x /etc/wireguard/wg0-up.bash
--- End code ---
- Create autostart via cron
--- Code: ---echo '@reboot root /etc/wireguard/wg0-up.bash' >> /etc/crontab
--- End code ---
- Reboot (after which everything is configured)
--- Code: ---reboot
--- End code ---
Navigation
[0] Message Index
Go to full version