About "Set Up WireGuard VPN"

I did everything by this documentation: https://www.linode.com/docs/networking/vpn/set-up-wireguard-vpn-on-debian - but couldn't ping:

$ ping -c 4 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

--- 10.0.0.1 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3038ms

After it I downloaded WireGuard's script from here: https://www.wireguard.com/quickstart/ - and edited it for my purposes:

#!/bin/bash

set -e
[[ $UID == 0 ]] || { echo "You must be root to run this."; exit 1; }

# exec 3<>/dev/tcp/demo.wireguard.com/42912
# privatekey="$(wg genkey)"
# wg pubkey <<<"$privatekey" >&3
# IFS=: read -r status server_pubkey server_port internal_ip <&3
# [[ $status == OK ]]

internal_ip="10.0.0.2"
privatekey=`cat /etc/wireguard/privatekey`
server_pubkey=${my_server_pub_key}

ip link del dev wg0 2>/dev/null || true
ip link add dev wg0 type wireguard
wg set wg0 private-key <(echo "$privatekey") peer "$server_pubkey" allowed-ips 10.0.0.0/24 endpoint "${my_server_public_ip}:51820" persistent-keepalive 25
ip address add "$internal_ip"/24 dev wg0
ip link set up dev wg0
if [ "$1" == "default-route" ]; then
host="$(wg show wg0 endpoints | sed -n 's/.*\t\(.*\):.*/\1/p')"
ip route add $(ip route get $host | sed '/ via [0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/{s/^\(.* via [0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/}' | head -n 1) 2>/dev/null || true
ip route add 0/1 dev wg0
ip route add 128/1 dev wg0
fi
  • and after it I can ping, but after I reboot my client and rerun this script, I couldn't ping again. I can't understand the reason, why everything may go like this. Can anybody help me? :-) :-)

P. S. I use Slackware GNU/Linux.

1 Reply

Hi there,

I'm limited in the Support that I can provide in Wireguard, but I do have some ideas of areas you might want to check.

I found a couple of resources that might be helpful while I was researching potential causes for you online. It's a Stack Exchange page where a user appears to be encountering a similar issue:

Cannot setup WireGuard VPN

Also:

Wireguard not routing traffic from client to other servers on the network

I hope that's helpful. I've also added some tags to this post to it will have some extra visibility to other members of the Linode Community who may be experienced in Wireguard.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct