Here is a simple diagram of the lab. PC1 has 2 connection, one with cell phone(wifi) and the other is a ethernet cable connect to PC2. PC2 only has 1 connection which connects to PC1.
We want to let PC2 access to Internet through wifi connection of PC1.
01 Enable IP Forwarding
We have to edit the registry ket to enable IP forwarding. Open regedit and navigate to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter” and set DWORD value to 1.
02 Set up NAT for the Internal Network
We have to enable NAT using powershell. Spawn an administrator powershell and use the following command to enable NAT.
New-NetNat -Name "NATNetwork" -InternalIPInterfaceAddressPrefix "192.168.137.0/24"
Then PC2 can access Internet using PC1’s wifi connection.
Remove the setting after the lab is simple.
01 Find the NAT configuration
Get-NetNat
02 Remove the NAT Configuration
Remove-NetNat -Name "NATNetwork"
(Optional) Disable IP Forwarding
Open regedit and navigate to “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\IPEnableRouter” and set DWORD value to 0.