micahmo / WgServerforWindows

Wg Server for Windows (WS4W) is a desktop application that allows running and managing a WireGuard server endpoint on Windows
MIT License
818 stars 78 forks source link

Stopped working after reboot (Windows Server 2019) #138

Open pcinacio opened 9 months ago

pcinacio commented 9 months ago

Good morning. I installed in a Windows Server 2019 environment, and things worked fine. After a reboot, Tunnel Service, Private Network, and Nat Routing, all appear in red. Is there a way to work around this? I have WireGuard in a Debian environment, and it works well. Totally appreciate the work of those who put it to work on Windows this way, but always found it a bit trickier.. :/ CapturarWG

vsviridov commented 9 months ago

Same thing happened to me. "Install tunnel service" doesn't seem to do anything. Attempting to start Wireguard tunnel: wg_server causes and "Error 5: Access Denied" message.

vsviridov commented 9 months ago

Check this https://stackoverflow.com/questions/48478869/cannot-bind-to-some-ports-due-to-permission-denied

Likely the port got reserved by the OS which prevented the service from starting. It also bugs out the UI, making it think the service is not installed.

Another ticket with more details: https://github.com/micahmo/WgServerforWindows/issues/99

micahmo commented 9 months ago

Great find @vsviridov! Others, let us know if this clue helps at all!

pcinacio commented 9 months ago

Ok, so i understand it now. Yesterday i administered excluded the Wireguard port to prevent the reservation, reboot a couple times, so far, everything is good. Lets see if it stays that way :)

micahmo commented 9 months ago

@pcinacio and others, if this ends up working, do you think it's something that should be added to WS4W? I'm not sure how easy it would be to do in C#, but maybe once the port is selected in the server configuration, I can reserve it (or at least notify if it's in use).

vsviridov commented 9 months ago

I think the behaviour where the service is registered, but can't start and the application still shows "Register service" button is a bug.

Maybe checking if the port is reserved in the app is a good idea, and adding mitigation would be great, as the whole point is about ease of use.