WireGuard VPN on Slackware @ Linode.com
by maprocy4 from LinuxQuestions.org on (#538FT)
I did everything by this documentation: https://www.linode.com/docs/networki...-vpn-on-debian - but couldn't ping:
Code:$ 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 3038msAfter it I downloaded WireGuard's script from here: https://www.wireguard.com/quickstart/ - and edited it for my purposes:
Code:#!/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.


Code:$ 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 3038msAfter it I downloaded WireGuard's script from here: https://www.wireguard.com/quickstart/ - and edited it for my purposes:
Code:#!/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.