Skip to content

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

@kenvix

Description

@kenvix

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions