Saturday, 28 May 2016 11:47

Raspberry PI 3 Auto WiFi Hotspot if no Internet

Written by 
  • Author Type: Individual
  • Operating System: Raspbian
  • Country: UK

I'm using a Raspberry Pi 3 which i want to connect to via SSH from my Android tablet or phone when i am not in range of my home router.

My requirements are for when the pi is at home it connects to my home router or other known routers so it is available on the local network. If no router is found when it is started up then it will create a wifi hotspot, which is not rooted to the Internet, so i can SSH to the RPi from another device and control the camera and run other custom scripts.

This article is not the latest version of the AutoHotspot script, two new versions are now available.

 

 

Previously i could do this by creating an adhoc hotspot on my Android Nexus tablet and set the Raspberry Pi to connect to the Tablet if the home network was not in range. In google's infinite wisdom they dropped this feature for my Nexus tablet in the Android Marshmallow update, meaning i could no longer connect to my pi when i was out and about.

The other solution is for the RPi to create a wifi hotspot and connect my tablet to that. Most tutorials for hotspot setup on the pi are for creating an access point to the internet via the Raspberry pi which is not what I require.
I use my pi for photography amongst other things when im out and about, so i don't need internet access just a direct connection to control the Raspberry Pi via SSH from my tablet.

UPDATE:

This article has been updated as some commands became depreciated, it also uses the more recent systemd start-up process rather than rc.local.

The original script is available here for reference purposes.

If you are using the rc.local script and wish to use this article then just restore the original rc.local file, shown in the original article, and then follow on from "Start-up Script"

 

 This tutorial is the solution I used based on parts of other tutorials i have found online.

Aim:

Raspberry Pi searches for known router's (SSID)

If the router is not found then it creates a hotspot so tablets, phones and computers can connect to the Raspberry Pi's WiFi hotspot, which is not routed to the internet but allows a connection via SSH, VNC etc.

(Internet will not be available via Ethernet either while the hotspot is active but will be restored after a reboot and a known router is in range.)

Requirements:

Raspberry Pi 3, Raspberry Pi ZeroW or other Raspberry Pi with WiFi dongle*

Internet Connection

WiFi connection already set-up to your local router or any routers you are using with this script

*some WiFi dongles don't work in adhoc mode or don't work with with the nl80211 driver used in this guide, so you may want to check this first before starting.

 

Step1:

To start with hostapd hotspot client and dnsmasq lightweight dns server need to be installed.

Open a Terminal session.

Update Raspbian with the latest updates by entering the commands:

sudo apt-get update

sudo apt-get upgrade

 To install hostapd enter the command:

sudo apt-get install hostapd

enter Y when prompted.

To install dnsmasq enter the command:

sudo apt-get install dnsmasq

enter Y when prompted

The installers will have set up the programme so they run when the pi is started. For this setup they only need to be started if the home router is not found. So automatic startup needs to be disabled. This is done with the following commands:

sudo systemctl disable hostapd

sudo systemctl disable dnsmasq

Now the hostspot configuration file can be setup. This contains the name of the WiFi signal you will need to connect to (SSID) and the security password.

To edit the configuration files I will be using the nano text editor but if you prefer an editor with an point and click interface then replace nano with leafpad in the following instructions.

Hostapd Configuration

Using a text editor edit the hostapd configuration file. This file won't exist at this stage so will be blank.

sudo nano /etc/hostapd/hostapd.conf

enter or paste the settings:

interface=wlan0
driver=nl80211
ssid=RPI3hot
hw_mode=g
channel=6
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=1234567890
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

  • The interface will be wlan0
  • The driver nl80211 works with the Raspberry Pi 3 onboard WiFi but you will need to check that your wifi dongle is compatable and can use Access Point mode.

For more information on wifi dongles see elinux.org/RPi_USB_Wi-Fi_Adapters

  • The SSID is the name of the WiFi signal broadcast from the RPi, which you will connect to with your Tablet or phones WiFi settings.
  • Channel can be set between 1 and 13. If you are having trouble connection because of to many wifi signals in your area are using channel 6 then try another channel.
  • Wpa_passphrase is the password you will need to enter when you first connect a device to your Raspberry Pi's hotspot. This should be at least 8 characters and a bit more difficult to guess than my example.

To save the config file press ctrl & o and to exit nano press Ctrl & x

Now the defaults file needs to be updated to point to where the config file is stored.
In terminal enter the command
sudo nano /etc/default/hostapd

Change:
#DAEMON_CONF=""
to
DAEMON_CONF="/etc/hostapd/hostapd.conf"

And save.


dnsmasq configuration

Next dnsmasq need to be configured to allow the PI to act as a router and issue IP addresses.

sudo nano /etc/dnsmasq.conf

Go to the bottom of the file and add the following lines

#Pi3Hotspot Config
#stop DNSmasq from using resolv.conf
no-resolv
#Interface to use
interface=wlan0
bind-interfaces
dhcp-range=10.0.0.3,10.0.0.20,12h

And then save (ctrl & o) and exit (ctrl & x)

Step2:

Now that hostapd and dnsmasq are configured we now need to make some changes to the interfaces file and then add a script that will detect if you are at home or not.

Next we need to edit the interfaces file. There will be several entries already in the file. Look for references to Wlan0 and alter them as below.
Any reference to wpa_conf for wlan0 should be disabled by putting a # at the start of the line.

Open the interfaces file with the command

sudo nano /etc/network/interfaces

edit the following lines as below

auto lo wlan0
iface lo inet loopback

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

now save (ctrl & o) and exit (ctrl & x)

 

Required only if:

if your home routers SSID and password was listed in this file then the hotspot will probably not get generated.

 

You will need to put a # infront of each line

#iface wlan0 inet dhcp
#       wpa-ssid "mySSID"
#       wpa-psk "Router Pasword"

These details need to be in the wpa_supplicant.conf file to work with this setup.

Add your router details to the wpa_supplicant.conf file with 

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

and add the following commands to the bottom of the file.

network={
        ssid="mySSID"
        psk="Router Password"
        key_mgmt=WPA-PSK
}

If in the future you change your router connection details with the WiFi icon by the clock then check that the changes have been made to the wpa_supplicant.conf file and not the /etc/network/interfaces file.

Note: Change "mySSID" to the ssid of your router and "Router Password" to the password of your router.

Start-up Script

The final stage is to setup the startup-scripts using the systemd process.

if you have been updating Raspbian Jessie and not used a recent image you may not have some wifi tools installed.

just chek you have iw installed with

dpkg -s iw

If it is not found then install it with

sudo apt-get install iw

 

This script will check what routers are available when the RPi. The first router found in the wifi settings will be connected to using existing configured WiFi settings. If no know routers are in range then a WiFi hotspot is created.

Create the start-up script in a new file in /usr/bin/

sudo nano /usr/bin/autohotspot

 

Enter this script. (last modified 30th May 2017)


#!/bin/bash
#RaspberryConnect.com
#Wifi config - if no prefered Wifi generate a hotspot
#This two lines check for any SSIDs in your RPi's wifi settings
wpassid=$(awk '/ssid="/{ print $0 }' /etc/wpa_supplicant/wpa_supplicant.conf | awk -F'ssid=' '{ print $2 }' ORS=' ' | sed 's/\"/''/g')
ssids=($wpassid)
#or check a restricted list of SSID,s that are setup. 
#Put a # infront of the two lines above first; #ssids=$(awk..... & ssids=($wpassid)
#Enter one or more ssids that are already setup in the wifi settings
#Remove # below to use. separate SSIDs by a space, ('mySSID1' 'mySSID2')
#ssids=('myssid1')
#Main script
createAdHocNetwork()
{
    ip link set dev wlan0 down
    ip a add 10.0.0.5/24 dev wlan0
    ip link set dev wlan0 up
    systemctl start dnsmasq
    systemctl start hostapd
}
connected=false
for ssid in "${ssids[@]}"
do
    if iw dev wlan0 scan ap-force | grep "$ssid" > /dev/null
    then
        wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf > /dev/null 2>&1
        if dhclient -1 wlan0
        then
            connected=true
            break
        else
            wpa_cli terminate
            break
        fi
    else
        echo "Not in range, WiFi with SSID:" $ssid
    fi
done
    if ! $connected; then
    createAdHocNetwork
fi

One of the lines of the script may go off the right side of the webpage alternately this script is available to download here

The line reads:

ssids=$(awk '/ssid="/{ print $0 }' /etc/wpa_supplicant/wpa_supplicant.conf | awk -F'ssid=' '{ print $2 }' ORS=' ' | sed 's/\"/''/g')

Thanks to Tino for this code

 

The line starting with ssids=$(awk.... lists all routers in the Raspberry Pi's wifi settings. If you need to restrict this to only certain SSID's currently setup then put a # infront of the ssid=$(awk... line to deactivate it and also the line ssids=($wpassid). Then remove the # infront of #ssids=('myssid1')

then in the line ssids=('myssid1')
replace 'myssid1' with the SSID of your router.

in the UK common SSIDs are in the format of SKY12345, BTHub-1234, TalkTalk12345, VM123456, plusnet1234 etc

If you access other routers then enter them, with single quotes and a space between each entry. The script will try each one and make a connection to the first one that is available.

Then save (ctrl & o) and exit (ctrl & x)

 

make the autohotspot script executable with the command

sudo chmod +x /usr/bin/autohotspot

Next add a service file to systemd.
Create a file in /etc/systemd/system and add the service file

sudo nano /etc/systemd/system/autohotspot.service

 

Enter the script

[Unit]
Description=Generates a non-internet Hotspot for ssh when a listed ssid is not in range.
After=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/autohotspot
[Install]
WantedBy=multi-user.target

 

Then save (ctrl & o) and exit (ctrl & x)

This service file can be downloaded here

now enable the Hotspot service with the command

sudo systemctl enable autohotspot.service

 If you use a Hidden SSID...

If your router does not broadcast the ssid the /usr/bin/autohotspot script will not find your router and always go to a hotspot. By scanning for your MAC address instead of your SSID the script will work.

Your mac address will be printed on your router somewhere in the format XX:XX:XX:XX:XX:XX using letters and numbers.

It can alternately by found using the command

sudo iw wlan0 scan | egrep "BSS|SSID"

Which will return all the routers in range, the top one should be your router.

(My routers ssid is not hidden so you won't see the ssid but my results were as follows)

BSS XX:XX:XX:XX:XX:XX(on wlan0) -- associated
    SSID: XXXXXXXX
    BSS Load:

where X is the address results.

Once your know your MAC address the following changes can be made to the /usr/bin/autohotspot script.

Change:

#enter required ssids: ssids=('ssid1' 'ssid2')
ssids=('mySSID1' 'mySSID2')

for

#enter required MAC Addr: macAdresses=('XX:XX:XX:XX:XX:XX' 'YY:YY:YY:YY:YY:YY')
macAdresses=('MyRouterMACAdress')

 

change:

for ssid in "${ssids[@]}"
do
    if iw dev wlan0 scan ap-force | grep "$ssid" > /dev/null

for

for macAdress in "${macAdresses[@]}"
do
if iw dev wlan0 scan ap-force | grep "$macAdress" > /dev/null

and change

echo "Not in range, WiFi with SSID:" $ssid

for

echo "Not in range, WiFi with MAC:" $macAdress

 

The Router detection should now work for you.

Thanks to Willem Me for supplying these modifications.

 

Testing the Hostspot


To test if the hotspot is being created edit the /usr/bin/autohotspot file again and change your SSID to something else such as mySSID1off

ssids=( 'mySSID1' 'mySSID2' ) to ssids=( 'mySSID1off' 'mySSID2off' )

Save the /usr/bin/autohotspot file and then reboot.

When the desktop loads the WiFi network icon in the top right corner will be two screens instead of the usual WiFi icon.

RPIwifihotspot-wifi

When the mouse is placed over the icon is should show a popup displaying the RPI3hot access point.

RPIwifihotspot-AP

 

Check the WiFi signals in range with the wifi settings on a Laptop, tablet or Phone and you should see that one of them is RPI3hot

wifisignal-android

 

Select RPI3hot as the WiFi signal to connect to. The security password will be the one you set in the hostapd.conf file.

From my example that would be 1234567890.

Now you are connected to the Raspberry Pi's hotspot and you can now open a SSH connection as usual using the IP address 10.0.0.5

Once your happy it is all working, reset the SSID entry back to your routers SSID and your ready to go.

 

This setup has been tested on a Raspberry Pi 2 and PiZero with a WiFi dongle and with a Raspberry Pi 3 and PiZero W all running Raspbian Jessie. 

Wifi and Hotspot Auto Switch Script

I have an alternative script that can switch between wifi and a hotspot without rebooting using a timer or manually.

Details are in this article Raspberry Pi - Auto WiFi Hotspot Switch

Removal

If you no longer require this script then it can easily be disabled without affecting your set-up.

Restore your wifi startup by editing the /etc/network/interfaces file and removing the # from the line # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Then disable the startup script with the command

sudo systemctl disable autohotspot

After a reboot your RPI will connect to your router.

 

Note:

Dnsmasq bug: in versions below 2.77 there is a recent bug that may cause the hotspot not to start. This can be resolved by removing the dns-root-data.

check your version with : dpkg -s dnsmasq

versions 2.77 and above are ok. If not then try the command:

sudo apt-get purge dns-root-data

thanks to danny for highlighting this.

 

 

 

Find the latest and greatest embedded system development kits and boards at Arrow.com!

 

 

 

Last modified on Saturday, 08 July 2017 11:02
Google
roboberry

RapberryConnect.com SuperUser.  Contactable via the site admin e-mail in the Contact Us link.

Website: www.raspberryconnect.com

Leave a comment

Comments for Guest and account owners. Account owners will need to login to use registered e-mail address.

134 comments

  • Comment Link Roboberry Monday, 02 October 2017 20:47 posted by Roboberry

    Hi John, this article is out of date, the latest versions are available by following the links at the top of the article.

    Non association is usually caused when there is an issue in the network configuration or settings.

    If you have used the script in this article with Raspbian Stretch that was released in August then it won't work as there has been changes in the network setup. use lsb_release -a to see what version you have. Im working on a fix for the latest versions but it is not ready yet.

    If you are using Raspbian jessie it depends when you get the error. If it when you should be connecting to your router then check your password in wpa_supplicant is ok. If your SSID contains special characters other than space, such as a ' then it may not work.

    If it is during the hostspot then enter sudo systemctl status hostapd and sudo systemctl status dnsmasq and look for errors.

    and you can also run autohotspot manually and see what response it gives you.
    sudo /usr/bin/aoutohotspot

    if you can give me more details about your issue I will look into it further.

    Report
  • Comment Link John Monday, 02 October 2017 07:34 posted by John

    Hi, my wlan0 returns not associated why is that?

    Report
  • Comment Link Graeme Saturday, 23 September 2017 21:47 posted by Graeme

    Hi Matt

    Unfortunately the scripts don't work with Raspbian Stretch that has just been released and will be used on NOOBS, until I can resolve some issue it causes. When you had it working you would have been using Raspbian Jessie

    Part of the changes is the interfaces file is blank, it can be populated with the same details but the script is far from stable with the recent changes to the network setup.

    So for now you would need to try and get a Jessie image until I can get it working on Stretch.


    by the way this article is the old script so also outdated. There are some links at the top of this page to take you to the new scripts for Jessie

    Report
  • Comment Link Matt Saturday, 23 September 2017 12:51 posted by Matt

    Hi,

    Thanks for posting this tutorial - I managed to get it working first time and I am a TOTAL novice.

    However......

    Somehow I fried my SD card and I have had to reinstall with NOOBS downloaded from the main site. When I try to re-install your hotspot system I get as far as the '/etc/network/interfaces' section where you say to change any reference to Wlan0. However, the interfaces file has NO REFERENCE to Wlan0 - infact it is pretty much empty. All it contains is:



    # interfaces(5) file used by ifup(8) and ifdown(8)

    # Please note that this file is written to be used with dhcpcd
    # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

    # Include files from /etc/network/interfaces.d:
    source-directory /etc/network/interfaces.d



    I've had a poke around in the directory (not changed anything) with the thought that an upgrade to hostapd or dnsmasq may have happened in the interim but I really don't have the knowledge to figure this out on my own.

    Have I completely fouled it up somehow when I fried my SD card? As I said, it worked perfectly first time round and its the exact thing I need for my RPi as I always have my laptop with me and don't want to have to carry a keyboard and monitor as well just to be able to use my RPi.

    I'm using a RPi3 with NOOBS version 2.4.4 installed.

    Please help someone!!

    Cheers,
    Matt.

    Report
  • Comment Link Graeme Friday, 07 July 2017 22:39 posted by Graeme

    hi mive, glad you got it working. Slow connections are a bit of a problem.

    I don't think the systemd process can wait for specific devices but you can use a timer script that will start N seconds/minutes after boot up. You will need to set up a authotspot.timer in /etc/systemd/system/ that triggers the autohotspot.service but disable the autohotspot.service so that the timer starts it.

    Try this first, change the current service file so it runs the autohotspot script a little later in the bootup process. In place of After=network-online.target use After=multi-user.target it will give you a few more seconds for wlan0 to become available.

    I have just upgraded my script and process with a new article which can auto generate a internet hotspot. And i'm just finishing the upgrade to the non internet version so the script in this article will be discontinued.
    The new script is more robust and should be available this weekend.

    Thanks for the reference in your program, much appreciated.

    Report
  • Comment Link mive Friday, 07 July 2017 12:35 posted by mive

    First of all, thank you very much,
    got it working in the meantime, just needed to ensure that the network interface is available (atheros thingy works with nl80211 driver as AP). It seems it is not the fastest wlan dongle regarding intialization (dont know better words to describe the behaviour, sorry).

    Btw, do you maybe know if systemd service unit supports specifying a network interface like wlan0, then I could use that instead nasty workarounds in script?

    for reference, here the slightly changed python scipt which waits for wlan0 device and set interface up (because sometimes I got a error 100, "device not ready" or something similar, hopefully this fixes this behaviour)

    Best regards,


    Python script:

    #!/usr/bin/python3

    #
    # ===============================================================================================================
    #
    # autohotspot.py: connects either to known router in range or creates access point if no router in range
    #
    # Author: Michael Vetter
    # Date: 07.07.2017
    # based on: http://www.raspberryconnect.com/network/item/315-rpi3-auto-wifi-hotspot-if-no-internet
    #
    # thanks to: "roboberry" from http://www.raspberryconnect.com for the whole idea and shell script, on which this
    # python script is based.
    #
    # ===============================================================================================================
    #

    import subprocess,os
    from datetime import datetime as dt
    import argparse
    from time import sleep

    def ts():
    return(dt.now().strftime("%Y%m%d_%H%M%S"))

    def logerror(e):
    with open(args.logfolder+"/autohotspot_error.log","a") as f:
    f.write(ts()+": "+str(e)+"\n")

    def shell(cmd):
    std = subprocess.getstatusoutput(cmd)
    if std[0] != 0:
    logerror("Error: "+std[1]+" (command was: "+cmd+" Errorcode: "+str(std[0])+")")
    return(False)
    else:
    return(True)


    class Main:
    def __init__(self,ssids,interface):
    self.connected = False
    self.count = 0
    self.wlanfound = False
    self.interface = interface
    while self.wlanfound == False and self.count ssid(self,ssids):
    self.interface_up()

    self.systemctl("deactivate")
    for ssid in ssids:
    result = shell("iw dev "+self.interface+" scan ap-force | grep '"+ssid+"'")
    if result:
    #cmd = "wpa_supplicant -B -i "+self.interface+" -c /etc/wpa_supplicant/wpa_supplicant.conf"
    cmd = "/sbin/wpa_supplicant -s -B -P /run/wpa_supplicant."+self.interface+".pid -i "+self.interface+" -D nl80211 -c /etc/wpa_supplicant/wpa_supplicant.conf"
    std = subprocess.getstatusoutput(cmd)
    if std[0] == 255: # already connected
    logerror("wpa_supplicant : already connected "+std[1])
    self.connected = True
    break # maybe use return instead
    elif std[0] != 0:
    logerror("Error: "+std[1]+" (command was: "+cmd+" Errorcode: "+str(std[0])+")")
    else:
    result = shell("dhclient -1 "+self.interface)
    if result:
    self.connected = True
    break
    if self.connected == False:
    self.count = 0 # reset counter
    self.create_ap()


    if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument(
    "-s", "--ssids", nargs="+",
    help="Specifiy ssids with this parameter and avoid reading them from /etc/wpa_supplicant/wpa_supplicant_conf"
    )
    parser.add_argument(
    "-i", "--interface", default="wlan0",
    help="WIFI Interface (default wlan0)"
    )
    parser.add_argument(
    "-l", "--logfolder", default=os.getenv("HOME"),
    help="Folder where log file is created (default /root)"
    )
    args = parser.parse_args()
    if args.logfolder.endswith("/"): args.logfolder = args.logfolder.rstrip("/");
    Main(args.ssids,args.interface)

    Report
  • Comment Link Graeme Thursday, 06 July 2017 20:00 posted by Graeme

    Hi Mive, as long as your Wifi dongle uses the nl80211 driver you will be fine. But you need to check. Have you set up my script and process and if so can you confirm if it works or not? I can only resolve issues relating to my script so not able to help with issues in your python code.

    All your error are to do with wlan0 not being found so the issue is about your wifi dongle setup. The commands are trying to access the device wlan0 but it does not exist or wlan0 has been deactivated and not available when the commands are run.


    looking at http://elinux.org/RPi_USB_Wi-Fi_Adaptersit seems your dongle uses its own hardware so probably not compatible with the driver. In the hostapd.conf file put a # in front of driver=nl80211 to ignore this line, but you need to see why wlan0 is not available and at what stage it is lost.

    Report
  • Comment Link mive Thursday, 06 July 2017 14:47 posted by mive

    Hi, thanks for the reply,
    first off all I have an Atheros AR9271 dongle
    mv@raspberrypi:~ $ lsusb
    Bus 001 Device 006: ID 0846:9030 NetGear, Inc. WNA1100 Wireless-N 150 [Atheros AR9271]
    ...
    this thingy should support AP (Access Point) Mode
    iw list | grep -iA 10 "Supported interface"
    Supported interface modes:
    * IBSS
    * managed
    * AP
    * AP/VLAN
    * monitor
    * mesh point
    * P2P-client
    * P2P-GO
    * Unknown mode (11)

    In the meantime I was partially successful in connecting to home ssid and also in creating a independent hotspot. Uunfortunately, it isnt reliable, sometimes I'm connected to home ssid, sometimes not. I dont understand why. If i run (changed) script manually it seems to work after login. My pi is usually running headless so this is not an option

    Configs:
    CONFS=("/etc/hostapd/hostapd.conf" "/etc/default/hostapd" "/etc/dnsmasq.conf" "/etc/network/interfaces"); for i in ${CONFS[*]}; do printf "\n\n====> Config File: $i:\n\n%s\n" "$(grep -v \# $i)"; done


    ====> Config File: /etc/hostapd/hostapd.conf:

    interface=wlan0
    driver=nl80211
    ssid=PiHotSpot
    hw_mode=g
    channel=6
    wmm_enabled=0
    macaddr_acl=0
    auth_algs=1
    ignore_broadcast_ssid=0
    wpa=2
    wpa_passphrase=1234567890
    wpa_key_mgmt=WPA-PSK
    wpa_pairwise=TKIP
    rsn_pairwise=CCMP


    ====> Config File: /etc/default/hostapd:

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


    ====> Config File: /etc/dnsmasq.conf:

    no-resolv
    interface=wlan0
    bind-interfaces
    dhcp-range=10.0.0.3,10.0.0.20,12h


    ====> Config File: /etc/network/interfaces:

    iface eth0 inet dhcp

    source-directory /etc/network/interfaces.d

    auto lo wlan0
    iface lo inet loopback
    allow-hotplug wlan0
    iface wlan0 inet manual

    autohotspot scipt (slightly changed,, python)
    #!/usr/bin/python3

    import subprocess,os
    from datetime import datetime as dt
    import argparse

    def ts():
    return(dt.now().strftime("%Y%m%d_%H%M%S"))

    def logerror(e):
    #with open(os.getenv("HOME")+"/autohotspot_error.log","w") as f: # open root home folder and stores log there
    with open("/home/mv/autohotspot_error.log","a") as f:
    f.write(ts()+": "+str(e)+"\n")

    class Main:
    def __init__(self,ssids):
    self.connected = False
    if ssids is None: ssids = self.getssids();
    self.connect_to_ssid(ssids)

    def getssids(self):
    with open("/etc/wpa_supplicant/wpa_supplicant.conf") as f:
    lines = f.read().split("\n")
    ssids = [ i.lstrip("\t").strip(" ").split("ssid=")[1].strip('"') for i in lines if "ssid=" in i and i.startswith("#") != True ] # strip,strip,split,strip not nice, used to ensure ssid without tabs (\t), spaces or " TODO: rework
    return ssids

    def systemctl(self,chstate):
    svc = ["hostapd.service","dnsmasq.service"]
    if chstate == "activate":
    cmd = "systemctl start "
    elif chstate == "deactivate":
    cmd = "systemctl stop "
    else:
    logerror("systemctl Wrong Statement (use either activate or deactivate)")
    return

    for v in svc:
    std = subprocess.getstatusoutput(cmd+v)
    if std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+v+" Errocode: "+str(std[0])+")")

    def create_ap(self):
    cmd = "ip link set dev wlan0 down"
    std = subprocess.getstatusoutput(cmd)
    if std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+" Errocode: "+str(std[0])+")")

    cmd = "ip a add 10.0.0.5/24 dev wlan0"
    std = subprocess.getstatusoutput(cmd)
    if std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+" Errocode: "+str(std[0])+")")

    cmd = "ip link set dev wlan0 up"
    std = subprocess.getstatusoutput(cmd)
    if std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+" Errocode: "+str(std[0])+")")

    self.systemctl("activate")

    def connect_to_ssid(self,ssids):
    self.systemctl("deactivate")
    for ssid in ssids:
    cmd = "iw dev wlan0 scan ap-force | grep '"+ssid+"'"
    std = subprocess.getstatusoutput(cmd)
    if std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+" Errocode: "+str(std[0])+")")
    else:
    cmd = "wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf"
    std = subprocess.getstatusoutput(cmd)
    if std[0] == 255: # already connected
    logerror("wpa_supplicant : already connected "+std[1])
    return
    elif std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+" Errocode: "+str(std[0])+")")
    else:
    cmd = "dhclient -1 wlan0"
    std = subprocess.getstatusoutput(cmd)
    if std[0] != 0:
    logerror("Error "+std[1]+" (command was: "+cmd+" Errocode: "+str(std[0])+")")
    else:
    self.connected = True
    #break # loop already left
    if self.connected == False:
    self.create_ap()


    if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("-s", "--ssids", nargs="+",
    help="Specifiy ssids with this parameter and avoid reading them from /etc/wpa_supplicant/wpa_supplicant_conf"
    )
    args = parser.parse_args()
    Main(args.ssids)

    autohotspot_error.log:
    20170706_152135: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'FRITZ!Box Fon WLAN 7360' Errocode: 1)
    20170706_152136: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net' Errocode: 1)
    20170706_152136: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'Max_Home_Office' Errocode: 1)
    20170706_152136: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net 2' Errocode: 1)
    20170706_152136: Error Cannot find device "wlan0" (command was: ip link set dev wlan0 down Errocode: 1)
    20170706_152136: Error Cannot find device "wlan0" (command was: ip a add 10.0.0.5/24 dev wlan0 Errocode: 1)
    20170706_152136: Error Cannot find device "wlan0" (command was: ip link set dev wlan0 up Errocode: 1)
    20170706_152430: Error (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net' Errocode: 1)
    20170706_152441: Error (command was: iw dev wlan0 scan ap-force | grep 'Max_Home_Office' Errocode: 1)
    20170706_152452: Error (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net 2' Errocode: 1)
    20170706_152626: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'FRITZ!Box Fon WLAN 7360' Errocode: 1)
    20170706_152626: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net' Errocode: 1)
    20170706_152626: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'Max_Home_Office' Errocode: 1)
    20170706_152626: Error command failed: No such device (-19) (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net 2' Errocode: 1)
    20170706_152626: Error Cannot find device "wlan0" (command was: ip link set dev wlan0 down Errocode: 1)
    20170706_152626: Error Cannot find device "wlan0" (command was: ip a add 10.0.0.5/24 dev wlan0 Errocode: 1)
    20170706_152627: Error Cannot find device "wlan0" (command was: ip link set dev wlan0 up Errocode: 1)
    20170706_152827: Error (command was: iw dev wlan0 scan ap-force | grep 'test' Errocode: 1)
    20170706_153135: Error (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net' Errocode: 1)
    20170706_153147: Error (command was: iw dev wlan0 scan ap-force | grep 'Max_Home_Office' Errocode: 1)
    20170706_153158: Error (command was: iw dev wlan0 scan ap-force | grep 'Klein Wireless Net 2' Errocode: 1)

    Always when I get the device not found (-19) error it wont work, strangly this does not happen alway ? _:veryconfused

    best regards,

    sorry for bad english

    Report
  • Comment Link Graeme Wednesday, 05 July 2017 19:12 posted by Graeme

    Hi mive, it looks like you have a config error. dnsmasq has failed, as a result the autohotspot script can't setup the hotspot.
    enter sudo systemctl status -l dnsmasq and have a look why it has failed. Also double check your /etc/dnsmasq.conf file is correct and your /etc/network/interfaces file.

    also sudo systemctl status -l autohotspot will give you more detail as wlan0 is not available for use.

    Let me know if no luck with the results of these statuses and I will look into it further

    Report
  • Comment Link mive Wednesday, 05 July 2017 15:43 posted by mive

    ...sorry wrong email address before...

    doesnt work for me, only partial when executing the script after login (connecting to home router/ssid works then, hotspot dont work, other devices wont see raspberry hotspot)

    I get this errors in syslog:
    ....
    Jul 5 15:49:59 raspberrypi autohotspot[611]: command failed: No such device (-19)
    Jul 5 15:49:59 raspberrypi autohotspot[611]: command failed: No such device (-19)
    Jul 5 15:49:59 raspberrypi autohotspot[611]: command failed: No such device (-19)
    Jul 5 15:49:59 raspberrypi autohotspot[611]: command failed: No such device (-19)
    Jul 5 15:49:59 raspberrypi autohotspot[611]: command failed: No such device (-19)
    Jul 5 15:53:10 raspberrypi autohotspot[611]: Cannot find device "wlan0"
    Jul 5 15:53:10 raspberrypi autohotspot[611]: Cannot find device "wlan0"
    Jul 5 15:53:10 raspberrypi autohotspot[611]: Cannot find device "wlan0"
    Jul 5 15:53:10 raspberrypi autohotspot[611]: Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service' and 'journalctl -xn' for details.
    Jul 5 15:57:48 raspberrypi autohotspot[481]: command failed: No such device (-19)
    Jul 5 15:57:48 raspberrypi autohotspot[481]: command failed: No such device (-19)
    Jul 5 15:57:48 raspberrypi autohotspot[481]: command failed: No such device (-19)
    Jul 5 15:57:49 raspberrypi autohotspot[481]: command failed: No such device (-19)
    Jul 5 15:57:49 raspberrypi autohotspot[481]: command failed: No such device (-19)
    Jul 5 15:57:49 raspberrypi autohotspot[481]: Cannot find device "wlan0"
    Jul 5 15:57:49 raspberrypi autohotspot[481]: Cannot find device "wlan0"
    Jul 5 15:57:49 raspberrypi autohotspot[481]: Cannot find device "wlan0"
    Jul 5 15:58:03 raspberrypi autohotspot[481]: Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service' and 'journalctl -xn' for details.
    Jul 5 16:00:06 raspberrypi autohotspot[489]: command failed: No such device (-19)
    Jul 5 16:00:07 raspberrypi autohotspot[489]: command failed: No such device (-19)
    Jul 5 16:00:07 raspberrypi autohotspot[489]: command failed: No such device (-19)
    Jul 5 16:00:07 raspberrypi autohotspot[489]: command failed: No such device (-19)
    Jul 5 16:00:07 raspberrypi autohotspot[489]: command failed: No such device (-19)
    Jul 5 16:00:07 raspberrypi autohotspot[489]: Cannot find device "wlan0"
    Jul 5 16:00:07 raspberrypi autohotspot[489]: Cannot find device "wlan0"
    Jul 5 16:00:07 raspberrypi autohotspot[489]: Cannot find device "wlan0"
    Jul 5 16:00:07 raspberrypi autohotspot[489]: Job for dnsmasq.service failed. See 'systemctl status dnsmasq.service' and 'journalctl -xn' for details.

    Report
  • Comment Link Graeme Sunday, 25 June 2017 12:59 posted by Graeme

    Hi Joe, Thanks for the feedback, glad you find it useful. That's a useful feature to add wifi networks as it has to be done manually.
    The other script, autohotspot switch, would allow you to then switch from hotspot to wifi without a reboot if you re-run the script once wpa_supplicant is updated. it's also a bit more robust. I will put updating this script soon to make it more robust and also adding a new one with an internet hotspot.

    Report
  • Comment Link Graeme Sunday, 25 June 2017 12:32 posted by Graeme

    HI Robm, I have a new script and setup that is being tested at the moment that adds internet routing to the hotspot, this may solve your issue but involves different config so not usable with the current setup. I have not used the current scripts with IOS so don't know how it responds. In hotspot mode the pi has always uses ip 169.254.71.151 on all my pi's. I hope to put the new scripts up in the next two weeks I will try to run it through IOS and see what’s going on.

    Report
  • Comment Link Joe Morris Saturday, 24 June 2017 15:01 posted by Joe Morris

    Many thanks for this. I have been playing for days with all of the AP options trying to make them work.

    Your solution is so simple and it worked the very first time.

    I am using it a little differently though. I am developing a product for the retail marketplace. ON initial boot there won't be a valid SSID in wpa_supplicant.conf. So after boot the user calls up a simple config web page, enters the info, the web page updates the wpa_supplicant conf file and then reboots. Absolutely wonderful!!

    Thanks again!! I just wish that I had found your post days ago! :)

    Joe

    Report
  • Comment Link RobM Friday, 23 June 2017 02:38 posted by RobM

    Thank you for the tutorial.I'm using it with the RPi-Cam-Web-Interface. Is it possible to configure so a gateway/router ip is issued with the dhcp? I can connect via Android, but not my IOS 10.x devices("No Internet Connection" error). IOS device gets IP Address (169.254.132.x) and Subnet Mask 255.255.0.0, but no router address. I believe IOS has to get an router address to finish the connection to the RPi. I am able to successfully connect to Wi-Fi enabled action camera with the same IOS devices. only difference is that action cameraa connection shows a router address (that is being issued by the action cam. Thank you in advance!

    Report
  • Comment Link Edwin M Sunday, 18 June 2017 19:09 posted by Edwin M

    Alright thank you for the speedy response I will try it

    Report
  • Comment Link Graeme Sunday, 18 June 2017 15:05 posted by Graeme

    Hi Edwin M if you are trying to remove the script then all you need to do is follow the removal section. To get it working try redoing the command sudo chmod +x /usr/bin/autohotspot as the script may not be running. Also enter sudo systemctl status autohotspot it will say it is dead but show the time it run. If it doesn't show it run try to re-enable it. Your welcome to email me with more details to find the issue.

    Report
  • Comment Link Edwin M Sunday, 18 June 2017 11:12 posted by Edwin M

    Okay so I need to get my wifi back and I followed the directions yet my wifi isn't working anymore nor will my pi 3 want to see any network connection

    Report
  • Comment Link Graeme Wednesday, 07 June 2017 20:03 posted by Graeme

    Hi Berk, I do intend on do that one, not something I currently need but appreciate there is a interest in that set-up. I will bump that one up the list and put something together soon.

    Thanks for your interest.
    UPDATE: I now have a working version that does route to the net. I will need to test it for a bit before I share it.

    Report
  • Comment Link Berk Wednesday, 07 June 2017 15:05 posted by Berk

    Hello,

    Thank you for this usefull tutorial work perfectly fine. I've read it's already asked but i would like to connect my action camera to raspberry with hotspot(which is working) and my raspberry to internet via ethernet or usign usb 3g router i guess it's(wwan0). As you already said you have other projects to do just asking have you got the chance to look this up?

    Report
  • Comment Link Graeme Friday, 02 June 2017 20:50 posted by Graeme

    Hi Kevin, have a check that the script has been saved. In a terminal window enter; ls /usr/bin/auto*
    you should see the autohotspot file listed. if not save the autohotspot script again. If it is there try the chmod command again. otherwise navigate to the folder with
    cd /usr/bin then try sudo chmod +x autohotspot
    The script wont be able to run unless this is done. just to check that chmod worked you can enter the command;
    ls -g autoh* or ls -g /usr/bin/autoh*
    you should get a result like this -rwxr-xr-x 1 root 2477 Jun 2 20:27 autohotspot
    the X's in the results means it worked.

    Report
  • Comment Link Kevin Friday, 02 June 2017 00:20 posted by Kevin

    when I typed in the "sudo chmod +x /usr/bin/autohotspot" command, it said it could find the file in the directory. Nothing else after it worked.

    Report
  • Comment Link Graeme Wednesday, 31 May 2017 21:21 posted by Graeme

    Hi David G, Yes this setup will allow you to access your RPi from your laptop. On the Laptop select RPI3Hot as the wifi network to connect to. Then you can use ssh with pi@10.0.0.5 to connect to the pi. You can also enter 10.0.0.5 in your laptops webbrowser to access the webserver website. If the PI is setup to be able to connect to your router it will always connect to that if it is in range rather than generate a hotspot.

    If you do connect the RPi to a router at times that will always be in range and want to force a AP then it can be done with other scripts I have. Let me know if that’s the case.

    Report
  • Comment Link David Goadby Wednesday, 31 May 2017 15:55 posted by David Goadby

    Can I set-up an AP for a laptop to connect to the RPi only?
    I have a LAMP stack running on the RPi which has a simple LCD display ie no X or GUI. I would like to use a wifi connected laptop to access the web server on the RPi for configuration purposes. That is to say no LAN access or Internet access is required - just localhost really.

    Report
  • Comment Link Graeme Tuesday, 23 May 2017 23:10 posted by Graeme

    hi ScottSammarco, I hope you can get your years back, i had similar issues creating the script so I know how you feel. The red X's will appear if hostapd is down or the wifi is down. If you hover over them is should say Disassociated from RPi3Hot. As you have checked this all to death it may not be something simple but I just need to know some things to see where we are at. What is the status of hostapd sudo systemctl status -l hostapd. and is iw installed ok dpkg -s iw should say status installed ok.
    if you get no clues from this or you have already covered this your welcome to e-mail me your config files and scripts and I will try them on my pi3. Or email me more details and I will look into it.

    Report
  • Comment Link Graeme Tuesday, 23 May 2017 20:30 posted by Graeme

    Hi Dan, sound like the issue is with dnsmasq. if it's not working you will get the hostpot but no ip address. check it's status when the hotspot is running. sudo systemctl status -l dnsmasq
    hopefully that will show an error or that it is not working,inactive(dead). Try manually starting it with sudo systemctl start dnsmasq. If the pi issues an IP after that then check the autohotspot script in the CreateAdHocNetwork() section. if no luck email me more details and i will see what I can do.

    Report
  • Comment Link ScottSammarco Tuesday, 23 May 2017 20:07 posted by ScottSammarco

    Afternoon,

    I found your tutorial helpful but I have ran into an issue.

    After double and triple checking for typos like hostapad and other silly mistakes, I am sure I lost a few years off of my lifespan. I have combed through the comments thinking that somebody else has a similar problem and other people did but the given solutions never helped me fix mine.

    I have the correct SSID of my router and I know because as I change it, I lose connectivity. However, when I reboot my rpi I do NOT see you screens but I do see two lines with a red X. I am using a RPi3 and followed your directions explicitly.

    I have also tried omitting the type of driver to you but this has made no difference.

    Is anybody else having this problem? or found a fix for it?

    Report
  • Comment Link Dan Monday, 22 May 2017 13:50 posted by Dan

    Hi Graeme, i think u misunderstood my question (http://www.raspberryconnect.com/network/item/315-raspberry-pi-3-auto-wifi-hotspot-if-no-internet#comment3928) When i connect with my Laptop (win7) or Android-Tablet or iPhone to my RaspberryPi-Hotspot, my connecting devices (laptop/Tablet/iPhone) don't automatically get an IP-adress from the Pi!


    I always have to set the IP-adress myself manually within the range 10.0.0.6 - 10.0.0.x

    Report
  • Comment Link Graeme Saturday, 20 May 2017 09:42 posted by Graeme

    Hi Stan92, I would hope it is not getting confused with similar ssids. I haven't tested that setup but to force a hotspot I add a random letter to the SSID and it goes to a hotspot fine. So based on that I would expect that it would see them as different SSIDS. I have made a change to the script so it automatically scans your wifi settings rather than you needing to enter the SSID into the script. Though that option is still available if needed.
    Try these changes and see if that helps.

    Report
  • Comment Link Stan92 Friday, 19 May 2017 18:49 posted by Stan92

    Hi Graeme,
    I thank you for your support..
    I'll make a try..
    Probably I m wrong, but I notice that happens when the SSID starts with the same letters..
    At home, I have several SSIDs (SSR, SSR2) and during my tests, I turned off the SSR routers.. I suspect the script tried to connect to SSR2.. But as I said, I'm probably wrong...
    I thank you once again

    Report
  • Comment Link Graeme Friday, 19 May 2017 09:43 posted by Graeme

    Hi Stan92, if the AP mode works then the config is fine. What i think is happening is when you switch the router off, the Pi is not clearing some background wifi files. So when the pi is rebooted it can't set off the AP mode which is why hostapd is inactive(dead). My other script "autohotspot-switch" can do that without a reboot but it has to flush the IP address assigned to wlan0 and make sure the wpa supplicant background files are removed. Hopefully you can use a screen as you will have no network connection to do this once your router is off;
    try sudo ip addr flush wlan0 and sudo rm -r /var/run/wpa_supplicant

    also, if you haven't already, shutdown the PI then switch off the router it should clear things down first.

    Report
  • Comment Link Stan92 Thursday, 18 May 2017 23:51 posted by Stan92

    Just some additional info.
    In fact, the AP works and I can ssh the PI.
    When I set the the Wifi, everything is also ok.

    But my trouble comes when I shutdown the router (leaving the /usr/bin/autohotspot without updates), and reboot the PI, I don't switch to AP mode.

    To get the AP mode, it seems that I need to change the declared SSID within the autohotspot file.

    As I run my PI in Kiosk Mode, I can only connect thru ssh.

    Report
  • Comment Link Stan92 Thursday, 18 May 2017 23:14 posted by Stan92

    Hi,
    I ran sudo systemctl status -l hostapd
    I get Loaded: loaded (/etc/init.d/hostapd)
    Active : inactive (dead).

    I will check again the procedure.

    Report
  • Comment Link Graeme Thursday, 18 May 2017 22:41 posted by Graeme

    Hi stan92, I would presume there is a config error somewhere. As your ssid is not being broadcast the only alternative is to go to AP mode. Is the wifi icon by the clock saying RPI3Hot and you can see RPI3Hot being broadcast with a wifi device? If not there is an issue and the Hotspot hasn't started.
    check hostapd with 'sudo systemctl status -l hostapd' it should let you know if there are any errors.
    Put false ssids in the autohotspot script if that fails just check the script and configs are correct.
    Email me details of whats happening if you have no luck and I will look into it further for you.

    Report
  • Comment Link stan92 Thursday, 18 May 2017 21:50 posted by stan92

    Hi,
    I thank you for sharing.. very useful...
    However I have a question :-)
    Let's say my wpa_supplicant.conf contains an entry that I've set to the autohotspot file.
    I notice if I shutdown my router and reboot the PI, it doesn't set into AP mode.
    Is there a way to prevent that? (I would like to go back in AP mode).. I probably miss something..
    Regards,

    Report
  • Comment Link Graeme Wednesday, 17 May 2017 19:27 posted by Graeme

    Hi Dan, The IP address to connect with is only set in the script in the line,ip a add 10.0.0.5/24 dev wlan0 so I would check that there are no errors.

    Some users connecting with an android phones have found that they can connect the wifi to the hotspot but when they try 10.0.0.5 with ssh the phone uses online service instead of connecting to the IP until they deactivate data.

    Are you using a phone, tablet or laptop to connect and does it do the same with all devices?

    If when it is in hotspot mode you enter the command ip addr can you see wlan0 and the ip 10.0.0.5?

    if this doesn’t help email me more details about your setup and how the steps you do and I will look into it.

    Report
  • Comment Link Dan Wednesday, 17 May 2017 12:16 posted by Dan

    Hi,somehow i am not getting an ip adress from the RPi when i connect to its hotspot!? I always have to set it myself :/ Any suggestions?

    Report
  • Comment Link Graeme Sunday, 14 May 2017 12:22 posted by Graeme

    Hi Reven
    I have mailed you some scripts, from a cut down version of my Switch script, that will give you normal pi wifi activity but allow you to create a hotspot on demand from the desktop rather than at startup. These should do what you need.

    If anybody else would like this setup then you can e-mail for the scripts. admin@ this site.

    Report
  • Comment Link Reven Saturday, 13 May 2017 23:10 posted by Reven

    yes that sounds to be perfect, to have the pi work as normal but then be able to turn on the hotspot on demand. would it be difficult to alter the Hotspot Switch script to get this

    thanks again for all the help

    Report
  • Comment Link Graeme Saturday, 13 May 2017 09:57 posted by Graeme

    Hi Scott, it should work with multiple ssids. I know it has worked for others.
    just check each of the ssids are separated by spaces in the line ssids=('mySSID1' 'mySSID2')
    I think ther may be an error in your script as it should always generate a hotspot if the network can't be found. If it is not doing either then the script has failed somewhere. Check the status with: sudo systemctl status -l autohotspot it should tell you what this issue is. You can also try running it manually to see whats happening with sudo /usr/bin/autohotspot

    Report
  • Comment Link Graeme Saturday, 13 May 2017 09:34 posted by Graeme

    Hi Reven, The wifioff script just disables wifi so you need to reboot to get it back and the autohotspot script to work.
    I think the issue is if it is in hotspot mode you will have to manually add new SSIDs and passwords to the wpa_supplicant.conf file as you can't use the wifi config options. But once they are setup, a reboot will change it to the friends/coffee shop wifi.
    I think what you are looking for is normal wifi but activate the hotspot on demand which is possible but needs a new script for that, basically a cut down version of my Hotspot Switch script.

    Report
  • Comment Link Scott Frey Saturday, 13 May 2017 01:26 posted by Scott Frey

    Has anyone gotten this to work with more than one Wifi network configured in wpa_supplicant? I have not gotten it to work after adding 2 or 2 network configurations, only the first one.

    If I configure a second entry (and add the corresponding ssid to the autohotspots script) it fials to either connect to a network or generate a hotspot.

    Not sure if I am doing something wrong or it just can't work.

    Thanks for creating this!

    Report
  • Comment Link Reven Friday, 12 May 2017 09:25 posted by Reven

    hey Graeme, this seems to be a pretty ideal solution for me, thats basically exactly what i want,

    Except? when i disable the hotspot with ur solution, can i still connect the Pi to wifi maybe if im at a coffee shop or friends house?

    Report
  • Comment Link Graeme Thursday, 11 May 2017 23:07 posted by Graeme

    Hi Reven, as the script manages the wifi to a router or a hotspot it's best not to disable it altogether unless you want it to act as normal all the time. I take it you want to be able to use it as a hotspot but don't want the wifi active every time you use it. As there is no option to disable the wifi with the wifi icon in hotspot mode, I would create a script that you run when you get to the desktop that disables the wifi.
    Create a blank text file and enter these two lines:
    #!/bin/bash
    sudo ip link set dev wlan0 down

    save this to your desktop and call it wifioff.sh
    then in terminal enter the commands:
    cd Desktop
    sudo chmod +x wifioff.sh

    now when you click on the icon select the execute button from the requester that shows. This will deactivate the wifi. When you reboot the hotspot will come back.
    Let me know if this is suitable for your use.

    Report
  • Comment Link Reven Thursday, 11 May 2017 14:03 posted by Reven

    thank you for the fast response,
    i have just one question, I will only be using the Raspberry Pi as hotspot mode, i will not use the feature to look for my home wifi because i dont have wifi at the moment.

    so the pi will automatically start the hotspot everytime i boot it up,

    my question is, what would be a simple way to deactivate this, so when i boot my pi up next, it will just act normal with no hotspot mode. but then be able to activate it again so next time i boot the pi it will make a hotspot again

    ive tried to look for solutions, but i'm a beginner with this stuff and would rather ask you ?
    thanks for the help!

    Report
  • Comment Link Graeme Monday, 08 May 2017 21:48 posted by Graeme

    Hi Reven, yes the hotspot works with VNC. I am using REAL VNC that is installed with the PI and the viewer on an android tablet. Once the hotspot is running you can connect to it with the 10.0.0.5 ip address the same as ssh. This is the only IP the hotspot uses so I expect it to work fine.

    Report
  • Comment Link Graeme Monday, 08 May 2017 21:43 posted by Graeme

    Hi Paul, I have just tried my usb wifi dongle while disabling the internal wifi as you have. It connected to my router ok and also the hotspot worked fine. So it possible could be your dongle.
    maybe check it uses the nl80211 driver.

    Report
  • Comment Link Reven Monday, 08 May 2017 20:39 posted by Reven

    hey there, im loking into a non-internet travel solution.
    Would it be possible to connect an ipad to the raspberry pi with a VNC viewer app through this access point?
    would I be able to set the IP address and port to always be the same on the access point?

    Report
  • Comment Link Paul Atreides Saturday, 06 May 2017 22:06 posted by Paul Atreides

    Graeme,

    thanks for the prompt reply. Well I disabled the inboard wifi by modifying the
    /boot/config.txt file with this line: dtoverlay=pi3-disable-wifi. Then when I reboot with the usb tplink usb adapter it becomes wlan0 instead of wlan1 since the onboard wifi is completely down.. Without the script or the changes to the interface files it detects my home network and logins in automatically, it only refuses to connect to my home router when the script is enabled, and then it creates a hotspot but still will not issue itself the correct 10.0.x.x address. I may just leave it unable to detect the home router since this will be a mostly standalone pi anyway. I will check the hostapd status.

    Report
  • Comment Link Graeme Saturday, 06 May 2017 21:24 posted by Graeme

    Hi Paul, Does it work if you use the onboard wifi just for testing? If so then it will be the usb wifi. If the USB Wifi is running on wlan1 then that may be an issue as all the script and configs use wlan0. check with the command: ip addr ,You would need to change the refernces to wlan0 in the script and config files to wlan1 but i have not done that so can't say how it will work.
    In hotspot mode check the status hostapd; sudo systemctl status -l hostapd

    It may show and error or that it is not using wlan0.
    Not sure what else it could be.

    Report
  • Comment Link Paul Atreides Saturday, 06 May 2017 20:40 posted by Paul Atreides

    One more question, I have a couple Pis setup. The first one is running fine. The second will setup as a hotspot but it will not detect my home router. Also when it sets up as a hotspot, it will not assign itself the 10.0.0.5 ip address, it uses a seemingly random 169.254.x.x address. I'm using a usb wireless adapter for better range and I've disabled the on-board wifi, I wonder if that has anything to do with the issues I'm having Any ideas?

    Report
  • Comment Link Paul Atreides Friday, 05 May 2017 20:25 posted by Paul Atreides

    Ok, I found out what I did, I made a couple of typos, once again thanks for the excellent guide.

    Report
  • Comment Link Graeme Friday, 05 May 2017 20:10 posted by Graeme

    Hi Paul, It sounds like the script is not being started. This could be permissions so redo the chmod command: sudo chmod +x /usr/bin/autohotspot

    also check the status of the script with; sudo systemctl status -l autohotspot
    this will show if it started (Active) and the messages. If it is not Active try to enable it again with; sudo systemctl enable autohotspot
    If did run and didn't find the ssid then it would have created a hotspot so I think it should be one of these. It can also be run manually using; sudo /usr/bin/autohotspot which will print messages as it runs which may give you a clue.

    Report
  • Comment Link Paul Atreides Friday, 05 May 2017 19:46 posted by Paul Atreides

    I've followed this tutorial, ( thanks by the way for this!) But I'm getting an error upon reboot. I have no ability to test because it's showing a network interface error when I hover over where the network icon should be it says: "wlan0: Not associated" , can anyone point me to where I made a mistake. Thanks!

    Report
  • Comment Link Graeme Friday, 05 May 2017 12:17 posted by Graeme

    Hi goodguy, I don't think SSL is anything to do with SSH thats more to do with online website security. I would check your Android app settings as it might be trying to go online rather than connect to a device on the RPI3hot network. I use Juice on Android (WiFi only Tablet) which can use a few modes such as telnet, but is ssh by default and I have had no issues. The only times I get a warning, is if I use my SD card in a different pi and connect via ssh, it can cause a warning about "Remote Host Identification has Changed" but if you confirm yes and all is ok again.

    A Comment posted by Neil below, which may be the issue:
    "I think I see the same as Ignoto92 on my Nexus 5X. I can't use Juice SSH to connect to 10.0.0.5.

    However I can connect using my laptop - wonder if android is trying to be too clever as it knows there is no internet...

    I disabled data on my mobile connection and then SSH worked."

    Report
  • Comment Link goodguy Thursday, 04 May 2017 17:02 posted by goodguy

    Hi Graeme,

    Great tutorial! I was able to set it up on my pi zero w and when I use my mac I can establish an ssh connection with it no sweat. However when I try to connect to the pi with my android, the android is throwing up errors about SSL Exceptions. Any ideas?

    Report
  • Comment Link Graeme Tuesday, 02 May 2017 19:41 posted by Graeme

    Hi Tom, Coincidently you can, In Tino's second comment on the "Hotspot Switch" version of the script he makes a change to just checks for the wifi networks that have been setup by searching WPA_Supplicant.conf. So no need to define the ssid in the script. I haven't tested it on multi wifi networks but it works with my 1 network setup, but will be added to the article once checked out.
    The Link is just above the "Removal" header.
    Have a good trip :)

    Report
  • Comment Link Tom Monday, 01 May 2017 23:14 posted by Tom

    Hi Graeme,

    Excellent work here - I was wondering though, is it possible to do achieve this without specifying which networks are 'regular' networks?

    As for my project, I plan to take my raspberry pi on the road with me connecting to new networks each time (where available - if they don't have wifi then I'll run it as a hotspot).

    Thanks

    Tom

    Report
  • Comment Link Graeme Friday, 21 April 2017 21:44 posted by Graeme

    Hi Keith, I know there are issues with hostapd and the realteck chips that don't use the nl80211 driver, but I don't know what issues it causes. There is a version of hostapd that has been modified for the rtl8118 chips, see https://jenssegers.com/43/realtek-rtl8188-based-access-point-on-raspberry-pi may be worth giving that a go. Could try dropping the driver line altogether in the hostapd.conf file which some online comments suggest.

    Try putting it in hotspot mode on a screen and seeing if 'sudo systemctl status -l hostapd' and see if there are any clues. Other issues people have had is the laptop had the wrong encryption mode, not wpa. Your phone should have been fine though.

    If the wifi icon near the clock is show "associated with RPI3Hot" (with the mouse on it) and you can connect to the RPI3Hot wifi signal with your laptop/phone but fails at the password prompt then the password is wrong (unlikely) or hostapd has failed. Any hostapd issues I have had while putting the script together just caused the hotspot not to get generated.
    Other than trying it with a different dongle, if possible, just to check its a compatibility problem. Hope you get it sorted, sound like a fun project.

    Report
  • Comment Link Keith Friday, 21 April 2017 17:49 posted by Keith

    Hi totally out of depth with 'CODE'but have managed to write a script on raspi for a turning pistol target. Want to run it from ssh via laptop in a barn with no wifi or network. Can see the Hotspot on pc&phone etc but after entering passcode returns not able to connect. Have checked and rechecked your writeup but no joy. Going guiddy circles trying to figure whats wrong! No doubt something simple....any ideas where to check? (Raspi 2b with tontec wifi rtll818cus dongle updated driver & hostapd to suit)

    Report
  • Comment Link Graeme Wednesday, 12 April 2017 22:42 posted by Graeme

    Hi Willem Me, Thanks for letting me know about the hidden ssids issue. I will be adding your changes to the guide, very helpful. Thank you.

    Report
  • Comment Link Willem Me Wednesday, 12 April 2017 15:03 posted by Willem Me

    I have asked to fast, I fixed it myself by changing inside script the loop to loop through macAdresses instead of SSID and also changed variables to work with macAdress. Maybe add this finding as note to the script part for others with hidden ssids, but still thank you. (my edited code: ...
    macAdresses=('MyRouterMACAdress')
    ...
    for macAdress in "${macAdresses[@]}"
    do
    if iw dev wlan0 scan ap-force | grep "$macAdress" > /dev/null
    ...
    echo "Not in range, WiFi with MAC:" $macAdress
    ...)

    Report
  • Comment Link Willem Me Wednesday, 12 April 2017 14:20 posted by Willem Me

    Awesome that you made this easy guide! I only have a "small" problem my home ssid is hidden, and it seems the script can't find it. Do you have any suggentions to get this working? Thanks in advance.

    Report
  • Comment Link Graeme Monday, 10 April 2017 12:06 posted by Graeme

    Hi Falko, the driver is nl80211 already, did you mean something different? The set-up has been tested on a PiZero W and worked fine as they are the same as Pi3 :)

    Report
  • Comment Link Graeme Monday, 10 April 2017 12:01 posted by Graeme

    Hi Tony, thanks for highlighting that. I really should stop making changes so late at night. :)

    Report
  • Comment Link falko Sunday, 09 April 2017 22:28 posted by falko

    Hi roboberry

    Had some problem configuring it for pizero w. Found out that in hostapd.conf you need change driver to nl80211 for it to work.

    Report
  • Comment Link Tony Sunday, 09 April 2017 19:34 posted by Tony

    The hostapd defaults configuration still has a typo in it. The A is missing in DAEMON_CONF

    It should say:
    Change:
    #DAEMON_CONF=""
    to
    DAEMON_CONF="/etc/hostapd/hostapd.conf"

    I couldn't see my access point after following these instructions, and that was the problem for me. Once I fixed the typo it all worked.

    Thanks for putting this together. Very handy.

    Report
  • Comment Link Graeme Sunday, 09 April 2017 10:09 posted by Graeme

    Hi Chris, thanks for highlighting the space issue. The article has been updated with your change. Thank you.

    Report
  • Comment Link Chris Friday, 07 April 2017 03:28 posted by Chris

    Great article. Just one issue - my SSID has spaces in, which causes your grep to break. $ssid needs quotes around it to solve this. ie:
    if iw dev wlan0 scan ap-force | grep "$ssid" > /dev/null

    Report
  • Comment Link Graeme Wednesday, 05 April 2017 20:10 posted by Graeme

    Hi Neil, thanks for the info, I use Juice on a Nexus 7 which is Wifi only, so I don't come across issues like that.

    Report
  • Comment Link Neil Wednesday, 05 April 2017 18:02 posted by Neil

    I think I see the same as Ignoto92 on my Nexus 5X. I cna't use Juice SSH to connect to 10.0.0.5.

    However I can connect using my laptop - wonder if android is trying to be too clever as it knows there is no internet...

    I disabled data on my mobile connection and then SSH worked.

    Report
  • Comment Link Graeme Monday, 03 April 2017 20:12 posted by Graeme

    Hi Ignoto92, I have tried a few things but not reproducing your issue exactly. Check dnsmasq is started ok, in AP mode enter sudo systemctl -l status dnsmasq and see if that give an error. Do the same for hostapd just to be sure thats ok.
    If i change the /usr/bin/autohotspot file so dnsmasq doesn’t start I can see RPI3hot and attempt to connect but the ip is never given. So just double check the files. Errors I make at times are using a comma instead of a full stop and general typos.
    If no luck your welcome to send me your config files and I will try it out on my pi's, or if you have further questions. admin@{thiswebsite}

    Report
  • Comment Link Ignoto92 Monday, 03 April 2017 12:11 posted by Ignoto92

    Hey, I've just did it but I can't connect to my Pi in AP mode, it don't give me ip addresses and devices give me an error 'ip configuration erro'; I think this is dnsmasq, how can I resolve?

    Report
  • Comment Link Graeme Sunday, 02 April 2017 19:29 posted by Graeme

    Hi Justin, thanks for that, it should be capitals in older versions as well. :)

    Report
  • Comment Link Justin Sunday, 02 April 2017 04:49 posted by Justin

    Thank you for this.

    There is a typo at the end of the Hostapd Configuration section. The instruction is to change the "demon_conf" line, but that should be "DAEMON_CONF". At least that's how it is in the current version of Raspbian (version March 02 2017).

    Report
  • Comment Link Graeme Tuesday, 28 March 2017 21:46 posted by Graeme

    Hi Manu, in terminal just check what ssid is being found, your need it on a display for this if using ssh, enter : sudo iw dev wlan0 scan ap-force | grep "ATTUverse01" it should return "SSID : ATTUverse01. if it doesn’t then it doesn’t think that ssid is being broadcast. If it does find it stop hostapd and dnsmasq with sudo systemctl stop hostapd, sudo systemctl stop dnsmasq. Then start wifi with: sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf your wifi should come back. If it doesn’t then check your /etc/wpa_supplicant/wpa_supplicant.conf file has the correct details. Because if the: sudo dhclient -1 wlan0 line doesn’t return "RTNETLINK answers: file exists" then the wifi connection has failed so a hotspot get generated.
    Your welcome to email me if you need this looking into further, happy to get you up and running.

    Report
  • Comment Link Manu Monday, 27 March 2017 23:53 posted by Manu

    Hi, got this to work partially on a pi zero with a dongle. The access point is setup fine and I can connect to it. Problem is, even when I put the valid SSID name in the /usr/bin/autohotspot , reboot always results in the hotspot mode - it never connects to my router like it used to.
    I've already reduced the SSID list to just one router and the syntax is ..
    ssids=('ATTUverse01')


    Any suggestions?

    Thanks.

    Report
  • Comment Link Graeme Monday, 20 March 2017 21:33 posted by Graeme

    Hi John, glad the script is useful to you. If you have an external script updating the wpa_supplicant.conf file it should still work as the file is not changed. Does wpa_supplicant points to a different config file? if so change the path in the autohotspot "wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf" to that location.
    or (a very unsecure option) if your /boot/octopi-wpa-supplicant.txt is your config file change the path to that. Can you give more details on how this part is working.
    The autohotspot file can be run from the boot folder so you can just add the SSIDs as you please. Though make sure if you are using windows the file is not saved in dos text format, use unix format.
    You then need to change the path in the /etc/systemd/system/autohotspot.service file to ExecStart=/boot/autohotspot

    It should be possible to take a list of ssids from a file and use them in the ssid variable. If you need that I can have a look.

    let me know if this helps or you can email me further details.

    Report
  • Comment Link Graeme Monday, 20 March 2017 21:12 posted by Graeme

    Hi Jose, so what is happening is your SSID is being detected but your wifi is failing to start, possible because the details in wpa_supplicant.conf are wrong. If the dhclient dosn't detect the wifi has connected it will goto "else". Check your wpa_supplicant.conf file.
    Open terminal and enter: sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf and see what message you get.
    Also just check the wpa_supplicant line in the autohotspot script ends in "> /dev/null 2>&1" i have managed to chop the end of that of a couple of times copying it in. Let me know if you have further issues.

    Report
  • Comment Link John McNerney Monday, 20 March 2017 17:43 posted by John McNerney

    Is there any way to make the list of known WiFi networks get copied automatically from a file in the boot directory into the list in /usr/bin/autohotspot ?

    That, coupled with the method of populating wpa_supplicant.conf with networks from a file in the boot directory (as mentioned in my previous comment or as the ) would make it very simple to add known networks by editing an SD card on a computer. There would be no need to remember what files were where or how to get to them (since the boot directory is easily accessible when an SD card is read in a computer).

    Report
  • Comment Link Jose Moffa Monday, 20 March 2017 15:12 posted by Jose Moffa

    Hello, nice work with this script, it helped me a lot. But i am having a issue, when the script reaches here:

    'if dhclient -1 wlan0'

    That command returns nothing a then fall on else statement. I tried this script on a RPI with a fresh installation.

    Report
  • Comment Link John McNerney Monday, 20 March 2017 03:38 posted by John McNerney

    Thank you SO much for making this available. I'm volunteering with a local elementary school which is using R-Pi's in various projects. Your set up will greatly simplify things for us.

    I do have a question for you, however. Prior to setting up the "Auto WiFi hotspot..." the system we had set up to use a pi to provide wireless access to a 3D printer used to look at the file /boot/octopi-wpa-supplicant.txt for the WiFi configurations. Since the boot directory is the only one that shows up (easily) when plugging the SD card into a computer, it was simple to edit when the SD card via computer when necessary. The information in that file then "magically" appeared in /etc/wpa_supplicant/wpa_supplicant.conf when the Pi was booted up.

    That no longer happens since I set up the auto wifi hotspot. Is there a way to restore that behavior? It was very convenient to be able to access a file easily from a computer to manually enter a wifi set-up - and, since th efile needed to do so was in the boot directory, I didn't need to remember where the various files were.

    Report
  • Comment Link Graeme Sunday, 19 March 2017 20:19 posted by Graeme

    Hi Keith, I’m glad you have found it useful. Will post a version soon that can be swapped between both set-ups without rebooting.

    Report
  • Comment Link Keith Sunday, 19 March 2017 18:31 posted by Keith

    This worked perfect and was just what I needed. Thank you. I have added some more commands to your script to run stuff when I am away from home and not when I return.

    Report
  • Comment Link Graeme Friday, 17 March 2017 19:40 posted by Graeme

    COMMENT DELETED BY MISTAKE: Someone asked about an issue, script works but keeps going to hotspot. Sorry i deleted it not published your comment. Please post again.
    As for issue, check ssid entered correctly for your router in autohotspot example ('myssid')

    Report
  • Comment Link Graeme Monday, 13 March 2017 21:42 posted by Graeme

    Hi Osprey, unfortunately not. Some background files used for wifi have to be cleaned up before the hotspot can be started. I will have another go at it soon. I think it would be useful to save rebooting.
    Update: have it working, script emailed to you

    Report
  • Comment Link Osprey Monday, 13 March 2017 15:38 posted by Osprey

    Thanks Graeme. If I were to somehow run the startup script every, say, 2 minutes, would I achieve what I am after? The reason I am asking (as opposed to just try it) is that I still have to find out how to make a script run at regular intervals.

    Report
  • Comment Link Aden McCusker Saturday, 11 March 2017 06:58 posted by Aden McCusker

    Outstanding! Thank you very much.

    Report
  • Comment Link Graeme Wednesday, 08 March 2017 19:24 posted by Graeme

    Hi Osprey, Maybe possible without a reboot, I will have to look into it further. I have just tried a couple of quick changes to the current setup, but the network wifi takes over the hotspot when the router is back in range and messes about with the connection. If I come up with something I will let you know.

    Report
  • Comment Link Osprey Wednesday, 08 March 2017 16:04 posted by Osprey

    Thanks for the thoroughly explained tutorial. Works as advertised. I was wondering if there was a way to periodically do the process of deciding whether to work as a hotspot or as a client. I have a situation where my car is started in my garage where it connects to the home wifi. However, I need it to switch to hotspot mode as soon as the car leaves the vicinity of my home and then switch back to client mode (and connect to my home wifi) when I get back home.

    Report
  • Comment Link Fi7i Tuesday, 07 March 2017 11:02 posted by Fi7i

    Nice ! Thanks !

    Report
  • Comment Link Graeme Wednesday, 01 March 2017 08:28 posted by Graeme

    Hi burksfamily, I take it the pi still connects to the router when ssid is found, just hotspot not working when ssid not found? Is RPI3Hot being broadcast to wifi devices?
    Set a fake ssid and boot to the desktop. check hostapd is running ok with sudo systemctl -l status hostapd, should get a success message. do the same with autohotspot to see if my script went ok. They should give you a clue if something has gone wrong starting the hotspot. Though strange it not working with a restored os.
    also make sure the autohotspot is executable sudo chmod +x /usr/bin/autohotspot as it won't run if that step is not done.
    If still no luck send me an email with details of your setup and whats happening, can send the config files as well, happy to get you up and running. Hopefully you won't need a late night tonight :)
    Graeme

    Solved: issue due to laptop encryption settings

    Report
  • Comment Link burksfamly Tuesday, 28 February 2017 16:53 posted by burksfamly

    Great instructions.
    Using on a project that is two months in the making.
    1) Performed SD image of my entire OS.
    2) Performed your instructions and checked.
    3) Worked great at 10.0.0.5 with Filezilla and VNC Viewer over Windows laptop.
    4) Performed test to see if switching between ssid (changed to bogus name), ad-hoc, and ethernet cable directly to home network.
    5) That test work with one iteration.
    6) Now I cannot get ad-hoc back and I have tried various ways...different channel...different address range...still no joy.
    7) RESTORED my image card to original.
    8) Performed same instructions...could not get ad-hoc to work.
    9) RESTORED my image card to orignal and repeated...still could not get it to work.
    10) This took 8 hours (until 2 am last night.
    11) I liked what I saw and it is exactly what I need for my project, but I for the life of me cannot figure out why I cannot get it to work again. I realize this doesn't make sense, but I have nothing else to offer.

    Any ideas...will be trying again tonight and looking for other solutions.

    Report
  • Comment Link Matt Monday, 27 February 2017 11:22 posted by Matt

    Awesome!
    Many thanks for your easy to follow instructions!

    Report
  • Comment Link Graeme Wednesday, 22 February 2017 20:33 posted by Graeme

    Hi mafkaan, thanks again for your previous heads up, a few other bits needed updating as well. Adding internet/network access is not something I need, but I have had interest in it being able to get eth0 access in hotspot mode. So i have actually got that on my list of projects. Got some other projects on the go at the moment but I will look into that afterwards and update the article if it goes well.

    Report
  • Comment Link Graeme Wednesday, 22 February 2017 20:18 posted by Graeme

    Hi Stuart, i haven't been able to reproduce your issue, I have changed some bits on hostapd but generally get disassociated. use the command sudo system status -l hostapd this should give you a clue if hostapd is ok. If you have no luck e-mail me the details of your pi and setup and I will see if i can find the issue. admin@ this site

    Report
  • Comment Link mafkaan Wednesday, 22 February 2017 10:03 posted by mafkaan

    Hi again.
    The update looks great. very neat
    I was wondering. could you add a paragraph on how to make this forward the internet to the clients when pi is connected to internet by ethernet. It could become a range extender or hotspot when at a hotel or something.

    Report
  • Comment Link Stuart Wednesday, 22 February 2017 00:00 posted by Stuart

    Hey, so I followed the instructions here. However, when I go to test the hotspot I get the icon with two screens, but the information given is wlan0: Associated with and then blank, no name given. No signals visible on any wifi devices. I think I'm creating the hotspot but not broadcasting a discoverable name? I've checked in the hostapd.conf file and there's definitely a ssid name there. Any help would be appreciated.

    Report
  • Comment Link Graeme Tuesday, 21 February 2017 19:24 posted by Graeme

    Note: All comments below are for the original rc.local version of this hotspot article not the latest version using systemd

    Report
  • Comment Link Graeme Monday, 13 February 2017 10:49 posted by Graeme

    Hi Mateusz, as long as you are using a PI3 or AP capable wifi dongle and there is no typo errors it should work fine.
    If you would like to e-mail me details of your set up, OS and the issue I can help you with the setup. But to reverse the changes you need to restore your rc.local file so it is the same as the first section under "Start-up Script" in the article.
    Then in the /etc/network/interfaces file, reverse the changes there. No need to change anything else. On reboot it will connect to the default WiFi settings.

    Report
  • Comment Link Mateusz Sunday, 12 February 2017 17:57 posted by Mateusz

    hi, can someone tell me how go back with all settings, because its not working and also i cant connect to my home wifi

    Report

Additional information