Turning Windows PC Into Wi-Fi Hotspot The Command-line Way

The innovation in networking is being significantly focused on wireless technologies as portable smart gadgets continue to outpace the PCs in terms of usage and sales. Wired networking is becoming less appealing, though it offers greater bandwidth. Especially for home users, students and hobbyists.

Wi-Fi is synonymous with wireless technology, though it’s a standard (IEEE 802.11) for Ethernet wireless local-area network (WLAN). Given the importance of Wi-Fi in having versatile and portable networking, Windows provides handy WLAN options through its netsh  command-line network configuration utility to create a quick ad-hoc Wi-Fi Access Point (AP), I mean Wi-Fi hotspot. Let’s learn how to do so in this walk-through. Believe me it’s much easier and straightforward than using a third-party software.

Prerequisites

1. Windows 7 or 8 or 10. To check which Windows release you are currently using, run winver which opens the About Windows page.

winver-command-shows-about-windows-page

2. Wireless adapter. All laptops come with at least one Wi-Fi card while most desktops don’t. Run ipconfig to make sure the system has a wireless Network Interface Card (NIC).

windows-wifi-adapters

Assuming you are running Windows 7 or above and a wireless network card is present, follow these simple steps to setup a portable wireless hotspot.

Step #1: Open the command prompt as administrator and create a hosted WLAN network by running the following netsh command. The generic syntax of the command is,

netsh wlan set hostednetwork ssid=Network_Name key=Network_Password mode=[allow | disallow]

Here,
ssid — Service Set ID, which is any name that identifies the Wi-Fi network.
key — Password for the Wi-Fi network. Minimum password length is 8 characters.
mode — Access specifier which is set to allow to grant access to the Wi-Fi network.

For instance, I run,

netsh wlan set hostednetwork ssid=deepakNet key=8charpwd mode=allow

Step #2: Start the hosted WLAN network like so:

netsh wlan start hostednetwork

starting-hosted-wifi-network-windows

The WLAN network started gets reflected in the Network Connections.

hosted-wifi-network-check-in-network-connections

netsh runs DHCP service on a pool of IP addresses in the range 192.168.137.x/24 and assigns the first IP address to the hosted network’s Wi-Fi card which can be seen by running ipconfig.

windows-wifi-hosted-network-ip-address

Step #3: To any Wi-Fi client the hotspot is now visible. I’m using another laptop running Windows 7. The hotspot “deepakNet” shows up in the network notification in the task bar tray. After entering the Wi-Fi password (8charpwd), the access is granted. That’s it!

windows-connecting-to-wifi-network

Check the connectivity to the AP.

windows-ping-connectivity-check

You can now get your smartphone on the WLAN by enabling its Wi-Fi and joining the hotspot so created.

screenshot_2017-01-25-22-04-47

If you want to turn off the hotspot service, just run

netsh wlan stop hostednetwork

Next time when there’s no Internet connectivity or no network cables around you, remember to setup an ad-hoc Wi-Fi hotspot directly from the commandline!

Advertisements