Skip to content

Instantly share code, notes, and snippets.

@Semant1ka
Last active August 23, 2026 07:40
Show Gist options
  • Select an option

  • Save Semant1ka/ee087c2bd1fbf6b0287c3307b8d4f291 to your computer and use it in GitHub Desktop.

Select an option

Save Semant1ka/ee087c2bd1fbf6b0287c3307b8d4f291 to your computer and use it in GitHub Desktop.
How to set up WiFi hotspot and troubleshoot WiFi problems on Debian

There are a few decent tutorials on how to setup hotspot on Linux, which I will share below, but this tutorial will focus on adversities that you without doubt will face while setting up your AP.

For AP setup we will need:

  • Hostapd utility
  • Some dhcp utility
  • A bit of patience (that was for my case)

How do I know that my WiFi adapter supports AP mode?

In terminal type sudo iw list this command will show info about your wifi interfaces. Look for Supported interface entry, if AP is in it, that means your Wifi devices support hotspot mode.

Supported interface modes:
		 * IBSS
		 * managed
		 * AP
		 * AP/VLAN
		 * WDS
		 * monitor
		 * mesh point
		 * P2P-client
		 * P2P-GO

Okay, WiFi supports AP mode but not working!

Running sudo rfkill list usually the first thing I was running to troubleshoot WiFi. Command will output something like this:

0: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: yes
1: acer-wireless: Wireless LAN
    Soft blocked: yes
    Hard blocked: no

hard blocked

Usually means that you are screwed WiFi is disabled physically.

  • Try toggle WiFi button
  • Try enabling WiFi in BIOS

There is a chance that your Linux drivers can't handle WiFi button events properly, so try booting into Windows and enable WiFi from there.

soft blocked

Means that some software is blocking WiFi interface.

  • In most cases you can solve this by running
    sudo rfkill unblock %blocked_device_name_as_listed_in_rfkill_list%
    
  • If solution above not working consider checking for a driver problem, see link for more details.
  • If the problem persists after every reboot consider removing your WiFi interface from Network Manager.

Dealing with Network Manager

Network Manager is a super annoying service that is aimed to automate network configuration, unfortunately it might also cause problems with networking. At the sight of any uneven issues perform the steps below to remove your interface from Network Manager.

  1. Open /etc/NetworkManager/NetworkManager.conf and add lines

     [main]
     plugins=ifupdown,keyfile
     [ifupdown]
     managed=false
     [keyfile]
     unmanaged-devices=mac:ff:ff:ff:ff:ff:ff
    

    instead of mac:ff:ff:ff:ff:ff:ff type in your real device mac

  2. Restart Network Manager

     sudo service network-manager restart
    
  3. Open Network Manager GUI and check that you can't manage device your device

Now we can continue with hotspot set up.

Setting up WiFi hotspot with hostapd

  1. Install hostapd utility

    sudo apt-get install hostapd
    
  2. Create hostapd.conf in /etc/hostapd

    touch /etc/hostapd/hostapd.conf
    
  3. Add lines below to hostapd.conf. Meaning of most of them is obvious

    interface=wlan0
    channel=6
    ieee80211n=1
    hw_mode=g
    ssid=TEST
    wpa=2
    wpa_passphrase=p@$$w0rd
    wpa_key_mgmt=WPA-PSK
    rsn_pairwise=CCMP
    auth_algs=1
    

    Be carefull with ieee80211n=1 parameter. In most tutorials you will see driver=nl80211 , but parameter diver didn't work for me, presumably because I have atheros driver, but it might work for you if you have nl.

  4. Now you can check if your hotspot works properly run the command

    sudo hostapd -d /etc/hostapd/hostapd.conf
    

    -d enables full command output so if there are errors, you will see them.

    The issues that you can run into at this point are:

    • Hostapd is already running.
      nl80211: Could not configure driver mode
      nl80211 driver initialization failed.
      hostapd_free_hapd_data: Interface wlan0 wasn't started
      
      Check that hostapd is already running in the system.
      ps ax | grep hostapd
      
      If command above returned anything stop the service.
      sudo /etc/init.d/hostapd stop
      
      or
      sudo service hostapd stop
      
    • WiFi interface was soft blocked
      Configuration file: /etc/hostapd/hostapd.conf
      rfkill: WLAN soft blocked
      wlan0: Could not connect to kernel driver
      Using interface wlan0 with hwaddr ff:ff:ff:ff:ff:ff and ssid "TEST"
      Failed to set beacon parameters
      wlan0: Could not connect to kernel driver
      Interface initialization failed
      wlan0: interface state UNINITIALIZED->DISABLED
      wlan0: AP-DISABLED 
      wlan0: Unable to setup interface.
      hostapd_free_hapd_data: Interface wlan0 wasn't started
      
      This problem was described in the beginning of the article, so try running
      sudo rfkill unblock wlan
      
      Also you can try restarting WiFi
      sudo nmcli radio wifi off
      sudo nmcli radio wifi on
      

If hostapd started you will see that it is constanly writing log to terminal. You should be able to discover you AP with another device, but you won't be able to connect to it yet.

Now close the window with runnig service and check its status. There are few ways to do this:

sudo services hostapd status
sudo /etc/init.d/hostapd status

If service is stopped you can run it on background as a daemon with one of this commands:

sudo services hostapd start
sudo /etc/init.d/hostapd start

Setting up DHCP

Now you need to make your hotspot give all connected devices IP address for hotspot network. This can be achieved with DHCP service, I prefer isc-dhcp-server.

  • Install isc-dhcp-server sudo apt-get install isc-dhcp-server
  • Open dhcp config vim /etc/dhcp/dhcpd.conf. It contains a lot of entries with comments, but in most basic set up you will need to add lines specified below:
ddns-update-style none;
authoritative;

subnet 192.168.0.0 netmask 255.255.255.0 {
  interface wlan0; # your interface name here
  range 192.168.0.5 192.168.0.8; # desired ip range
  option routers 192.168.0.1;
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.0.255;
}
  • Save config and check it with command dhcpd -t /etc/dhcp/dhcpd.conf
  • Start service service isc-dhcp-server start and check if devices that are connected to hostpot can obtain IP addresses.

Check this good article for more info about DHCP

@adamfast

adamfast commented Jun 3, 2023

Copy link
Copy Markdown

dhcp -t /etc/dhcp/dhcpd.conf should be dhcp -t -cf /etc/dhcp/dhcpd.conf so that "/etc/dhcp/dhcpd.conf" is not used as the interface file but as a configuration file (found via https://www.braindisconnect.com/wiki/index.php/Linux_DHCP_Server)

@kimfom01

Copy link
Copy Markdown

Thank you for providing this comprehensive guide.

Is there a way to revert the changes?

@hreuver0183

hreuver0183 commented Aug 23, 2026

Copy link
Copy Markdown

I found this manual encouraging, although a little outdated. You wrote the manual in 2024, back then maintenance of isc-dhcp-server had just been dropped. Nowadays, using dnsmasq instead would make sense.
10 years ago any manual would begin with ifupdown, were you use Network-Manager, so I'd say you did a reasonable good job.
Ifupdown might still find some uses where you use headless arm-based computers as access point.

I did run into problems using nm since I tried to set up a 5GHz connection and that should be named in a manual.
Looking at: https://en.wikipedia.org/wiki/List_of_WLAN_channels you'll see that most 5GHz and 6GHz frequencies are only allowed for indooor use. For 5.6-5.7GHz you are allowed to use Wifi outside if you implement DFS (both in Europe and Canada). The openwrt has information (https://openwrt.org/docs/techref/dfs) and you might try https://github.com/Oaklight/openwrt-dfs-checker,

When trying to set up 5GHz you first should check the country. If "iw reg get" only returns "country 00: DFS-UNSET" you should fix that first, by finding a signed wireless-regdb and/or configuring the kernel for less strict CFG80211 handling. When the 5GHz hurdle is taken you can think of other issues.

That said:
ieee80211n uses 2.4GHz (wifi4)
ieee80211ac uses 5GHz-only (wifi5)
ieee80211ax uses 2.4 and 5GHz (wifi6)
Wifi6e and wifi7 can use 6GHz, but only a small band and only indoors.
For outdoor use, using an intel ax201 as base might therefore not limit the access point too much. For maximum speed use dedicated hardware. Using a mt7915 adapter instead of an mt7922 allows to use more antennas, for more bandwith with multiple users. It does not solve bandwith problems inside the router though.

(Where the mt7922 and rtl8852 might be able to freely use 5GHz as AP, intel does have limits as host and as client where I did not run into with either mediatek or realtek. You see lot's of problems with intel networking, both with the ax210 and the i225 intel needs 100% compliant routers and switches or the connection will fail! Still if you setup a wifi access point it should be compliant with the local laws.)

Using WPA3 should be standard 6 years after becoming mandatory. Setting the small gritty details can improve the speed by at least 5 times.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment