Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Address Translation and Internet Connection Sharing not required? #131

Closed
JP95Git opened this issue Aug 17, 2023 · 5 comments
Closed

Comments

@JP95Git
Copy link

JP95Git commented Aug 17, 2023

I am using Windows 10 22H2 Pro and tested WS4W 2.0.10. I got green check marks for everything. I had to enable Hyper-V to use NAT. Due the usage of Hyper-V all my virtual machines in VirtualBox were extreme slow (this is a known issue with Hyper-V). So I uninstalled Hyper-V and my virtual machines were fast again, but the green check mark next to NAT switched to a red X.

Even with Network Address Translation and Internet Connection Sharing are both disabled, everything works: I can connect from Android and Windows to my 2 devices: A router (FritzBox) and my server (the one running WS4W). I also read the issues #18 and #30 but those did not explain why everything works for me.

@micahmo
Copy link
Owner

micahmo commented Aug 17, 2023

Hey @JP95Git wow that is very interesting! I wonder if there is some remnant of NAT left over that makes this work (but isn't "enough" for WS4W to detect it). Sounds like things are in a "good" state, so I wouldn't touch it too much. 😆

Hyper-V is definitely needed initially. WS4W only shows you the prompt to enable it if it gets back an error from Windows, so that's not like something it's making up.

Just for fun, try running some of these commands in an admin PowerShell and see what you can find.

Get-NetNat -Name wg_server_nat
Get-NetIPAddress -InterfaceAlias wg_server
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V

@JP95Git
Copy link
Author

JP95Git commented Aug 17, 2023

Yes, it is a strange situation, but it works. Even a restart of the server did not break it. I backed up my configuration and decided not to touch it. My issues was more of a question "how is this possible?".

Here are the results of the commands (my Windows in in German, so some texts are in German too):

PS C:\WINDOWS\system32> Get-NetNat -Name wg_server_nat

Get-NetNat : Fehler beim Laden des Anbieters
In Zeile:1 Zeichen:1
+ Get-NetNat -Name wg_server_nat
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_NetNat:root/StandardCimv2/MSFT_NetNat) [Get-NetNat], CimException
    + FullyQualifiedErrorId : HRESULT 0x80041013,Get-NetNat

PS C:\WINDOWS\system32> Get-NetIPAddress -InterfaceAlias wg_server

IPAddress         : 10.253.0.1
InterfaceIndex    : 53
InterfaceAlias    : wg_server
AddressFamily     : IPv4
Type              : Unicast
PrefixLength      : 24
PrefixOrigin      : Manual
SuffixOrigin      : Manual
AddressState      : Preferred
ValidLifetime     : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource      : False
PolicyStore       : ActiveStore

PS C:\WINDOWS\system32> Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V

FeatureName      : Microsoft-Hyper-V
DisplayName      : Hyper-V-Plattform
Description      : Enthält die Dienste, mit denen Sie virtuelle Computer und die zugehörigen Ressourcen erstellen und verwalten können.
RestartRequired  : Possible
State            : Disabled
CustomProperties :

I uninstalled Hyper-V by using "Windows-Funktionen aktivieren oder deaktivieren" ("Turn Windows features on or off").

@micahmo
Copy link
Owner

micahmo commented Aug 17, 2023

Interesting, so Windows does not see any NetNat network for that adapter. And just to check, you are able to access other machines on the LAN and the Internet through WireGuard? I'd say you discovered a very interesting loophole! 😆

@JP95Git
Copy link
Author

JP95Git commented Aug 17, 2023

All traffic should be routed through Wireguard because I have 0.0.0.0 as allowed IPs.

For this test I took my smartphone and went to the park. I used mobile data and connected to my Wireguard at home. I can see the web interface of my router, I can access all my other devices (server and laptop) using RDP and I can access the internet. Pages like whatismyipaddress.com show the IP from my router at home.

@JP95Git
Copy link
Author

JP95Git commented Dec 19, 2023

This "feature" was probably due a bug in Windows, because it no longer works. Perhaps it was fixed with one of the recent updates from Microsoft. I am now using internet sharing.

@JP95Git JP95Git closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants