-
Notifications
You must be signed in to change notification settings - Fork 91
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
Use New-NetNat instead of SharedAccess to make wi-fi hotspot work #18
Comments
Hey @kenvix, thanks for sharing this! There have been numerous issues with SharedAccess, including the limitation of only one shared network at a time, so I like the idea of I can't promise that this will be added any time soon, but I appreciate the suggestion. |
Update: There no is need for hyper-v installation (Win10 10.0.19044) Additionally, a powershell script for someone who want to execute New-NetIPAddress automatically at startup: #Requires -RunAsAdministrator
$ifName = "wg_server"
function Get-IfIndex() {
return (Get-NetAdapter | Where -Property Status -eq 'Up' | Where -Property Name -Like $ifName | select -ExpandProperty ifIndex -first 1)
}
$ifIndex = Get-IfIndex
while ( $ifIndex -eq $null -Or $ifIndex -eq "" ) {
echo "Waiting interface $ifName up ..."
sleep 3s
$ifIndex = Get-IfIndex
}
echo "$ifName Interface index is $ifIndex"
echo "Setting up IpAddr"
New-NetIPAddress -IPAddress 172.22.0.1 -PrefixLength 24 -InterfaceIndex $ifIndex
exit 0 |
Thanks @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:
Hyper-V is enabled (But you can setThere no is need for hyper-v installationhypervisorlaunchtype
tooff
in bcdedit if you dont want to use hyper-v!)Disable Internet sharing first.
Then, open powershell with admin permission
For test purpose, you can disable SharedAccess service and will find that NAT is working still .
For more information, check this article
Please note
New-NetIPAddress
should be executed every time you rebootThe text was updated successfully, but these errors were encountered: