In this tutorial, we’ll learn how to create a WiFi hotspot in Linux. First, we’ll check whether the WiFi adapters support hostapd. Afterward, we’ll utilize Network Manager to quickly create and delete a hotspot access point.
Not every WiFi device supports hostapd. hostapd is a user-space daemon which we use to create WiFi hotspots. Therefore, we should know whether it’s supported by a wireless device.
First of all, we should find the network interface:
For that purpose, we can use iw:
$ iw list
Device supports AP-side u-APSD.
Supported interface modes:
In the output, we should look for AP mode, which is what we’re seeing here. Therefore, we can easily create a WiFi hotspot.
In addition, most WiFi devices support one mode at a time. In other words, if the WiFi adapter is currently connected to a network, it might not be able to create the hotspot. However, there are WiFi adapters that support a feature called “soft AP” that allows us to create a hotspot and connect to a network simultaneously using the same WiFi adapter.
3. Network Manager
Network Manager is a powerful tool that lets us configure and manage various network interfaces including wired and wireless connections. It comes with nmcli, which is a front-end to Network Manager. We can use nmcli to quickly manage network connections.
Prior to creating a hotspot, we should first make sure that the Network Manager service is up and running:
$ sudo systemctl status NetworkManager.service
• NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; preset: disabled)
Active: active (running) since Sun 2023-11-19 01:23:05 PKT; 23h ago
In case it’s not running, we simply start it:
$ sudo systemctl start NetworkManager.service
3.1. Creating Hotspot
With nmcli, we can use a one-liner to create a WiFi hotspot:
$ sudo nmcli device wifi hotspot con-name t-450 ssid t-450 band bg password qw3rtyu1
Let’s see what’s happening here:
- device wifi specifies that we’re operating on a WiFi device
- hotspot signifies that we’re creating a hotspot access point
- con-name t-450 sets the connection name to be t-450
- ssid t-450 sets the SSID (Service Set Identifier) for the hotspot
- band bg specifies the radio band, where bg typically refers to the 2.4 GHz band
- password sets the password for the hotspot access point
Once the hotspot is created, we can see the entry for it on other devices:
Afterward, we can connect to it as if it’s a typical wireless access point.
3.2. Deleting Hotspot
When we no longer need the hotspot, we can remove it:
$ sudo nmcli connection delete t-450
Let’s break this down:
- connection signifies that we’re managing a network connection
- delete specifies that we’re deleting a connection, which is t-450 in this case
In this article, we learned how to create a WiFi hotspot access point in Linux. First, we checked whether the WiFi device supports hostapd, which allows us to create hotspot access points. Then, we delved into the creation process of a hotspot using the Network Manager utility.