Saturday, 7 February 2015

Sharing a Windows Computers internet access to a Wifi enabled Android or an iOS device

Often we end up in a situation while travelling, where we get access to a wired internet connection, or we carry a DATA card which is accessible only from a computer. We get frustrated that we cannot access internet from a mobile device even though there is one.
How to create a WiFi Network and share the computers internet connection with other WiFi mobile devices( eg: Android smartphones, iPhone, Tablets)?

This internet sharing is limited to computers running Windows 7/8 with a WiFi Adapter.  No additional/extra applications are required. This configuration is a four step process.

I. Create a Wifi hosted-network adapter on a Windows 7/8 computer using an existing WiFi adapter.
II. Assign an Windows  ICS service Standalone mode IPAddress to this Adapter.
III. Share the Network connection of the LAN/3G data card/Wifi  to this newly created adapter.
Note: This sharing is temporary and exists till the system is shutdown.
IV. Connect your mobile device to this network.

Lets start.....

1. Create a Wifi hosted-network on a windows computer using existing WiFi adapter. 
Open the DOS command Prompt by typing "cmd" on the  Start button "Search programs and files" and Right click on "cmd.exe" and select "Run as administrator" . This will open a command prompt in an Administrator mode.

DOS Commands to create and start  hostednetwork:
Note**.  You can create  Windows shortcuts for these three  commands separately for future use.

a) Check whether the network adapter supports hosted network by running the following command.
netsh wlan show drive.
Check if "Hosted Network is supported: " is set to Yes. If it is set to NO, Wifi hosted network is NOT supported on that Wifi Adapter.

b) Create the hosted network.
netsh wlan set hostednetwork mode=allow ssid=MYWIFI-SHARE key=ABC@123

This will create a new "Microsoft Virtual Miniport Adaptor" with a SSID MYWIFI-SHARE, password  ABC@123Wireless Hosted Network also internally starts the ICS Service in standalone mode with only the DHCPv4 server function to allocate IP addresses for the connected devices on the wireless Hosted Network interface. The subnet address range for the standalone DHCPv4 server is 192.168.173.0/24.

2 Start the newly created hostednetwork. 
netsh wlan start hostednetwork

This hostednetwork adapter will exist till the system is rebooted. 
3.To stop the adhoc network 
netsh wlan stop hostednetwork.

Note**:
Create the Windows shortcuts for Starting/stopping the Wifi-Sharing. These shortcuts should be run as Administrator. 

1.Create Virtual WifiAdapter
On desktop, right click and select new shortcut. Under " type the location of the item"
enter
netsh wlan set hostednetwork mode=allow ssid=MYWIFI-SHARE key=ABC@123
Click next and give "Type a name for this shortcut"  as "Create Virtual WifiAdapter"
Click finish. Right click onVirtual WifiAdapter ->properties->advanced, tick on "Run as Administrator". Click OK.Click OK.
2.Start WiFi-sharing
On desktop, right click and select new shortcut. 
 Under " type the location of the item"
enter 
netsh wlan start hostednetwork
Click next and give "Type a name for this shortcut"  as "Start WiFi-sharing"
Click finish. Right click on  Start WiFi-sharing ->properties->advanced, tick on "Run as Administrator". Click OK. Click OK.
3.Stop WiFi-sharing
On desktop, right click and select new shortcut.  
netsh wlan stop hostednetwork
Click next and give "Type a name for this shortcut"  as  "Stop WiFi-sharing"
Click finish.  Right click on  Stop WiFi-sharing ->properties->advanced, tick on "Run as Administrator". Click OK. Click OK.

II.  Assign an "Windows  ICS service Standalone mode" IPAddress to this Adapter. 

Right click on Local Area Connection([Microsoft Virtual Miniport Adapter]) and double click on "Internet Protocol version 4 (TCP/IPv4)"
On the new window, check if the IPaddress is set to  192.168.137.1. If not, select "use the ip address" and set  192.168.137.1  and subnet mask 255.255.255.0
This IPaddress is assigned/used by ICS service in Standalone mode.

III. Share your internet connection from (3G data card,LAN,Wifi)

Open "Network and Sharing center" from "Control panel->Network and Internet" then "Change adapter settings".
Right click on your internet connection (the Adapter using which you have connected to internet in the computer. eg: 3G data or LAN) and click on properties. 
Select the tab "sharing". 
Click on "allow other network users to connect through this computer's internet connection" 
Under "Home Networking connection" Select  Local Area Connection( i.e the newly created [Microsoft Virtual Miniport Adapter] ).
check also the "allow other network users to control or disable the shared internet connection"
next click on "settings" and check all items.

IV. Connect your mobile device(Android phone, iPhone) to this network.

For Eg: On an Android phone.
Go to "Settings" on the Menu of your Android device
"Wireless and Networks" then WiFi settings and then Activate WiFi .

The device should list the MYWIFI-SHARE WiFi network. 
Connect to this network.
Enter the password: ABC@123

Save and connect. This WiFI sharing works fine on Android devices, smartphones, tablets, iPhone, iPad etc. Enjoy the internet access.

If for some reason, ICS DHCP server has not started on windows, try static IP address.
Once Connected to the Wifi network with the password, Go to Advanced Options.
Check the "Use Static IP"and fill in the ICS Service IPaddress :
IP address: 192.168.137.6 (The range of ICS IPAddress to choose  is from 192.168.137.2 to 192.168.137.255 )
Gateway : 192.168.137.1
Netmask : 255.255.255.0
DNS : 8.8.8.8



For more info on Windows hostednetwork, please see
https://msdn.microsoft.com/en-us/library/windows/desktop/dd815252(v=vs.85).aspx

Jai Jinendra...
Live and let live