Monthly Archives: March 2012

Mobile Wi-Fi Testing with Mac OS X

Continuing my work with mobile website testing, here are the steps to create a local Wi-Fi network from a Mac laptop. Just like we showed Windows 7 Wi-Fi sharing, this allows mobile phones and tablets to connect through the laptop for either a proxy configuration (like Charles), or passive monitoring (like tcpdump or Wireshark).

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:

Mac Wireless Test Setup

Mac Wireless Test Setup

Not surprisingly, doing this on a Mac is easier than Windows 7. Here are the steps to create a shared Wi-Fi connection:

  1. Connect the laptop to a wired Ethernet connection. Go to System Preferences ⇒ Network ⇒ Wi-Fi; make sure Wi-Fi is on, and disconnect from any wireless networks. Confirm that the internet connection is working in this wired configuration.
  2. Go to the Sharing settings (click Show All ⇒ Sharing.
  3. Click to highlight Internet Sharing on the left (but don’t click the check box yet).
  4. Ensure “Share your connection from” is set to Ethernet, and “to computers using” is set to Wi-Fi.
  5. Click Wi-Fi options, give it a network name, enable encryption and enter a password (I usually use WEP here but you could pick one of the more robust options)
  6. Click the check mark for Internet Sharing, and choose Start at the confirmation dialog.
  7. Your Wi-Fi symbol in the Apple menu bar should now have a gray background with a white arrow pointing up.
  8. Now you should be able to connect to your local network using a mobile phone or tablet, using the network name you used above.

When you are done testing, make sure to turn off the shared Wi-Fi network by unchecking Internet Sharing.

Mobile Wi-Fi Testing with Windows 7

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:

Windows Wireless Test Setup

Windows Wireless Test Setup

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:

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:

Adding DuckDuckGo Search Box to Movable Type

DuckDuckGo is a search engine startup whose claim to fame is their strict privacy policy:

DuckDuckGo does not collect or share personal information. That is our privacy policy in a nutshell. The rest of this page tries to explain why you should care.

Like most other search engines, DuckDuckGo offers a search box code snippet that can be used for site-specific search. Adding this to a Movable Type blog is very straightforward:

  1. Create your own search box on the DuckDuckGo site (make sure to add your domain in the Site Search field); copy and save the iframe code snippet
  2. Login to your Movable Type installation and navigate to the Widgets page
  3. Create a new widget named “SearchDuckDuckGo” and set the content as shown below
  4. Add the SearchDuckDuckGo widget to the appropriate widget set
  5. Rebuild your blog to see the results

The Movable Type widget code will look like the following, with the <iframe> portion copied from the DuckDuckGo site:

<div class="widget-search widget">
<h3 class="widget-header">Search
<div class="widget-content">
<iframe src="http://duckduckgo.com/..."></iframe>
</div>
</div>

If you have a little more room, you can get fancier and include the DuckDuckGo logo, or use the banner version which has a quick summary of the service:

DuckDuckGo Search Box Examples

DuckDuckGo Search Box Examples

Note: These steps were confirmed on Movable Type 4.x and should be similar on 5.x.