WiFi AP (RT5370) on Raspberry Pi

26.02.2017: Howto tested & working πŸ™‚

Today, we will look at howto create AP hotspot on Raspberry Pi usingΒ Ralink RT5370 chipset (see previous article).

First step should be update your repositories and update system to lastest:

sudo aptitude update; sudo aptitude -y upgrade

Then, reboot will be good thing to do..

sudo shutdown -r now

After boot, login, run sudo su – and lsusb command and you should see something like this:

pi@raspberrypi ~ $ sudo su -
root@raspberrypi:~# lsusb
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
Bus 001 Device 004: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter

Install hostapd and dnsmasq:

aptitude install hostapd dnsmasq

Edit file with network settings to some static IP of wlan0:

nano /etc/network/interfaces

And wlan0 section should like:

allow-hotplug wlan0
iface wlan0 inet static
  address 192.168.100.1
  netmask 255.255.255.0

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet manual

(close nano with Ctrl+X, then Y and Enter)

After that, get down and up wlan0 interface and check, if you have your IP set it up on interface

ifdown wlan0; ifup wlan0
ifconfig wlan0 # this command should wrote these informations

# as you can see, there is right IP
wlan0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

Create new configuration for hostapd in /etc/hostapd/hostapd.conf and put there this info:

# you can create it with command
nano /etc/hostapd/hostapd.conf

#write info below into file
interface=wlan0
driver=nl80211
ssid=RaspberryPi_AP
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=Your_fav_super_password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Edit files /etc/default/hostapd and uncomment DAEMON_CONF, and add path to config. So line will looks like this:

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

Then, you can finally restart hostapd, and you have your hotspot up and running.

/etc/init.d/hostapd restart

# allow hostapd after boot
update-rc.d hostapd enable

Your hotspot is running, but you need to run some DHCP client for your clients which will use your hotspot. Edit and change these parameters in dnsmasq (and restart it):

#edit dnsmasq by following command
nano /etc/dnsmasq.conf

#find and change following parameters.. (or you can add these on end of the file 
interface=wlan0Β 
except-interface=eth0
dhcp-range=192.168.100.2,192.168.100.150,255.255.255.0,12h

# restart dnsmasq
/etc/init.d/dnsmasq restart

# allow dnsmasq after boot
update-rc.d dnsmasq enable

Then, you need to do NAT.. so..

#edit file /etc/sysctl.conf and uncomment this line
net.ipv4.ip_forward=1

# run this command to load it
sysctl -p

#run these command for allow forwarding..
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

# save iptables to file which will load after start
iptables-save > /etc/iptables.nat

# create file with forwarding in /etc/network/if-up.d
echo '#!/bin/bash' > /etc/network/if-up.d/forwarding; echo 'iptables-restore < /etc/iptables.nat' >> /etc/network/if-up.d/forwarding; chmod +x /etc/network/if-up.d/forwarding

I found problem after reboot (and hostapd start) that wlan0 doesnt have IP assigned. You can solve it by chage fileΒ /etc/default/ifplugd and change it like this:

INTERFACES="eth0"
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

Source:Β http://elinux.org/RPI-Wireless-Hotspot

Help with hostapd and IP:Β http://sirlagz.net/2013/02/10/how-to-use-the-raspberry-pi-as-a-wireless-access-pointrouter-part-3b/

63 thoughts on “WiFi AP (RT5370) on Raspberry Pi”

  1. It’s awesome that you are guiding peepz with process, and I really appreciate it! I did ran into a problem setting up my rPI for AP and that is panda wireless’s RT5370!! I tired to put it as NL80211 and it did not work.

  2. I have to admit, after long investigating I ended up with exact the same setup as above (plus, control on tx power – in /etc/network/interfaces add up line
    “up iwconfig wlan0 txpower 1mW”).

    Just, time to time, at reboot or unplugging accidentally wlan0 (!!), wireless interface doesn’t seems to pick up either the IP address or the power saving configs.
    In any of these case, hostapd won’t work.

    Tried ifup/ifdown/ifconfig wlan0 up [+down], changed file configs… nothing.

    Ok, sounds very little professional, but keep rebooting and don’t lose faith πŸ™‚
    Yesterday night I’ve been out of luck; this morning worked at the first attempt; later in the afternoon took me only five reboots before having it run! (with no config changes!! Might be the air moisture…)
    Now, ask me whether I’m going to touch it again?!?

    Have fun!

    1. Hi Michele,

      did you checked dmesg and /var/log/messages? It can tell you why it’s not up πŸ™‚

  3. Uh, thank you for the extra quick reply!
    Actually, I was lazy enough to try just
    tail /var/log/messages and nothing was in there – to be fully honest, I was a bit pi**ed and I KNEW it HAD to work, since it was working until a few seconds before I shut down the “server”, minutes earlier.
    So, restart after restart, and coffee after coffee I ran 2AM…

    Nevertheless I knew from first setup that something wasn’t playing nice between hostapd and/or dnsmasq and/or this particular card (Ralink Technology, Corp. RT5370 Wireless Adapter) and/or the low-power setup (running under solar panel, every mW counts!).
    Struggle a little with configs again, shut down some services here and there and, as best practice, I postponed to the next day.

    It worked, indeed, with no human intervention other than a good nap πŸ™‚

    Have a good 2015!

    1. Hi,

      yea, sometimes debugging is really hard πŸ™‚ My Rpi is as “XBMC / Airplay” behind my TV last months.. so I didn’t play with it for some time πŸ™

      Sometimes only a good nap is the best solution.

      To you too! πŸ™‚

  4. Ronny,
    I *unfortunately* had to switch off everything again, and *again* had to struggle with the interface not coming up.
    In a matter of fact I could bring it down and up with “service networking stop/start”, but the tx power wouldn’t be handled anymore.

    For further references, /etc/netoworking/interfaces on wlan0 looks like this:

    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.7.111
    netmask 255.255.255.0
    wireless-power off
    up iwconfig wlan0 txpower 1mW

    To make a long story short (actually, I tried to cut it short from the very beginning!) I realized the only problem is that, for unknown and uninvestigated reason, wlan0 doesn’t come up with an IP address and

    $sudo ifconfig bla bla bla

    doesn’t seems to work.

    But, ladies and gentleman, the answer is:

    —>>>> sudo su <<<—
    #ifconfig wlan0 192.168.7.111

    (of course everything else had to work on its own… hostapd, dnsmasq, iptables settled down right, etc…)

    Have fun.

    1. Hi Michele,
      and did you tried part of article where is “I found problem after reboot”? πŸ™‚

      Otherwise, I am going to find some free SD card (and time) this week to test your txpower option.. πŸ™‚

      1. Haha, it seems I’m quite often *living* this part of article πŸ™‚

        But, as for spending my best professional skills, I kept rebooting until tea chilled off. Then, after a good sip&nap, I thought that # and $ are two different things and I was right πŸ™‚

        Leave the SD where it is, and take care of your loved one πŸ˜‰
        (more, in private… haha)

  5. I have RPi2 (RT5370) follow each step but just after do this:

    /etc/init.d/hostapd restart

    I get:
    [ok] Stopping advanced IEEE 802.11 management: hostapd.
    [FAIL] Starting advanced IEEE 802.11 management: hostapd failed!

    I really apreciete your help

    Regards

    1. Hi,

      open one more window with PuTTy (or which program are you using to SSH to your Pi) and do this “sudo tail -f /var/log/messages”. Then open second window and restart hostapd and check what shows up in first window with log.

  6. Hi, i did it your way step by step, have the same wifi stick etc.

    I get no errors, but when i search for wifi on my smartphone, the rpi won’t show up πŸ™

    1. Hi,

      can you send logs and configuration (without any password) to pastebin and link it here?

  7. i have successfully created a access point with my raspberry pi 2 but i am unable to connect with it from other devices… plz help

  8. i have no idea how many attempts I’ve done at this – and yours worked. I think it was the except-interface=eth0 part that did it.

    thanks!

  9. when I run the command “/etc/init.d/dnsmasq restart” I get the following error:
    “Restarting dnsmasq (via systemctl): dnsmasq.serviceJob for dnsmasq.service failed. See ‘systemctl status dnsmasq.service’ and ‘journalctl -xn’ for details.”

    The Pi is connect to an existing router via a cable and has a RT5370 USB dongle. Can’t find any AP. Any thoughts?

      1. The output is:

        root@raspberrypi:~# systemctl status dnsmasq.service
        ● dnsmasq.service – dnsmasq – A lightweight DHCP and caching DNS server
        Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled)
        Drop-In: /run/systemd/generator/dnsmasq.service.d
        └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
        Active: failed (Result: exit-code) since Sun 2016-01-10 08:24:46 UTC; 32s ago
        Process: 28629 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
        Process: 28626 ExecStartPre=/usr/sbin/dnsmasq –test (code=exited, status=0/SUCCESS)

        Jan 10 08:24:46 raspberrypi dnsmasq[28626]: dnsmasq: syntax check OK.
        Jan 10 08:24:46 raspberrypi dnsmasq[28629]: dnsmasq: failed to bind DHCP server socket: Address already in use
        Jan 10 08:24:46 raspberrypi systemd[1]: dnsmasq.service: control process exited, code=exited status=2
        Jan 10 08:24:46 raspberrypi systemd[1]: Failed to start dnsmasq – A lightweight DHCP and caching DNS server.
        Jan 10 08:24:46 raspberrypi systemd[1]: Unit dnsmasq.service entered failed state.

  10. Re-installing Jessie (Lite) fixed this issue.

    I tried to make an AP from my PI several different ways. Probably an existing DHCP server was interfering with dnsmasq.

    1. Hi,

      yes, according to log “Jan 10 08:24:46 raspberrypi dnsmasq[28629]: dnsmasq: failed to bind DHCP server socket: Address already in use” there was something on that port πŸ™‚ but great to hear that you solve that!

      1. Hi,
        Can you explain how to fix that error?
        My log :-
        ● dnsmasq.service – dnsmasq – A lightweight DHCP and caching DNS server
        Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled)
        Drop-In: /run/systemd/generator/dnsmasq.service.d
        └─50-dnsmasq-$named.conf, 50-insserv.conf-$named.conf
        Active: failed (Result: exit-code) since Mon 2016-07-25 12:12:59 EAT; 2s ago
        Process: 4118 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=2)
        Process: 4114 ExecStartPre=/usr/sbin/dnsmasq –test (code=exited, status=0/SUCCESS)

        Jul 25 12:12:59 Richardpi dnsmasq[4114]: dnsmasq: syntax check OK.
        Jul 25 12:12:59 Richardpi dnsmasq[4118]: dnsmasq: failed to bind DHCP server socket: Address already in use
        Jul 25 12:12:59 Richardpi dnsmasq[4118]: failed to bind DHCP server socket: Address already in use
        Jul 25 12:12:59 Richardpi dnsmasq[4118]: FAILED to start up
        Jul 25 12:12:59 Richardpi systemd[1]: dnsmasq.service: control process exited, code=exited status=2
        Jul 25 12:12:59 Richardpi systemd[1]: Failed to start dnsmasq – A lightweight DHCP and caching DNS server.
        Jul 25 12:12:59 Richardpi systemd[1]: Unit dnsmasq.service entered failed state.

        1. Hi Richard!

          Something is running on port 67.

          Could you try to do systemctl stop dnsmasq.service and then netstat -tulnp | grep :67 ?

          It should show you if something is listening on that port

  11. my /etc/network/interfaces file reads differently to yours, I can’t find a reference to wpa-roam at all. Will this be an issue? Using a rpi 2 B with raspian wheezy. This is how my file reads:

    auto lo
    iface lo inet loopback

    autho eth0
    allow-hotplug eth0
    iface eth0 inet manuak

    autowlan0
    allow-hotplug wlan0
    iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    auto wlan1
    allow-hotplug wlan1
    iface wlan1 inet manual
    wap-conf /etc/wpa-supplicant/wpa_supplicant.conf

    If you can please help me that would be great, I want to move forward with your tutorial but want to know if this will create any issues, or if something needs to be added to the file before progressing.
    Thanks! – Todd

    1. Hi,

      then just comment wpa-conf line, they most probably rename it in configuration.

    2. Hi!
      I comming on your post (redirected from a french topic) to make a hotspot with my raspberrypi (found at this address if it can help you
      https://www.raspberrypi.org/forums/viewtopic.php?f=65&t=138772)

      I have some questions because i have small differences, and don’t want to make some mistakes, and hope i give you here maximum information about what I have and where I am.

      I’m a newbie in linux systems so thank you to learn me!

      I see that Todd AK have also Wlan0 and wlan1, but i don’t understand the answers give to him from ronny about wpa-conf line

      my case is;
      – I have my wlan0 to take internet wireless with an alfa awus036h (500mw)
      – I want to give internet (with wlan1 DWA-140) to other gadgets (computer, smartphone, chromecast, and maybe other by example wifi home automation but that is for later…), and hope “simultaneously” connected.

      Here is what I have in hardware equipment;

      – raspberrypi model B Rev 2 (i think it is second edition, he have already some years ago, HDMI, 2xUSB, Ethernet, audio, … ) with Jessie installed on it. (Jessie with desktop view found here:
      http://downloads.raspberrypi.org/raspbian/images/raspbian-2017-07-05/)

      – External USB antenna AFLA AWUS036H b/g (the 500mw version but i dont think it’s important for here), using the driver/chipset (what difference between that?) RTL8187 that it seems to be automaticly recognized by the system, and I don’t had to install anything about it.
      https://wikidevi.com/wiki/Wireless_adapters/Chipset_table
      This one will be used as wlan0, and take internet from the operator box

      – External USB antenna D-Link DWA-140 B2 b/g/n and can work as acces point AP, using i think the RALINK RT3070 and think that it can accept simultaneous client connections.
      Here too i don’t had need to install, seems auto recognition too.
      https://wikidevi.com/wiki/Wireless_adapters/Chipset_table

      – I dont think i need to tell you what about keybord and all, but for information i have a USB splitter with her own power that i use temporary to configure all this.
      After all that, i just take out this splitter, the keyboard, the mouse, and all, and just plug the power to the raspberry in, and the two USB antennas(hope the power will be ok for it but that’s for later…)

      So, where I am Actually:

      I have follow this guide above,
      I can get internet from my router by ethernet (eth0)
      and
      I can give it to my wlan1 USB dwa-140 dongle b/g/n and it seems that works fine!(except speed connection but will try later to change the channel, and then hide the SSID, but again, that’s for later, step by step )
      I just have change all your wlan0 into wlan1, because my DWA-140 is apparently on wlan1.

      so it looks like that:
      Operator Box(internet) Raspberry <– wlan1 USB DWA-140 AP <== Smartphone, computer,…

      I want to change it into:

      Operator Box(internet) Raspberry <– wlan1 USB DWA-140 AP <== Smartphone, computer,…

      Is it clear to understand?

      At the first time, if i change all "eth0" into "wlan0", will it work?
      and how do i specify to wlan0 to connect to "My_Home_Wifi" with my wpa passphrase and all?

      I dont tried it, i don't want to make mistakes about configuration. It's already about some days that i tried to do an acces point and this guide seems the only working for me from two days, coool !
      eth0 will not be plugged in after this will work.

      Also, for later too, i want, if possible (but i'm sure it is ;-p ), to acces my operator box trough this Raspberry. My Operator box Ip Adress is like 192.168.1.1
      I think it is better to configure my provider box to assign manually a reserved ip address for My Pi (connected with wlan0). Do i need to configure something specifically on the Pi side ? i think not…

      For the little story about why i want this, it is because i want to have internet acces into my wood house far in my garden, but the connection isn't going so far.
      And why i want to acces to my router so far, it is because 1) i have a HDD connected to my provider box, and 2), i want also able to configure my provider box from there if needed…

      With my AFLA AWUS036H and a directional cantenna that a friend make for me, i can get the signal inside my wood hut and it's pretty good (actually the far point we have tested is around 1,2kilometer (+- 0,746mile). Thank's to my electronic friend but he is not a geek into linux πŸ˜€ )

      So, do you need some other informations about my configuration and all?

      By the way, in somes files edited, i think i have view things about IPv6. What about? what avantage/utility?

      So, I thank you in advance for lighting/helping me, and hope my english is understandable πŸ˜‰

      1. Hi,

        Thanks for comment :). I understand you, you want to connect to internet from wlan0 and share it thru wlan1.

        So first, you need to follow some guide how to connect to your provider with wlan0 (something like this – http://weworkweplay.com/play/automatically-connect-a-raspberry-pi-to-a-wifi-network/). Then, you should follow this guide, but change eth0 to wlan0 and wlan0 to wlan1. So in the end /etc/network/interfaces will have 2 sections. One with wlan0 and wlan1. Let me know if it works πŸ™‚

        1. Hi Ronny!

          thanks for your answer.

          before you reply i have try some things and after nothings work, so have made a fresh clean install on the sd card…

          i will try what you propose me (i havent read the link at this time), but i have forget to specify a thing.

          you are right that i want :
          internet from wlan0 to wlan1

          Is it also possible to get internet from wlan0 to give it to
          wlan1 AND eth0 too?

          i will try first what you propose me tonight and give you a feedback, be sure…
          if you need some files tell me wich one πŸ˜‰

          thank’s πŸ˜‰

          1. Hi,

            yes. I think it will be possible to also share it thru eth0 πŸ™‚ Did you set it up sucessfully so far?

          2. Hi Ronny.

            Sorry for the late, I try it only yesterday night, I had some priorities first.

            Yes I try the automatic configuration to my wifi.
            I do it step by step then save my SD every time.

            At the first time it will work,
            Reboot, work, few hours, no internet by wifi but connected.

            I don’t have make my access point yet because even if wlan0 was connected to my provider router, I haven’t internet.

            So, the next step is for tommorow night to retry to autoconfigure wlan0 again, then configure wlan1 and I will you tell you what about don’t worry, I’m not the kind of guy who take info and don’t say thanks, I’m the kind of guy who like sharing when it works…

  12. Not working at all!
    Maybe you could be a little more clear with the instructions. Rather than using the ROOT comand, it would be easier for us noobe’s if it was in ssh.

    Getting ready to reload Rasbian onto SD….

    1. Hi wizard!

      How I can be clear with instructions? Which part? What and where is used ROOT command? All its done via ssh πŸ™‚

    1. Thanks for comment! I actually should review whole howto if it’s still valid πŸ™‚

  13. I wave problem with TL-WN722N

    Erro:

    root@arm:~# hostapd /etc/hostapd/hostapd.conf
    Configuration file: /etc/hostapd/hostapd.conf
    nl80211: Could not configure driver mode
    nl80211: deinit ifname=wlan0 disabled_11b_rates=0
    nl80211 driver initialization failed.
    wlan0: interface state UNINITIALIZED->DISABLED
    wlan0: AP-DISABLED
    hostapd_free_hapd_data: Interface wlan0 wasn’t started

    The device is working, but i can’t configure it was AP.

  14. Hey guys, so I followed the instructions and so far all it does is disable my wifi all together. The error I get is that “No wireless interfaces found”.

    Here is my interfaces file

    auto lo
    iface lo inet loopback auto eth0

    auto eth0
    allow-hotplug eth0
    iface eth0 inet manual

    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.100.1
    netmask 255.255.255.0

    iface default inet manual

    Thanks for your help

  15. lsusb:

    Bus 001 Device 006: ID 148f:5370 Ralink Technology, Corp. RT5370 Wireless Adapter
    Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
    Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
    Bus 001 Device 001: ID ld6b:0002 Linux Foundation 2.0 root hub

    lshw: no command found, cant connect to install it

    Thanks

    1. Hm.. I will try to get it working over weekend.. and let you know if howto is still working or not πŸ™‚

          1. Hi,

            so I was trying that.. and I get this after I edit my /etc/network/interfaces:
            root@raspberrypi:~# ifconfig wlan0
            wlan0 Link encap:Ethernet HWaddr 00:12:b4:a1:5a:59
            inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
            UP BROADCAST MULTICAST MTU:1500 Metric:1
            RX packets:0 errors:0 dropped:0 overruns:0 frame:0
            TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
            collisions:0 txqueuelen:1000
            RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

            What is your output of ifconfig wlan0?

  16. wlan0 Link encap:Ethernet HWaddr 00:0f:60:04:ec:b6
    inet addr:192.168.100.1 Bcast:192.168.100.255 Mask:255.255.255.0
    intet6 addr: fe80::8960:892f:c401:cde1/64 Scope:Link
    UP BROADCAST MULTICAST MTU:1500 Metric:1
    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
    collisions:0 txqueuelen:1000
    RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

      1. When I go through the tutorial, No hotspot is created. My wifi and ethernet on the PI is gone as well. It says that no wireless interfaces can be found. Thanks

        1. But according to your last answer with ifconfig wlan0, there is wlan0 activated πŸ™‚ in which part of howto it fails?

          1. This is why its so weird because all the diagnostics show wlan0 is up and running.

            The interface first cuts out when I run

            ifdown wlan0; ifup wlan0

            Thanks

          2. Can you show me ifconfig -a and also you are connected thru ethernet or wifi?

  17. I followed all all your instructions. I have it working but when i clone the img to another card i get no network interface. I have tried everything…

    any suggestions would be greatly appreciated!

    1. Hi, it should work if you have adapter plugged.. I will try that at home and let you know

      1. I fixed it. I am mixing with another package and somewhere i did something to make it not work. I have no clue where. I started from a fresh jessie img and only did the AP setup and cloned it and worked fine.
        Thanks!

  18. Hi guys please HELP! I tried this on retropie and it’s working, but I can’t make it to work on raspbian jessie lite -__-

    Log says no servers found for dnsmasq on boot. I have to restart dnsmasq in order for it to work properly but I can’t scan it over the network. I manually added server on dnsmasq.conf, rebooted and error was still there, I tried added resolv-file=/source but still no avail.

    1. Hi Miko,

      I think best and quickest solution will be try whole howto again (best in clean installation), because it was working well week ago, when I was trying that on latest Raspbian πŸ™‚

  19. Hi. I have my RPi AP setup according to your instructions. The RPi AP is attached via ethernet to my home modem/router. When I execute “/etc/init.d/hostapd restart” the network SSID shows up on my other devices and everything works fine for a little while… sometimes after a few hours or maybe a few days the SSID no longer shows up. To get it to work again I have to connect via SSH (the RPi still shows up in my modem/router’s client list) and re-execute “/etc/init.d/hostapd restart,” and the RPi AP’s SSID shows up and life is good again.

    How do I avoid having to SSH and restart hostapd all the time? Is it a problem with my wifi adapter (TL-WN722N)?

    Note 1: simply rebooting RPi doesn’t work, I always have to manually restart hostapd.

    Note 2: Also, I’ve run “service –status-all” while the problem is occurring and both hostpad and dnsmasq are still running.

    Note 3: ifconfig shows that wlan0 always has the correct IP address 192.168.100.1.

    Note 4: Running “ping -I wlan0 192.168.100.1” both before (when SSID is not showing up) and after hostapd restart gives the same successful ping results.

    Here is an output from my log while executing “/etc/init.d/hostapd restart”:

    root@pi:~# sudo tail -f /var/log/messages
    Aug 20 06:25:08 pi rsyslogd: [origin software=”rsyslogd” swVersion=”8.4.2″ x-pid=”459″ x-info=”http://www.rsyslog.com”] rsyslogd was HUPed
    Aug 20 11:47:17 pi kernel: [35307.854693] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    Aug 20 11:47:18 pi kernel: [35308.793377] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready

    I don’t know why hostapd fails on its own so frequently or how to check that it’s down other than noticing the SSID not showing up on other devices. Could you please help with:

    1. How to discovery why the SSID drops from time to time requiring the hostapd restart?
    2. If this is not possible, how to have the RPi AP check on itself if it is working (broadcasting SSID and other devices able to connect) then I can have a cron check if it’s working and if not simply restart hostapd (sort of like a scheduled self-test which executes restart if needed)?

    1. Hi,

      did you execute “update-rc.d hostapd enable”? Because hotspotd should start after reboot or it’s doesn’t work after reboot (hostapd running, but SSID is not up)?

      When you see SSID missing, could you check systemctl status hostapd.service what logs will be there at last before restart?

      You can for sure restart hostapd in cron, but don’t know on which trigger so far (how to recongnize, that AP is down).

  20. Thanks for the reply!

    How do you execute “update-rc.d hostapd enable?” Is this simply typed into the command line? That is what I did when I got to this step in your instructions.

    In the meantime I will check systemctl status hostapd.service next time the problem arrises.

    1. Ad. update-rc.d: Yes, if you are root, you do not need to call sudo πŸ™‚ (sudo is command to call command as root). Let me know your findings πŸ™‚

  21. Hi,

    anyone tried “iw list | grep netlink” and got output?

    Would be interesting to see if the drivers are compatible with Netlink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.