Some notes on the proper way of doing Ad-Hoc on Windows 10, I guess.

(中文版)

So... The situation is, as my school starts using the new authentication software for network, it allows enabling multiple network cards without hacking, aka I can finally get myself some sweet Ad-Hoc action for my cellphone... But certainly not super easy to set up. Thankfully I finally got a way to get it all done.

Oct. 6, 2016 Update

Windows 10 Redstone (Anniversary) Update seems to disable the hosted network function by default, and currently there's no workaround available yet. I'm contacting support for this, but before further update, this does not work on Redstone Update or onward. But anything from Vista to pre-Redstone Update should be fine.


Pretty much all the guides online shows how to set up a hosted network and share the Internet from another adapter. Well setting up is pretty easy. Just run command prompt in admin mode, and use the following code, and it's done. Nothing fancy.

Getting Internet into the hosted network however, isn't as easy as it says. The problem is, the Internet connection requires authentication, aka I can't just bridge the two adapters together. Luckily setting up an NAT switch could solve everything. Sounds sweet. Should be easy to do, right?

Not really. I already have a NAT switch set up for Hyper-V, so that I can have Internet in virtual machines. And Windows 10 only allows 1 NAT switch to exist. Which means, well, I can't just set the NAT switch for both Hyper-V and hosted network. Or can I?

Apparently, I can. Basically, NAT works like, listening to the packages form a range of IP addresses and re-route the network packages. It only cares where the package is from, rather than which network gateway it's from. So, maybe I could just let it listen to the IP range of both gateways?

It's pretty strange that, Windows doesn't just provide the setting to change the gateway address of the hosted network. Luckily from an online post, I found out that, there's an option to change it in the Register Table. In

change all 3 of ScopeAddress , ScopeAddressBackup , StandaloneDchpAddress  to the desired address (I use 10.222.222.1 ), usually would be something inside 10.0.0.0/8  or 192.168.0.0/16 . I prefer the former one because it looks cooler. This way, when stop and restart the hosted network, it'll have this address. And it seems to always have 24-bit mask.

Now, get on PowerShell in admin mode, type in and execute

and it's done. (If there's already a NAT switch exists, use Get-NetNat | Delete-NetNat to remove it.) As long as every gateway has it's IP range within 10.0.0.0/8 , it will work. In my current case, I have my Hyper-V gateway at 10.233.233.1 , the hosted network gateway at 10.222.222.1 , and at least the hosted network works. I'm pretty sure Hyper-V works too since the they both has 24-bit mask despite the NAT interface has a 8-bit mask.

 

And, I have free wifi for my cellphone now, so, yay!

 

Just log this down for my own reference, but any of you can try this if you got into the same situation and want to set up a hosted network.

Leave a Reply