Internet Connection Sharing (ICS) service in Windows allows to share Internet connection on your computer with other devices in your local network (via Wi-Fi or Ethernet). This allows all computers on the local network to access the Internet via an Internet connection on one computer (the computer may be connected to the Internet via 5G/4G/LTE modem, direct cable connection via a second adapter, satellite connection, PPPoE, VPN, etc.). In this case, this Windows computer with two network interfaces connected to different networks will be a network gateway to other devices. ICS is a built-in Windows service that provides network connection sharing, address translation (NAT), and DHCP server functionality.
You can enable shared access to a network connection in Windows in the properties of the network adapter (Sharing tab -> Internet Connection Sharing -> Allow other network users to connect through this computer’s Internet connection).
There is one unpleasant drawback in modern Windows 10 builds: if a computer with a shared network connection is restarted, other computers in a local LAN/Wi-Fi network lose Internet access.
The matter is that in modern Windows 10 builds Internet Connection Sharing service is disabled in 4 minutes and it does not restart automatically if no traffic goes through the shared connection. To restore shared Internet access, you need to uncheck and check the shared access option in the properties of the network adapter Windows is using to connect to the Internet.
To enable Internet Connection Sharing to start automatically after restarting Windows 10, enable a DWORD registry parameter EnableRebootPersistConnection with the value 1 in the reg key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\SharedAccess
.
It is easier to create a registry parameter using this PowerShell command:
New-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\SharedAccess -Name EnableRebootPersistConnection -Value 1 -PropertyType dword
Then set the automatic startup for the Internet Connection Sharing service (SharedAccess). You can change the startup type from Manual to Automatic in services.msc
or using PowerShell:
Set-Service SharedAccess –startuptype automatic –passthru
Start the service:
Start-Service SharedAccess
You can also use the following PowerShell script to find all network connections with the shared Internet access on the computer, disable shared access and re-enable it again.
$NetShareObject = New-Object -ComObject HNetCfg.HNetShare
$list = New-Object System.Collections.Generic.List[System.Object]
foreach( $connection in $NetShareObject.EnumEveryConnection ){
$config = $NetShareObject.INetSharingConfigurationForINetConnection( $connection )
if( $config.SharingEnabled -eq 1 ){
$type = $config.SharingConnectionType
$list.Add( @($type,$config) )
$config.DisableSharing( )
}
}
Start-Sleep 1
foreach( $array in $list ){
$array[1].EnableSharing($array[0])
}
You can run the PowerShell script automatically using Windows Task Scheduler at the computer startup.