Monday 28 January 2013

Windows 7 Virtual WiFi Hotspot, Changing DHCP Pool

First, another winge in my series of "Linux vs Users list". This is one of those functions of an OS you'd think should have been there forever: a PC with a wireless adapter should be easily configurable as a Wireless Access Point, right? And Linux seems to have all the right tools and be perfectly geared to do this, right? Well in theory yes, but in real life getting the software to perform this task compatibly with your wireless adapter is pretty complicated, so if the hard working Linux hackers find this hard to achieve, what can we expect from Microsoft, who generally works with it's back to the user's needs, right?
 
Well wrong.
 
With Windows 7 you get something called a Virtual Wireless Adapter, and what they call a "hostednetwork", which basically creates what its name says, a virtual WiFi card secured in WPA style and assigns DHCP addresses to the clients that you connect to it. There are quite a few tutorials googleable on the Internet to guide you in the process (http://www.wi-fiplanet.com/tutorials/article.php/3849841/How-to-Create-Wireless-Hosted-Networks-in-Windows-7.htm, http://winsupersite.com/article/faqtip/windows-7-tip-of-the-week-use-wireless-hosted-networking-to-share-an-internet-connection-wirelessly). This works pretty straightforwardly, but being Microsoft not everything could be that easy could it?
 
Two issues arise. First, this is a manual process, i.e. you have to run a command line, there is no automation or recovery after a restart or suspend-resume; this can be partially overcome by running it as a script on startup (see http://www.addictivetips.com/windows-tips/how-to-run-programs-automatically-on-windows-7-system-startup/, inserting the command line netsh wlan start hostednetwork), although for auto-reconnect or starting up after a resume more complex solutions would need to be programmed.
 
The second issue is that the DHCP IP address pool assigned to the clients are seemingly fixed, in the range of 192.168.137.x. This might not be an issue for most users, but if this is integrated into a larger LAN where these IP might conflict with others, or if like myself you simply don't like the number 137 there should be a way to change that.
 
Well yes, it is actually possible, but in true MS style it isn't easily accessible. As explained in various sites (for example http://support.microsoft.com/kb/230148) you must modify a set of registry keys, under the following tree:
  •  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SharedAccess\Parameters
The key values to change are ScopeAddress, ScopeAddressBackup & StandaloneDhcpAddress, which should all have the same value corresponding to the first IP address of the range you want to assign (i.e. 192.168.12.1 would give you addresses in the 192.168.12.x/24 range). The network address assigned is limited to a 255.255.255.0 netmask, non-configurable. Once changed, restart the Internet Connection Sharing service (you can find it typing Services in the Windows Start Menu search bar).

 
One additional consideration that although once encountered seems pretty obvious, does not seem to be addressed by any of the sites I have found: if you change the DHCP IP address server in the registry, you must also modify the static IP address assigned to the Virtual WiFi Adapter (type view network connections in the Windows Start Menu search bar, right click and Properties on the adapter identified as Microsoft Virtual WiFi Miniport Adapter). Here you must switch the value to the same one used in the registry, in the previous example, 192.168.12.1).
 
 

2 comments:

  1. hi
    i'm a linux user and i've been wondering if something like this "virtual adapter" is avaible on/to GNU/linux?
    if the hardware supports it, then may be is possible by software work.
    But i've couldn't find info about if exist on GNU/linux or how it works in win2 to understand and try make it work on GNU/linux.

    if you know something about it, i would appreciate if you share your knowing with me

    thanks

    ReplyDelete
  2. I was trying to set up a Win7 WiFi AP with the MS Virtual WiFi Miniport Adapter for days now and almost hopeless.
    The problem was that he was sending packages all the time, but did not receive anything - so nothing worked.

    After checking these three key values in the registry and noticed they were not the same (however this could happen) I corrected it and everything is working fine now!

    Thanks a lot for this hint, I was shortly before reinstalling windows :)

    ReplyDelete