You are not logged in.

#1 2021-11-05 11:33:30

Manix
Member
Registered: 2021-04-17
Posts: 74

[SOLVED]wireguard no longer works after reinstallation vps

hi, when I enable interfaces my ssh session is stuck

here are some info:

SERVER :

nico-vps@bootstrap [SSH] ~ % sudo wg-quick up wg0 
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.200.200.1/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE

nico-vps@bootstrap [130] [SSH] ~ % ip a show wg0       
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 10.200.200.1/24 scope global wg0
       valid_lft forever preferred_lft forever

nico-vps@bootstrap  [SSH] ~ % ip r show wg0
10.200.200.0/24 dev wg0 proto kernel scope link src 10.200.200.1

nico-vps@bootstrap [SSH] ~ % sudo cat /etc/wireguard/wg0.conf
[sudo] Mot de passe de nico-vps :
[Interface]
Address = 10.200.200.1/24
ListenPort = 51820
PrivateKey = KEY

# substitute ens3 in the following lines to match the Internet-facing interface
# if the server is behind a router and receives traffic via NAT, these iptables rules are not needed
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE

[Peer]
PublicKey = PUB
AllowedIPs = 10.200.200.2/32

I enable IPv4 forwarding https://wiki.archlinux.org/title/WireGuard#Server

CLIENT

nico@archnico ~ [master*] % sudo wg-quick up wg0 
[#] ip link add wg0 type wireguard
[#] wg setconf wg0 /dev/fd/63
[#] ip -4 address add 10.200.200.2/24 dev wg0
[#] ip link set mtu 1420 up dev wg0
[#] wg set wg0 fwmark 51820
[#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820
[#] ip -4 rule add not fwmark 51820 table 51820
[#] ip -4 rule add table main suppress_prefixlength 0
[#] sysctl -q net.ipv4.conf.all.src_valid_mark=1
[#] iptables-restore -n

nico@archnico ~ [master*] % ip a show wg0
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
    link/none
    inet 10.200.200.2/24 scope global wg0
       valid_lft forever preferred_lft forever

nico@archnico ~ [master*] % ip r show wg0
10.200.200.0/24 dev wg0 proto kernel scope link src 10.200.200.2

nico@archnico ~ [master*] % sudo cat /etc/wireguard/wg0.conf
[sudo] Mot de passe de nico :
[Interface]
Address = 10.200.200.2/24
PrivateKey = KEY

[Peer]
PublicKey = PUB
AllowedIPs = 0.0.0.0/0
Endpoint = ip_vps:51820
PersistentKeepalive = 15

I almost tried everything without result :c the worst is that it worked perfectly before reinstalling the vps...

Last edited by Manix (2021-11-05 16:01:32)


I don't love rosbeef

Offline

#2 2021-11-05 16:01:04

Manix
Member
Registered: 2021-04-17
Posts: 74

Re: [SOLVED]wireguard no longer works after reinstallation vps

finally it works again, after a complete reinstallation of wireguard on the server and client side


I don't love rosbeef

Offline

Board footer

Powered by FluxBB