Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
CloudLinux
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

[help] Wireguard can't reach one peer behind NAT

anon121anon121 Member
edited August 2024 in Help

I am trying to set up wireguard between my desktop PC behind NAT and a VPS. On the server I run apt install wireguard. On the desktop PC I run the official Windows client.

The configuration is easy, and my PC (10.8.0.3) connects just fine to the server (10.8.0.2) and sends the keepalive thing. I can then log into my server with ssh [email protected], including from WSL.

  • However, I cannot reach 10.8.0.3 from my VPS.
  • I can ping 10.8.0.3 from Windows CMD.
  • I cannot ping 10.8.0.3 from WSL, even though it is supposed to be my local IP, and even though I can reach the VPS (10.8.0.2) from WSL just fine.
  • I tested the setup on two VPS's and they can reach each other just fine.
    edit:

  • It works when connecting from WSL, but then I don't have the network access in Windows 10 (play games over LAN and so on)

What could be the reason for that? My PC is behind NAT, and unfortunately port forwarding does not work. So "wg" on the VPS shows my home IP and a random port. But all sources on the Internet claim it should work fine with one device behind NAT and with keepalive enabled.

The PC config:
[Interface]
PrivateKey = PCprivatekey
Address = 10.8.0.3/32
ListenPort = 52345
[Peer]
PublicKey = VPSpublickey
PresharedKey = psk
AllowedIPs = 10.8.0.0/24
Endpoint = VPSIP:52345
PersistentKeepalive = 5

The VPS config:
[Interface]
PrivateKey = VPSprivatekey
Address = 10.8.0.2/32
ListenPort = 52345
[Peer]
PublicKey = PCpublickey
PresharedKey = psk
AllowedIPs = 10.8.0.0/24
Endpoint = myhomeIP:52345
PersistentKeepalive = 5

Comments

  • inside server wg0, there should be only 3 line if you're behind nat

    [Interface]
    PrivateKey = VPSprivatekey
    Address = 10.8.0.2/32
    ListenPort = 52345
    [Peer]
    PublicKey = PCpublickey
    PresharedKey = psk
    AllowedIPs = 10.8.0.0/24
    Endpoint = myhomeIP:52345 <remove this>
    PersistentKeepalive = 5 <remove this>
    

    nyr/wireguard-install handle this automatically, recomended to use if you want it easy

    Thanked by 1anon121
  • anon121anon121 Member
    edited August 2024

    @ScreenReader said: nside server wg0, there should be only 3 line if you're behind nat

    Thanks. I tried that, too, just now, but it does not change anything. I also edited my post to include that it does work in WSL.

    Unfortunately, I cannot edit the post anymore.

    The title should now read: "Windows 10 wireguard client unreachable, but it works in WSL"

  • The default Windows Firewall configuration drops ICMP on the public profile, either spin up a new rule or change the WG interface's profile.

    tcpdump and nmap are your friends here.

    Thanked by 1anon121
  • @jmgcaguicla said: The default Windows Firewall configuration drops ICMP on the public profile, either spin up a new rule or change the WG interface's profile.

    Thanks to your comment I disabled my firewall, and now the server<->client connection works, including accessing my home PC from another client VPS.

    Now I just need to figure out how to access anything inside WSL (nginx in Windows 10 works, nginx in WSL is accessible under 127.0.0.1 but not 10.8.0.3). Or maybe I'll just connect from both, Win10 and WSL with two different IPs...

    Thanks so much.

Sign In or Register to comment.