Windows OS Hub
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows 10
    • Windows Server 2025
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
    • Proxmox
  • PowerShell
  • Linux

 Windows OS Hub / Linux / Turn Linux Computer into Wi-Fi Access Point (Hotspot)

March 11, 2024

Turn Linux Computer into Wi-Fi Access Point (Hotspot)

In this article, we will show how to create a Wi-Fi access point (Software AP) on any computer or laptop running Linux and equipped with a wireless adapter. You can use this access point (hotspot) to create a wireless local network in a small office or at home, or to share mobile Internet with other devices. In this example, we are using a laptop running the latest version of Ubuntu.

Contents:
  • How to Create Wi-Fi Hotspot from Ubuntu GUI?
  • Configure Wireless Access Point with Network Manager (nmcli) on Linux
  • Using Hostapd to Set Up a Virtual WiFi Access Point on Linux

First, make sure that your wireless Wi-Fi module supports an Access Point (AP) mode. To do it, install iw package:

$ sudo apt install iw

The iw tool is used to configure wireless interfaces (nl80211 driver) from the command prompt. It supports all new drivers recently added to the Linux kernel. The old iwconfig tool, which uses the Wireless Extensions interface, is deprecated, so it is strongly recommended that you use iw and nl80211 instead.

Run the command below:

$ iw list

iw: check supported wireless inerface modes

In the Supported interface modes section, look for

  • AP
  • AP/VLAN

It means that your Wi-Fi adapter supports operation in the access point mode.

How to Create Wi-Fi Hotspot from Ubuntu GUI?

On Ubuntu 20.04 LTS and newer with GNOME (3.28+), you can run a wireless access point from the graphic interface. This is the easiest method for the average user.

Click the network connection icon and select Turn On Wi-Fi Hotspot in the Wi-Fi settings.

Wi-Fi settings in Gnome on Ubuntu

Turn On Wi-Fi Hotspot on Ubuntu

Enter the access point name and connection key (password)

Set the SSID (name) and the password for the Wireless Access Point

You should see a message that your access point is active. The same window contains a QR code to connect to your Wi-Fi access point.

generate wi-fi qr code on linux

Configure Wireless Access Point with Network Manager (nmcli) on Linux

Network Manager can be used to manage network connections in most modern Linux distros (Ubuntu, Debian, Mint, Fedora, CentOS, etc.). In this example, we will show how to create a software access point on Linux using the Network Manager and nmcli command line tool.

First, you need to find out the name of your wireless adapter in the system.

$ nmcli d

get wireless adapter name on ubuntu linux

In our example, the name of the Wi-Fi adapter is wlp4s0b1.

If dnsmasq (a light-weight DHCP/DNS server) is installed on your computer, you must disable it. It will conflict with the dnsmasq plugin in the NetworkManager.

To create an access point on the wlp4s0b1 interface with the network name (SSID) WOSHubWiFi and a network key (password) MaxPass21, run the commands below:

# nmcli con add type wifi ifname wlp4s0b1 mode ap con-name MyHomeWiFI ssid WOSHubWiFi
# nmcli con modify MyHomeWiFI 802-11-wireless.band bg
# nmcli con modify MyHomeWiFI 802-11-wireless.channel 1
# nmcli con modify MyHomeWiFI 802-11-wireless-security.key-mgmt wpa-psk
# nmcli con modify MyHomeWiFI 802-11-wireless-security.proto rsn
# nmcli con modify MyHomeWiFI 802-11-wireless-security.group ccmp
# nmcli con modify MyHomeWiFI 802-11-wireless-security.pairwise ccmp
# nmcli con modify MyHomeWiFI 802-11-wireless-security.psk MaxPass21
# nmcli con modify MyHomeWiFI ipv4.method shared

Start your hotspot:
# nmcli con up WOSHubWiFi

Use nmcli on ubuntu to start wireless hotspot

If you want the access point to operate at 5GHz and use a higher channel, change the corresponding commands to:

# nmcli con modify MyHomeWiFI 802-11-wireless.band a
# nmcli con modify MyHomeWiFI 802-11-wireless.channel 35

By default, the built-in DHCP server in the NetworkManager assigns IP addresses to clients from the 10.42.0.x/24 range (and the 10.24.0.1 is the address of your hotspot interface). You can change the DCHP range:

# nmcli con modify MyHomeWiFI ipv4.addr 192.168.31.1/24

To disable the access point, run this command:

# nmcli con down MyHomeWiFI

For complete removal of software hotspot on Linux:

# nmcli con delete MyHomeWiFI

Using Hostapd to Set Up a Virtual WiFi Access Point on Linux

A popular tool for creating a Wi-Fi access point on Linux computers is the hostapd package. Install it:

$ sudo apt install hostapd

Copy the original configuration file (/etc/hostapd/hostapd.conf). Add the following configuration to hostapd.conf:

$ sudo nano /etc/hostapd/hostapd.conf

interface= wlp4s0b1
# The nl80211 driver is suitable for most Wi-Fi adapters
driver=nl80211
# Your access point name
ssid=MyHomeAP
# The number of your Wi-Fi channel (1 to 13)
channel=11
#Select a mode for your access point (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
hw_mode=g
# 1=wpa, 2=wep, 3=both
auth_algs=1
# Allow connections from all MAC addresses except those in the blacklist
macaddr_acl=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
#Set a password for your access point
wpa_passphrase=MyPass321
If you want to use 802.11 n mode, make the changes below:

ieee80211n=1
ht_capab=[HT40-][SHORT-GI-40]

Unmask the hostpad service:

$ sudo systemctl unmask hostapd

Then specify the path to your configuration file in the DAEMON_CONF parameter of /etc/default/hostapd file:

$ sudo nano /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

configure hostapd on linux

Then configure your wireless network interface. Set a static IP address, DNS, mode, and other options. Edit the /etc/network/interfaces file and add the following:

# nano /etc/network/interfaces

auto wlp3s0
iface wlp3s0 inet static
address 10.10.0.1
netmask 255.255.255.0

You will also need it to prevent NetworkManager from interfering with the Wi-Fi interface. After saving the settings, restart your computer.

Then you just have to configure a DHCP server that will assign IP addresses to the devices connecting to your Linux access point. In our example, we will use a light-weight dnsmasq:

$ sudo apt install dnsmasq

Edit dnsmasq.conf. Specify that dnsmasq will run on the wlp4s0b1 interface and assign IP addresses from the 10.10.0.x range. In the simplest case, you may have the following configuration:

$ sudo nano /etc/dnsmasq/dnsmasq.conf

interface=wlp4s0b1
dhcp-range=10.10.0.2,10.10.0.100,12h
#Set DNS servers
server=/www.google.com/8.8.8.8
The DHCP range IP addresses must belong to the same network as your WLAN adapter.

In order for your Linux host can route packets between the Wi-Fi clients and an external Internet connection, you need to enable the routing and add the corresponding rule to iptables:

sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o enp3s0 -j MASQUERADE
You can also use the bridge interface to provide Internet access to clients from your local network (we will leave this out to keep the article short).

Start these services:

# systemctl start dnsmasq.service
# systemctl start hosapd

Now you can connect to your access point from any client, check that it has received an IP address from the specified DHCP range and that it can access the Internet.

Find out how to set up a Wi-Fi access point on a Windows computer.
2 comments
8
Facebook Twitter Google + Pinterest
Linux
previous post
Updating PowerShell Version on Windows
next post
Running Simple HTTP Web Server Using PowerShell

Related Reading

Fixing ‘The Network Path Was Not Found’ 0x80070035...

August 31, 2023

How to Fix the ‘Too Many Open Files’...

March 13, 2024

Recovering Files from BitLocker Encrypted Drive

March 13, 2024

How to Use Ansible to Manage Windows Machines

March 12, 2024

How to Access VMFS Datastore from Linux, Windows,...

March 11, 2024

Using iPerf to Test Network Speed and Bandwidth

March 12, 2024

How to Increase Size of Disk Partition in...

March 11, 2024

Moving WSL to Another Drive in Windows

March 11, 2024

2 comments

Merlin September 20, 2023 - 11:26 am

Thanks a lot for this post.
Do you know what are the pros/cons using hostapd vs networkManager ?
or do you have any documentation highlighting this diffrences ?

Reply
ratnoyfpdbo October 30, 2024 - 12:26 pm

Should not still be using TKIP in 2024. it’s been condemned for over a decade. Use only CCMP.

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Encrypt Any Client-Server App Traffic on Windows with Stunnel

    June 12, 2025
  • Failed to Open the Group Policy Object on a Computer

    June 2, 2025
  • Remote Desktop Printing with RD Easy Print Redirection

    June 2, 2025
  • Disable the Lock Screen Widgets in Windows 11

    May 26, 2025
  • Configuring Windows Protected Print Mode (WPP)

    May 19, 2025
  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Fixing ‘The Network Path Was Not Found’ 0x80070035 Error Code on Windows
  • Recovering Files from BitLocker Encrypted Drive
  • Installing an Open Source KMS Server (Vlmcsd) on Linux
  • How to Access VMFS Datastore from Linux, Windows, or ESXi
  • Install Any OS from ISO Image over Network with iVentoy
  • Using iPerf to Test Network Speed and Bandwidth
  • Moving WSL to Another Drive in Windows
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top