In some recent mobile website testing (e.g., using Fiddler to capture Android web traffic), I’ve found it helpful to create a local Wi-Fi network on my Windows 7 laptop. This allows connecting mobile phones and tablets and ensuring the network traffic flows through the laptop, allowing a proxy configuration (like Fiddler), or passive monitoring (like tcpdump or Wireshark).
Mac Users: See my similar guide for Mobile Wi-Fi testing with Mac OS X.
The test setup I’m using has the laptop connected through a wired network cable, and using the laptop’s Wi-Fi as a local access point or hotspot:
Here are the steps to create a shared Wi-Fi connection:
First, connect the laptop to a wired ethernet connection. If the Wi-Fi adapter is connected to a network, disconnect it. Confirm that the internet connection is working in this wired configuration.
Next, open a command prompt in administrator mode (e.g. right click on a Cmd shortcut and choose “Run as Administrator…”).
Use these commands to create a local “virtual Wi-Fi” network, replacing MyNet and MyPassword with values of your choice:
netsh wlan set hostednetwork mode=allow ssid=MyNet key=MyPassword netsh wlan start hostednetwork
Finally, share your wired internet connection with the virtual Wi-Fi adapter we just created. Now click Control Panel ⇒ Network and Internet ⇒ Network and Sharing Center ⇒ Change Adapter Settings. Right-click your wired internet connection and select Properties. On the Sharing tab, check “Allow other network users to connect…” and choose your Virtual Wi-Fi Adaptor. (For an example see this screenshot from my PC; the wired connection is “LAN”, and the virtual Wi-Fi is “Wireless Network Connection 2”.)
Now you should be able to connect to your local network using a mobile phone or tablet, using the network name you used above (e.g., MyNet).
Once everything is running and a mobile device is connected, you can show the current network status:
C:\>netsh wlan show hostednetwork Hosted network settings ----------------------- Mode : Allowed SSID name : "Variable" Max number of clients : 100 Authentication : WPA2-Personal Cipher : CCMP Hosted network status --------------------- Status : Started BSSID : ac:81:12:2e:1a:da Radio type : 802.11n Channel : 11 Number of clients : 1 bc:47:60:fb:1a:75 Authenticated
When you are done testing, make sure to turn off the shared Wi-Fi network:
netsh wlan stop hostednetwork
For more information, see these write-ups which helped me figure out the details of this technique:
- Techradar – How to turn your Windows 7 laptop into a wireless hotspot
- BestVPNService – How to share VPN connection over Wi-Fi
Instead of the manual steps I list above, here are a couple of software solutions that can manage these settings for you. On my HP laptop, I could not get either to work correctly, but these may be worth trying: