PSInternetConnectionSharing icon indicating copy to clipboard operation
PSInternetConnectionSharing copied to clipboard

VPN connections missing?

Open Owyn opened this issue 5 years ago • 27 comments

I need to turn off & on ICS for my VPN connection which connects me to the internet, but the program can't seem to see or access it anyhow

image

Owyn avatar Apr 30 '21 06:04 Owyn

Hello, thanks for posting your issue. Can you try listing your connections with Get-NetAdapter command instead of ipconfig and post a screenshot?

loxia01 avatar May 04 '21 15:05 loxia01

Obviously VPN connection is not an adapter... it's not there

Owyn avatar May 04 '21 17:05 Owyn

Ok, I believe it is those VPN connections Windows handles "internally" (LPT2/IPsec) that are not showing up as apdaters. If you have a VPN connection via the OpenVPN protocol, an adapter is created for OpenVPN connections (TAP adapter).

Unfortunately I have no means to test ICS for LPT2/IPsec connections right now. Do you know if ICS is supposed to work for LPT2/IPsec connections at all? If it is, the command Get-VpnConnections looks promising to work with in PowerShell.

loxia01 avatar May 04 '21 18:05 loxia01

I have ICS currently enabled by standard windows means on the LPT2 connection and it works (until PC restart or reconnect then I have to manually disable\enable it again for it to start working again - that's why I need this)

image

Owyn avatar May 04 '21 19:05 Owyn

Is your connection showing up if you run the following command in PowerShell? Get-NetAdapter -IncludeHidden

loxia01 avatar May 04 '21 19:05 loxia01

it doesn't, only 2 (x5) standard adapters

Owyn avatar May 04 '21 19:05 Owyn

Did you run Get-NetAdapter -IncludeHidden? (I edited the post).

loxia01 avatar May 04 '21 19:05 loxia01

well, there is no name of my L2TP connection there

image

Owyn avatar May 04 '21 19:05 Owyn

Tested to rewrite my module with Get-NetAdapter -IncludeHidden. I will upload this rewritten module so you can test for yourself. Perhaps you can test to share "Beeline_local" connection. When installing do exactly as before but name the folder "PSInternetConnectionSharing_IncludeHidden". Then add "1" to the function name, like Set-Ics1, Get-Ics1 and Disable-Ics1 when issuing the rewritten commands.

loxia01 avatar May 04 '21 20:05 loxia01

Perhaps you can test to share "Beeline_local" connection.

That's my local connection without internet, and I need internet to share so sharing it would be kinda pointless...

Owyn avatar May 05 '21 06:05 Owyn

Ok unfortunately I do not know how to fix this for now, but I remember a workaround (or solution) I used myself when I started using ICS: To make ICS persistent across reboots you have to add a value in Windows registry: Run regedit and navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\SharedAccess. There create New > DWORD (32-bit) Value and name the new key EnableRebootPersistConnection. Doubleclick the key and modify its value to 1. ICS should now be permanent across reboots.

Hope this will work for you.

Source: https://www.thewindowsclub.com/internet-connection-sharing-not-working

loxia01 avatar May 05 '21 14:05 loxia01

I have the same issue here, and in the registry, I see that ICS is enabled with an interface index of 51 that Get-NetAdapter never shows. However, this question at ServerFault has the answer:

gwmi MSFT_NetIPAddress -Namespace 'root/standardcimv2' 

In this list, I see all my interfaces, including the VPN one with the appropriate InterfaceAlias and InterfaceIndex value. Note that some interfaces show up multiple times in this list, but at least they are all here.

obones avatar May 18 '21 09:05 obones

I have the same issue here, and in the registry, I see that ICS is enabled with an interface index of 51 that Get-NetAdapter never shows. However, this question at ServerFault has the answer:

gwmi MSFT_NetIPAddress -Namespace 'root/standardcimv2' 

In this list, I see all my interfaces, including the VPN one with the appropriate InterfaceAlias and InterfaceIndex value. Note that some interfaces show up multiple times in this list, but at least they are all here.

Thanks for your help. I will see if I can get to test this command on an appropriate connection.

loxia01 avatar May 18 '21 17:05 loxia01

Some info from my side...

I'm using Check Point SSL Network Extender client. It doesn't appear when I say Get-Ics image

It appears with Get-NetAdapter -IncludeHidden image

It doesn't appear in Windows Network Connections. image

I tried a freeware program named MyPublicWiFi. It can share this hidden connection in "Router Mode (NAT)". When it runs like this, the other computer can access the resources on the VPN through this network. But it can't access internet. image

When I try to run it in Internet Connection Sharing (ICS) mode, it says "The Internet Connection Sharing (ICS) can not be enabled". image

So I guess it's not possible to use ICS on this kind of network.

MDagni avatar May 21 '21 12:05 MDagni

@MDagni Thanks for commenting. If it doesn't appear in Control Panel's Network Connections I believe it is not possible to use ICS on that connection. But I am no expert.

loxia01 avatar May 21 '21 13:05 loxia01

Beta version v1.1 released. This release has a rewritten connection enumeration command (thanks @obones for the tip) and should be able to work with VPN connections that Windows handle internally, like those using PPTP, L2TP/IPSec and IKEv2 protocols. These connections must be connected in order for the command to work. Unfortunately I am not able to test these connections myself so I am thankful for functionality and bug reports.

loxia01 avatar May 21 '21 16:05 loxia01

disabling ICS for vpn now works, but enabling it back errors: image

Owyn avatar May 21 '21 16:05 Owyn

Thanks for testing. Try to run this command (Get-CimInstance MSFT_NetIPAddress -Namespace Root\StandardCimv2).InterfaceAlias when ICS is disabled. Make sure your VPN connection is connected beforehand.

loxia01 avatar May 21 '21 21:05 loxia01

 (Get-CimInstance MSFT_NetIPAddress -Namespace Root\StandardCimv2).InterfaceAlias
Loopback Pseudo-Interface 1
Beeline_L2TP
Beeline_local
Home_local
Loopback Pseudo-Interface 1

it's all in the list (list is the same btw both with ICS enabled and disabled), and yea it's connected.

Owyn avatar May 22 '21 05:05 Owyn

I also tried PS script from: https://superuser.com/questions/470319/how-to-enable-internet-connection-sharing-using-command-line#answer-649183 and got the exact same error

Owyn avatar May 22 '21 05:05 Owyn

OK, thanks anyway. I don't know why you get errors. Will try to do some more testing.

loxia01 avatar May 22 '21 10:05 loxia01

@Owyn As I have understood it you can enable ICS manually for your VPN connection in Control Panel's Network Connections? Does that work even if your connection is disconnected?

loxia01 avatar May 22 '21 19:05 loxia01

I can enable my ICS manually just fine independently whether it's connected or not

moreover I've made an AHK macro to turn it off & on cuz powershell was giving the error, and the macro works...

Owyn avatar May 22 '21 19:05 Owyn

OK thanks for your testing.

loxia01 avatar May 22 '21 20:05 loxia01

Unfortunately, it appears this is to be expected from ICS on PPPoE connections: https://answers.microsoft.com/en-us/windows/forum/windows_10-networking-winpc/ics-internet-connection-sharing-dosent-work-in/a203c90f-1214-4e5e-ae90-9832ae5ceb55?page=1

The answer from Krisavi on September 29, 2016 gives the exact same error message, and the follow up answers up to the last page do not give much hope on a resolution from Microsoft.

That being said, I modified the registry, in that key : HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SharedAccess I added a DWORD value named EnableRebootPersistConnection with value 1 which is said to persist the ICS parameters across reboots. I'll see if that helps in the following days.

obones avatar May 27 '21 12:05 obones

persist the ICS parameters across reboots.

tried it - it doesn't, and problem isn't only across reboots, but also across reconnects

Owyn avatar May 27 '21 12:05 Owyn

I checked and I have actually not EnableRebootPersistConnection set and my ICS is anyway persistent across reboots. So I guess it is about those problem VPN connections.

loxia01 avatar May 27 '21 23:05 loxia01