Alexander Gromnitsky's Blog

Retrocomputing: Windows 7 wifi hotspot

Latest update:

Windows 10/11 note: use the recipe below in case of "We can't set up mobile hotspot" error. You won't get any indicators in Action Center or Quick Settings, but the mobile hotspot should work regardless.

WiFi hotspot diagram

If a wifi adapter supports the 'Hosted network' mode (run netsh wlan show drivers to check), then even an ancient Win7 laptop can be transformed into a SoftAP w/o any external software.

Steps we need to take:

  1. Create a virtual network adapter over the existing wireless nic.
  2. Make a wireless hotspot using that virtual adapter, set a ssid for the hotspot & a password for a WPA2 auth.
  3. Using Internet Connection Sharing (ICS) service, do a NAT masquerading & run a DHCP server for the hotspot clients.

Wireless hotspot

This is the easiest step. Just type

> netsh wlan set hostednetwork mode=allow ssid=LOL key=1234567890
> netsh wlan start hostednetwork

and check w/ your phone if there's a new wifi network named LOL. There's no point in connecting to it--the Win7 machine won't assign any IPs for the hotspots clients yet.

If you go to Control Panel → Network and Internet → Network Connections you'll see a new network adapter called something like Wireless Network Connection 2 that uses Microsoft Virtual WiFi Miniport Adapter device. Rename the network adapter to 'Access Point' (this isn't necessary but it simplifies things).

Internet Connection Sharing

Make sure that Windows Firewall service is running, for it's required by ICS (I suspect the firewall does NAT masquerading).

> gsv -n mpssvc

Status   Name               DisplayName
------   ----               -----------
Running  MpsSvc             Windows Firewall

Then, while in Control Panel → Network and Internet → Network Connections, change the properties of your network card, through which you access WAN, to allow 'Internet Connection Sharing' & select the aforementioned 'Access Point' adapter. If you screw this up, your hotspot clients won't be able send/receive packets to/from the WAN.

Network Connections & Internet Connection Sharing

At this point Windows should automatically start SharedAccess service & assign 192.168.137.1/24 address to the 'Access Point' adapter (the IP is hardcoded by ICS). Here's a snipped from ipconfig /all:

Wireless LAN adapter Access Point:

Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
Physical Address. . . . . . . . . : <redacted>
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::68a9:7b6b:dc8a:b369%24(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.137.1(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
DHCPv6 IAID . . . . . . . . . . . : 413987295
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-24-D4-77-36-00-0C-29-E0-EB-F5
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%2
                                    fec0:0:0:ffff::2%2
                                    fec0:0:0:ffff::3%2
NetBIOS over Tcpip. . . . . . . . : Enabled

Wireless LAN adapter Wireless Network Connection:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix  . :
Description . . . . . . . . . . . : D-Link DWA-140 Wireless N USB Adapter(rev.B3)
Physical Address. . . . . . . . . : <redacted>
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes

Windows should also bind a DHCP server to that IP (ports 67 & 68):

> netstat -an | sls -patt 192.168.137

  TCP    192.168.137.1:139      0.0.0.0:0              LISTENING
  TCP    192.168.137.1:50047    0.0.0.0:0              LISTENING
  UDP    192.168.137.1:67       *:*
  UDP    192.168.137.1:68       *:*
  UDP    192.168.137.1:137      *:*
  UDP    192.168.137.1:138      *:*
  UDP    192.168.137.1:1900     *:*
  UDP    192.168.137.1:53407    *:*

& update its routing table:

> route print -4 | sls -patt 192.168.137

    192.168.137.0    255.255.255.0         On-link     192.168.137.1    276
    192.168.137.1  255.255.255.255         On-link     192.168.137.1    276
  192.168.137.255  255.255.255.255         On-link     192.168.137.1    276
        224.0.0.0        240.0.0.0         On-link     192.168.137.1    276
  255.255.255.255  255.255.255.255         On-link     192.168.137.1    276

This is it. Try to connect your phone to LOL network. The phone should get 192.168.137.x address, w/ 192.168.137.1 as a default gateway & a dns server.

To see the hotspot status, run netsh wlan show hostednetwork.

PS

As I said, the Windows Firewall service must be running. If you nevertheless try to setup ICS w/o it, you get one of the most lovely Windows errors; it's so brilliant I couldn't resist showing it to you:

ICS error


Tags: ойті
Authors: ag