Code Monkey home page Code Monkey logo

wgserverforwindows's Issues

About .net core!

I like this project very much, but when I installed it on my work PC recently, it kept saying that the .net core component was missing. What puzzled me was that the software did not indicate what version of the net component was missing. I tried to download several versions on the web, but it didn't work.

The pop-up window prompts "would you like to download...", I click yes, and no browser window pops up.
May I ask which version of .net core components do I need to install?

NAT Routing - Doesn't start automatically (task not being created)

I have v2.0.5 and it works great except for after the computer restarts. NAT Routing always stays disabled until I start up WS4W and click enable again. I don't see anything under services about starting up automatically - what would the command be to start NAT routing so that I could add it in manually as an Automatic (Delayed) start service?

Invalid MAC of handshake, dropping packet from

Steps I did WireGuard Server For Windows in VPS
1.successfully run all requests
https://ibb.co/Fz1vmZf
2.
Infor Server Configuration https://ibb.co/bbH36sD
Export Configuration File => vpnFile.conf https://ibb.co/CWZ5bgr
3.I opened port 51820 on Firewall
4.Use vpnFile.conf on another computer
https://ibb.co/zmrw5sz
5.Wireguard always notices on the log "invalid MAC of handshake, dropping packet from"
https://ibb.co/HTsw1Ht
=>It makes my connected computer unable to access the network
=>I'm a newbie with no experience.I don't know what step I'm missing or where I'm going wrong. Please help me

Specified cast is not valid

When I try to activate internet sharing I have this error

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidCastException: Specified cast is not valid.
at NETCONLib.NetSharingManagerClass.get_INetSharingConfigurationForINetConnection(INetConnection pNetConnection)
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.<>c__DisplayClass5_0.b__1(INetConnection n) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 62
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 60
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 51
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.InvalidCastException: Specified cast is not valid.
at NETCONLib.NetSharingManagerClass.get_INetSharingConfigurationForINetConnection(INetConnection pNetConnection)
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.<>c__DisplayClass5_0.b__1(INetConnection n) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 62
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 60
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 51

Have a button to activate/deactivate server

Hi there,

Thanks for writing this GUI that massively simplifies setting up WireGuard properly.

However, there's one functionality in base WireGuard that I miss--as the server, I am still able to deactivate/exit the program, and that option is remembered on next startup. WG4W however is persistently on, restarting does not seem to shut the server off. Exiting the program does not kill the WG service running in the background.

My use case is that I want to run a temporary server to create an ad-hoc LAN with my mates, but I want to be able to stop it once the session is over, so that they don't connect to/through my network if they forget to deactivate the WG client on their end.

Could we get a button that remembers the activated/deactivated state of the server that hopefully persists through restarts? Cheers.

Maybe we increase the grouping function of the client management page.

Maybe we increase the grouping function of the client management page.
Each client occupies a large part of the area. When there are many people, it will be very crowded. You can make each of them in a specific group, and you can also fold the configuration file information in the group. , expand it when you want to view it.
This will make managing the client a lot easier.

Multiple WAN IP addresses, bind NAT to single one?

I've got 2 public IP addresses on my WAN interface. Wireguard listens on IP1, but when I enable NAT, and connect a client, outgoing IP addresses for clients are basically random, sometimes they get IP1, sometimes IP2.

Is it possible to enforce this, somehow, so that clients get same outgoing IP address as is the listening one?

connected but no internet

Hi, from my iPhone I connected successfully with cell data to home windows wireguard:.
Here's server status:

interface: wg_server
public key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
private key: (hidden)
listening port: 51820

peer: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
preshared key: (hidden)
endpoint: 174.xx.xx.xx:13670
allowed ips: 10.253.0.2/32
latest handshake: 13 seconds ago
transfer: 38.24 KiB received, 6.50 KiB sent

But I cannot access internet or my home LAN from iPhone when connected to wireguard..

Any ideas?

Thank you!

Server Setup not possible without Preshared Key

Hi, it is my understanding, that usage of a Preshared Key in server and client configuration is optional in Wireguard.
But I can't try it, as WireGuardServerForWindows doesn't allow to setup configuration without Preshared Key.
It would be nice, if Preshared Key could be optional.

WIREGUARD Windows Server 2012

I am trying to install wireguard on windows server 2012 but when I want to create the tunnel the service cannot be started: WireGuard Tunnel: wg_server is there any way to fix it?

Donation Button

Maybe you could add a donation button somewhere here on github?

This project is epic!

New-NetNat support check not working as intended

First off let me thank you for making this application. I only found it yesterday but managed to get a WireGuard server running in under an hour.

Now onto the issue at hand.

In commit eb22d73 a support check for New-NetNat was introduced. This support check fails on my machine even though New-NetNat is supported. Running the support check in powershell yields the following output:

PS C:\WINDOWS\system32> Get-Help New-NetNat -Parameter InternalIPInterfaceAddressPrefix
Get-Help : Kein Parameter entspricht dem Kriterium "InternalIPInterfaceAddressPrefix".
In Zeile:1 Zeichen:1
+ Get-Help New-NetNat -Parameter InternalIPInterfaceAddressPrefix
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (System.Manageme...CommandHelpInfo:ProviderCommandHelpInfo) [Get-Help],
    PSArgumentException
    + FullyQualifiedErrorId : NoParmsFound,Microsoft.PowerShell.Commands.GetHelpCommand

Get-Help fails to find information about the InternalIPInterfaceAddressPrefix parameter and gives an exit code other than 0. Running the commands to manually set up NAT routing works fine however and no errors occur. After rewriting the support check and letting it do the setup everything worked fine aswell. I have pushed my changes to https://github.com/Dola-Shuvi/WgServerforWindows/commit/41413db1a86a4dbde74a3cba317c761da64b4f8e for you to take a look at.

My Windows version is 22H2 (Build 19045.2130) and I installed everything except the Hyper-V-Hypervisor and the GUI manager in the add/remove Windows features menu.

wg Network may become public after reboot

The wg Networks may become public after reboot.
The task scheduler entry re-enables NAT Routing, but Private Network (sometimes?) needs to be re-enabled manually in the WS4W UI.
A simple solution would be to extend the WS4W CLI command to change the network to private, so the task scheduler call on reboot can do both: enable NAT routing and change network to private.

Endpoint ipv6

Error when specifying ipv6 of server configuration in the endpoint line

Failed to launch

Greetings
Thank you for making WG4W. I can not get it to launch.

My setup
Edition Windows 10 Pro
Version 21H1
OS build 19043.1237
Experience Windows Feature Experience Pack 120.2212.3530.0
CPU: Intel(R) Core(TM) i5-3470 CPU @ 3.20GHz 3.20 GH
RAM: 8GB

WinGuard - downloaded, install
WG4W - download portable, unzip, launch 'WireGuardServerForWindows.exe'
Installed the .Net Core when prompted
.NetCore gives install complete dialog box
Get error that .NetCore is not installed. I see it in the installed program list.
Did repair of .NetCore.
Launch WireGuardServerForWindows.exe, same error
Restart computer
Launch WireGuardServerForWindows.exe, same error
step01
step02

Any suggestions would be appreciated.
Thank you

unsharing and resharing (via CLI)

Hi! Thanks for your hard work!

A reboot may still cause the the internet sharing to fail, even though the Internet Connection Sharing service is running, and the network interface indicates that it is sharing in Control Panel. Only unsharing and resharing can fix this.

  1. How to do it (unsharing and resharing)? Just click the "Disable internet sharing" button?
    2)Maybe you can check the server's health after restarting Windows and restore it if necessary?

Suggestion: Ability to change the default folder path of the configurations

Hello again! Would it be possible to have this as an option?

If this would complicate things, then it would just be convenient if there was a button somewhere in the app that would open the WS4W folder in AppData in order to access the config files quickly.

Thank you for taking the time to read my suggestions.

DNS Search Domain

The wireguard docs say this:

DNS — a comma-separated list of IP (v4 or v6) addresses to be set as the interface’s DNS servers, or non-IP hostnames to be set as the interface’s DNS search domains. May be specified multiple times. Upon bringing the interface up, this runs ‘resolvconf -a tun.INTERFACE -m 0 -x‘ and upon bringing it down, this runs ‘resolvconf -d tun.INTERFACE‘. If these particular invocations of resolvconf(8) are undesirable, the PostUp and PostDown keys below may be used instead.

In the current platform, when I add a non-IP address to the "DNS Servers" list, it is invalid. To be honest, I think this behavior is fine. I think there should be an additional field for search domain(s) that, if filled, simply joins the entries as comma-separated values to the DNS line of the configuration.

Suggestion: Cannot enable tunnel service when at least 1 client is not configured

Hello. I would like to make a suggestion about the application.

Would it be possible for us to still be able to enable the tunnel service even when both client folders (clients_data and clients_wg) are empty? The reason I am asking this is because, after I generate the config files, I don't want to keep them on the server machine. I only want each client to keep his config file (for security purposes).

Thank you.

Restrict lan access

Thank you for creating this wonder full repo, installation and configuration made extremely easy.
Surprisingly this VPN on Windows 10 is faster than on Ubuntu (virtual machine with same hardware etc).

One question, how do I go about limiting access to certain networks in my LAN? I assume via local firewall rules but am not sure.

-M

Suggestion: Optional NAT routing task

Hello again. So I observed that when you enable NAT routing, a task is created in task scheduler that executes the setnetipaddress using your app on system startup.

Since I am using a WiFi network, it takes a while until my WiFi adapter automatically connects to my WiFi network on system startup, so when the task is executed, there isn't a wireguard tunnel to receive the IP address and subnet mask. As a result, the clients do not have internet access.

This is an issue I had been having even when I was manually setting up wireguard in the past, so this isn't an issue with your app. Of course, an ethernet connection would solve this, but it is not possible for me at the moment.

As a workaround for this, I have created a custom task in task scheduler that runs a .bat file that waits a few seconds before setting the IP address in the wireguard tunnel at system startup.

I tried to delete the task that the application creates, but it seems to come back after every restart. Would it be possible to add a checkbox at the "NAT Routing" section, that would let us decide if we want the task?

Thank you for your time.

Can't enable internet sharing after enabling NAT

following the setup steps once NAT is enabled, I cannot enable internet sharing or persistent sharing, both buttons are greyed out. I can enable internet sharing manually by opening the network connections properties. reopening the Wg Server app shows sharing is enabled but not persistent.

I have gone into regedit and changed HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedAccess\EnableRebootPersistConnection from 0 to 1 and changed "Internet Connection Sharing" in services from manual to automatic. so far with a restart of windows it all seems to be working on a remote client, but the app still shows persistent sharing is disabled with the button greyed out.

This is on the most recent win 10 updates on 22H2. is there a manual setting I am missing or can the app be updated to allow the buttons to work?

Use New-NetNat instead of SharedAccess to make wi-fi hotspot work

Recently I found that once wireguard server's NAT is enable, I will not able to create a wi-fi hotspot with Internet access.

Why should not use SharedAccess ?

This service is made for hotspot and can only support one NAT instance, meaning that, you will not able to set up a Wi-Fi hotspot with Internet access because SharedAccess services has been occupied by wireguard server's NAT

However, with New-NetNat command, you'll able to set up many NAT instances and keep wi-fi hotspot work.

How to set up NAT with New-NetNat?

Requirements:

  • Windows 10 Anniversary Update or later
  • Hyper-V is enabled (But you can set hypervisorlaunchtype to off in bcdedit if you dont want to use hyper-v!) There no is need for hyper-v installation

Disable Internet sharing first.
Snipaste_2022-01-05_11-07-48

Then, open powershell with admin permission

# First, get your interface index of wg_server interface
Get-NetAdapter
# Give a IP to wg_server interface
New-NetIPAddress -IPAddress 172.22.0.1 -PrefixLength 24 -InterfaceIndex 68 # Your interface index here
New-NetNat -Name wgservernat -InternalIPInterfaceAddressPrefix 172.22.0.0/24 # Your NAT name and interface CIDR here
Get-NetNat # 

Snipaste_2022-01-05_11-25-42

For test purpose, you can disable SharedAccess service and will find that NAT is working still .
Snipaste_2022-01-05_11-37-26

For more information, check this article

Please note New-NetIPAddress should be executed every time you reboot

No Address propperty in output server config

Address propperty is not saved to output config.
So network interface address is not configured (169.254...).

without this line uncommented:
https://github.com/micahmo/WireGuardServerForWindows/blob/158c875bc089d3e61605a540b3edab9060595d72/WireGuardServerForWindows/Models/ServerConfiguration.cs#L21

server config in \AppData\Roaming\WS4W\server_wg\wg_server.conf before:

# test
[Interface]
ListenPort=55555
PrivateKey=...

# client-test
[Peer]
PersistentKeepalive=0
PublicKey=...
PresharedKey=...
AllowedIPs=10.1.1.2/32

after uncomment:

# test
[Interface]
ListenPort=55555
Address=10.1.1.1/24
PrivateKey=...

# client-test
[Peer]
PersistentKeepalive=0
PublicKey=...
PresharedKey=...
AllowedIPs=10.1.1.2/32

Can anyone test/confirm this?

Migrate config to a new server

Hi Micah
Is there an easy way to migrate the existing running config to a new server without having to recreate every client.
Thanks

I cannot ping after a successful handshake.

I have successfully shaken hands, but I can't ping.
image
image
The following is the configuration of my client, the allow ip is inconsistent with the server, Is this caused by the allow ip of the client?
image
image

No internet and with latest update of windows 10, i can't enable internet sharing:

Hello,

i've no internet when my client is enabled...

server status:
`interface: wg_server
public key: eQqR5N/GnJgu+Yw8mRIDtZpublickey
private key: (hidden)
listening port: 51820

peer: v1RLoLK8Lynw9yvf20aHlN57ddApublickey
preshared key: (hidden)
endpoint: 192.168.1.254:55022
allowed ips: 10.253.0.3/32
latest handshake: 3 hours, 34 minutes ago
transfer: 18.27 KiB received, 301.00 KiB sent
persistent keepalive: every 25 seconds`

Im behing a freebox, port 51820 is opened

Firewall is off

for: endpoint: 192.168.1.254:55022

i've tryp iplan, ipwan and same

in client log:
2022-04-13 20:44:27.801: [TUN] [wg_server] Handshake for peer 1 (no address) did not complete after 5 seconds, retrying (try 12) 2022-04-13 20:44:27.801: [TUN] [wg_server] Sending handshake initiation to peer 1 (no address) 2022-04-13 20:44:28.817: [TUN] [wg_server] Handshake for peer 2 (192.168.1.254:55022) did not complete after 5 seconds, retrying (try 13) 2022-04-13 20:44:28.817: [TUN] [wg_server] Sending handshake initiation to peer 2 (192.168.1.254:55022) 2022-04-13 20:44:32.861: [TUN] [wg_server] Handshake for peer 1 (no address) did not complete after 5 seconds, retrying (try 13) 2022-04-13 20:44:32.861: [TUN] [wg_server] Sending handshake initiation to peer 1 (no address) 2022-04-13 20:44:33.907: [TUN] [wg_server] Handshake for peer 2 (192.168.1.254:55022) did not complete after 5 seconds, retrying (try 14) 2022-04-13 20:44:33.907: [TUN] [wg_server] Sending handshake initiation to peer 2 (192.168.1.254:55022)

edit: with latest update of windows 10, i can't enable internet sharing:
`System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Runtime.InteropServices.COMException (0x80040201): Un événement n’a pu invoquer aucun des abonnés. (0x80040201)
at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type)
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 146
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 52
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.Runtime.InteropServices.COMException (0x80040201): Un événement n’a pu invoquer aucun des abonnés. (0x80040201)
at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type)
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 146
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 52

`

Allowed IPs should be editable in client configuration

Hi,
"Allowed IPs" is a wireguard client configuration. At the moment is is set in "Server Configuration".
It may be nice to set it up once in "Server Configuration" but as a peer parameter it really should be in "Client Configuration". Maybe with a button "populate from server"?

This has fairly low priority, as "Allowed IPs" can be changed in the client software anyway, but it just looks ... "right" to be in "Client Configuration". ;)

Internet sharing is not enabled

Hello,
I can't enable internet sharing, when I click enable I get the following error:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.InvalidCastException: Specified cast is not valid.
   at NETCONLib.NetSharingManagerClass.get_INetSharingConfigurationForINetConnection(INetConnection pNetConnection)
   at WireGuardServerForWindows.Models.InternetSharingPrerequisite.<>c__DisplayClass5_0.<Resolve>b__1(INetConnection n) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 62
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 60
   at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 51
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
   at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)
   at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
   at System.Windows.Controls.Primitives.ButtonBase.OnClick()
   at System.Windows.Controls.Button.OnClick()
   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
   at System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.InvalidCastException: Specified cast is not valid.
   at NETCONLib.NetSharingManagerClass.get_INetSharingConfigurationForINetConnection(INetConnection pNetConnection)
   at WireGuardServerForWindows.Models.InternetSharingPrerequisite.<>c__DisplayClass5_0.<Resolve>b__1(INetConnection n) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 62
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 60
   at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 51

The system power state is transitioning from to . when click sharing nic. and choose real nic

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Runtime.InteropServices.COMException (0x8007030E): The system power state is transitioning from to . (0x8007030E)
at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type)
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 117
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 50
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

System.Runtime.InteropServices.COMException (0x8007030E): The system power state is transitioning from to . (0x8007030E)
at NETCONLib.INetSharingConfiguration.EnableSharing(tagSHARINGCONNECTIONTYPE Type)
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve(String networkToShare) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 117
at WireGuardServerForWindows.Models.InternetSharingPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\InternetSharingPrerequisite.cs:line 50

Connection stablished but not changing IP

Hi! Thanks @micahmo for the amazing WireGuard deployer for Windows.

I've used it to configure a WireGuard Server on a remote Windows Server 2019. But its not hiding the Client IP.

The configuration I used for Server is this: see screenshot (MYEXTERNALIPADDRESS is substituted by the real IP address)

And the configuration I used for Client is this: see screenshot (even using 1.1.1.1 as DNS the issue still happen)

When I connect everything, the handkshake is complete, but if I try "what is my ip" on Google, on client side, it still shows the real IP and not the Remote Windows Server 2019 IP.

Am I missing something?

No server access in Linux box after connected.

Hi there,
First of all, thanks for this wonderful app.

So I am using Kubuntu Kinetic Kudu (22.10) with Linux kernel 5.19.7 from xanmod.
I am able to connect mas no ping and no rdp access port after connection.
In Windows 10 everything works fine.
Is there any trick?

Thanks

NAT Routing Error

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Exception: New-NetNat : Ung�ltige Klasse
In Zeile:1 Zeichen:1

  • New-NetNat -Name wg_server_nat -InternalIPInterfaceAddressPrefix 10.2 ...
  •   + CategoryInfo          : MetadataError: (MSFT_NetNat:root/StandardCimv2/MSFT_NetNat) [New-NetNat], CimException
      + FullyQualifiedErrorId : HRESULT 0x80041010,New-NetNat
    
    
     at WireGuardServerForWindows.Models.NewNetNatPrerequisite.Resolve(String serverDataPath) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\NewNetNatPrerequisite.cs:line 115
     at WireGuardServerForWindows.Models.NewNetNatPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\NewNetNatPrerequisite.cs:line 68
     --- End of inner exception stack trace ---
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
     at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
     at GalaSoft.MvvmLight.Helpers.WeakAction.Execute()
     at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)
     at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(ICommandSource commandSource, Boolean userInitiated)
     at System.Windows.Controls.Primitives.ButtonBase.OnClick()
     at System.Windows.Controls.Button.OnClick()
     at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
     at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
     at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
     at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
     at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
     at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
     at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
     at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
     at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
     at System.Windows.Input.InputManager.ProcessStagingArea()
     at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
     at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
     at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
     at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
    
    

System.Exception: New-NetNat : Ung�ltige Klasse
In Zeile:1 Zeichen:1

  • New-NetNat -Name wg_server_nat -InternalIPInterfaceAddressPrefix 10.2 ...
  •   + CategoryInfo          : MetadataError: (MSFT_NetNat:root/StandardCimv2/MSFT_NetNat) [New-NetNat], CimException
      + FullyQualifiedErrorId : HRESULT 0x80041010,New-NetNat
    
    
     at WireGuardServerForWindows.Models.NewNetNatPrerequisite.Resolve(String serverDataPath) in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\NewNetNatPrerequisite.cs:line 115
     at WireGuardServerForWindows.Models.NewNetNatPrerequisite.Resolve() in C:\Users\micah\source\repos\WireGuardServerForWindows\WireGuardServerForWindows\Models\NewNetNatPrerequisite.cs:line 68
    
    

Always on

Maybe i misreading the readme, but is there a way to disable the tunnel?
At the moment it seems you just always be on

Remove WireGuard branding and logo

The WireGuard team has requested that this application's name and logo be changed to not directly reference WireGuard. This issue will track work against that goal.

Specifically, the following requests have been made.

  1. Remove "WireGuard" from the name of this application (including in the repo and wherever it appears in the app). We will use "Wg" instead.
  2. Add proper attribution related to the WireGuard registered trademark.

We have not been asked to change the following.

  1. Miscellaneous references to "WireGuard" throughout the documentation.

Please comment if any additional issues are introduced as a result of thse changes. Please also comment if you notice any lingering artifacts in the application once this issue is closed (in case I missed anything).

Tasks

  • Change application logo (2ac1dd3)
  • Take new screenshots with new logo (61e746f)
  • Change repo description
  • Change repo name/URL
    • Verify auto-update from older versions redirects
  • Change application name in README (214e159)
  • Change solution and folder names within repo (1062298)
  • Change application name in installer and update install scripts (09c00da)
    • Installer should clean up old assemblies, desktop and start menu shortcuts (61ef4ec)
  • Change application name in code (1062298)
    • Verify that workflows still run (fc7c6d3)
    • Verify splash screen, about box (b901275)
    • Verify cross-process commands work (main app to status, duplicate main apps, etc.)
    • Check behavior of Windows Tasks which refer to exe names; provide upgrade path not needed since Tasks refer to the CLI, whose name thankfully didn't change (ws4w.exe)
  • Add registered trademark note to README attribution (a2c93a4)
  • Modify auto-update checker and version info links (b901275)
  • Having already bumped version numbers, update date when actually releasing (here) (4472ba4)

Create an installer

As evidenced by #5, downloading and extracting the portable version of WS4W is not completely straightforward. A proper installer would address these issues.

Specifically, the installer should...

  • Install dependencies like the .NET Core 3.1 Desktop Runtime.
  • Place the executable and dependencies in Program Files instead of requiring the user to manually extract a ZIP.
  • Optionally add Start Menu / Desktop shortcuts.
  • Place CLI in PATH.

No IP without NAT routing or Internet Sharing

Wanting to try out my own routing with Windows' IP Routing, I disabled NAT & Internet Sharing.
Unfortunately wg_server won't get the desired IP address, just a Windows dynamic 169... address, if both options are turned off.

As a workaround I can manually execute

netsh interface ipv4 set address name="wg_server" static 192.168.170.1 255.255.255.0

but it would be better, if it could be done automatically with the correct ip address. I am not sure yet, how useful it is to disable NAT.

Cannot specify a client with IPv6 address

Hi,

In version 2.0.1.0 (ran as Administrator) I cannot specify in the Client an IPv6 address.

If the server's address is an IPv6 (e.g., fd4d:b189:9674::1/64) then Generate from Server button doesn't work and the program hangs.

If I manually enter an IPv6 address in Client (e.g., fd4d:b189:9674::2/64) then the box remains red. If I save this I get:
One or more clients has missing or incorrect configuration.

There's also a hint for Address field that an address should be a SINGLE address, but this is incorrect since I could provide BOTH an IPv4 and an IPv6 address.

Thx

Persistent Internet Sharing does not work.

Windows 2012R2 server (primary domain controller), all works fine but click in the "Enable" button for Persistent Internet Sharing does nothing so if the machine reboots Wireguard will not work. No error in event viewer.

I've seen a lot of post with this issue in Windows 10 that suggest change the key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\SharedAccess but that key doesn't exists in 2012R2, don't know if this app uses that way.

Windows VM Azure - wg_server issue

Hi,

I have a windows data center 2019 VM running on Msft Azure, after the initial setup all went smoothly. I stop the VM when I do not use it to save $, by doing this from the azure portal, the VM enters a "Stopped (deallocated)" state which relieves the VM of tying down resources and releases them to the pool for other customers to use, which is different from shutting down the VM from inside the VM i.e normal shutdown, this just enters a "Stopped" state, different from "Stopped (deallocated)" state. If I shutdown the VM from inside the VM, then the VM still holds onto the resources and WS4W works as expected, I imagine this would work fine for a normally shutdown VM/PC etc, all resources are retained on start up but not the case for Azure VM.

I'm using a Standard B2s (2 vcpus, 4 GiB memory)

When I need the VM back up and running, I start the VM from azure portal and since azure released the resources back to the shared pool, a new ethernet v-switch is created and a new ethernet adapter is also created, and wg_server tunnel has been removed.

To get this resolved, I need to manually install the tunnel service by opening WS4W gui in admin mode and pressing install tunnel service, during this process WS4W gui freezes and I need to manually restart the VM 2-3 times before wg_server is installed. After which all works fine, until I repeat the steps above. Is there something that I can do to persist wg_server interface and not have to do this on each VM start up?

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.