Computer Tips and Tricks
Get the latest posts via rss

Friday 27 January 2012

How to create a selfcontained Wireless Network

This was a challenging project, put upon me by a friend and colleague who needed a web server that they could carry around with them. The goal was to have it accessible by wireless devices such as mobile smart phones (Android, Blackberry and iPhone etc), iPods, Playstation portables, and Nintendo DS'; without the requirement for either the server or the devices to be connected to the Internet.

For the purpose of a presentation and demo, the web server would contain a small mobile website that the devices could view at any location that the demo was taking place, and interact with, without having to worry about having Internet or even local network connectivity.


We tried numerous ways to achieve this; including experimenting with wireless Internet routers and a laptop running Internet Information Services (IIS) on Windows 7 Enterprise. This just wouldn't work in any combination we tried, and became rather cumbersome. The devices just wouldn't connect to either the wifi or IIS: It was back to the drawing board.

In the end we rebuilt the laptop (upgrading the RAM to 4GB) with Windows Server 2008 R2 (including all service packs & security updates) as a standalone server, off of our domain. We added it instead to a custom workgroup. We installed IIS and got the website up and running again. Then the fun began:

We decided to turn the laptop into a wireless access point or hotspot. Effectively turning it into its own wireless network that can be connected to by the devices, thus allowing them to browse the hosted website.

Window Server 2008 R2 comes with all wireless functionality disabled. In fact it is not even installed. As long as you have a working/installed wireless adaptor this can be installed from Server Manager.

To install:

Load Server Manager, and Select Features.
Choose "Wireless LAN Service" (bottom of the list).


Click Next, let this install, and reboot the server. As long as the drivers are installed for the adaptor, it will then function the same as if it were on your home Windows 7 laptop.
Once this was completed, we installed DNS & DHCP, and configured an IP Range in DHCP. DNS we kept at its default settings.

DNS is a Server Role and is also installed from Server Manager:


DHCP is a Server Role too and is also installed from Server Manager:

We used a 192.168.1.0 IP range. We limited the amount of leases, by allowing a scope of around 50 IP Addresses. We limited the lease time to an hour.

We then disabled the internal LAN card, and made sure that the wireless card was enabled. To avoid confusion we did disable IPv6 on the wireless card, although this was probably not necessary.
Next we had to turn the wireless card into a wireless hotspot, by creating a Virtual Wireless Access Point. This was done by using NETSH commands in an Administrative Command Prompt.

We used:

netsh wlan set hostednetwork mode=allow ssid=[wifi name] key=[password]
netsh wlan start hostednetwork

The network we created used a "WPA2-PSK" encryption key. Due to what it was required for we kept the password pretty generic.

This effectively created a Virtual Wireless Network Adaptor, of which we assigned a static IP address on the same subnet, but outside of the scope. Together with the subnet mask, we also entered the same ip again to look at itself for DNS. We needed this in order to host our website.

The devices found our SSID almost immediately. But took a while before they would connect. They were then able to browse the hosted website and interact with the demonstration.
Although it did exactly what it was required to do, we did find the setup to be a little on the finicky side. It could take a while for the Access Point to activate, requiring an early setup. We found that we had to boot the laptop up, wait a few minutes, activate the access point, and then wait a few more minutes before we were able to connect any of the devices.

Once it was working it worked well and fast. The key factor was the portability; requiring just an easily transported WIFI enabled laptop.
We did find however that the PSP's and DS' had issues connecting; the PSP didn't connect at all. But the iPods and smart phones worked perfectly.

Another downside we found was that the access point (the virtual wireless network adaptor) was removed upon reboot. Even during hibernate it did not seem to hold its settings. We ended up creating a batch file to do the work for us everytime we booted up the server/laptop. It did however store its static IP settings each time.

We found that if the access point malfunctioned, a full removal of the profile via NETSH commands and a recreation, usually served us well. For this we used the same script.

Full script below:

net start "DNS Server"
netsh wlan stop hostednetwork
netsh wlan set hostednetwork mode=disallow
netsh wlan delete profile [wifi name]
netsh wlan set hostednetwork mode=allow ssid=[wifi name] key=[password]
netsh wlan start hostednetwork
iisreset

More details on the NETSH commands for WLAN can be found here...

0 comments:

Post a Comment