Create a Wi-Fi hotspot in less than 10 minutes with Pi Raspberry!
Commentsⓘ Cet article peut avoir été partiellement ou totalement traduit à l'aide d'outils automatiques. Nous nous excusons des erreurs que cela pourrait engendrer.
Have you ever needed to create a second Wi-Fi network in addition to your primary network? If you (or someone close to you) have a business (coffee, restaurant, hairdresser or doctor, in short, a place where people are likely to wait), it is likely that you have already had to provide internet access to your Customers, without wanting to give the password of your box. In the same way, you may have already wanted to create an internal network that is cut off from the Internet, for example to exchange files within a small company, and so on.
For all these situations, the simplest solution is to create what is called a hotspot, that is to say a kind of box that you can control and to which your users can connect to access the internet. In this tutorial, let’s see how we can use a Raspberry Pi to create our own homemade hotspot, in less than 10 minutes!
The hardware needed to create your hotspot
In order to create our own hotspot, we will need a little bit of hardware, but nothing complicated or too expensive, you will be able to get around for about 50 € to 60 €, and you can use all the equipment for other uses in parallel.
To achieve our hotspot, we will need the following:
- A Raspberry Pi 3 (Chosen because it has an ethernet port and a built-in Wi-Fi connection)
- A power supply for your Raspberry Pi
- A MicroSD card of at least 8GB
- An Ethernet cable
As you can see, all these components are just the ones needed to operate a Raspberry Pi, and you will be able to use the Raspberry Pi in question for other things in parallel to its role as a hotspot.
Moreover, by tweaking a bit in the configurations, and if you add a second Wi-Fi interface on your Raspberry Pi, you can also transform your hotspot into a Wi-Fi repeater, in order to increase the range of your box!
Install hostapd and its interface to turn your Raspberry Pi into a Wi-Fi hotspot
Now that we have all the hardware we need, we will be able to switch to installing the various software needed to transform our Raspberry Pi to Wi-Fi.
The first step will be to install Raspbian (the lite version, preferably) on your Raspberry Pi. To do this, we will let you consult our tutorial explaining how to install Raspbian on Raspberry Pi from Windows, or from Linux.
Once you have installed Raspbian, the first thing to do is to plug your Raspberry Pi to your internet router using the Ethernet cable and then take control of your Raspberry, either directly with a keyboard / screen, or through SSH , as explained in this tutorial.
Once done, we will make sure that the Wi-Fi connection of the Raspberry remains available for the creation of the hotspot. For this purpose, we will simply create a copy of the configuration file allowing the connection to a box, in order to keep it aside, and modify the main file.
To do this, go to the terminal of the Raspberry Pi and run the following commands:
sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.sav sudo cp /dev/null /etc/wpa_supplicant/wpa_supplicant.conf
Finally, edit in the file /etc/wpa_supplicant/wpa_supplicant.conf
and add the following lines:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1
Now that we are sure that the Wi-Fi interface is available, all we have to do now is install the various software to make the Raspberry Pi an access point.
In this tutorial, we will use the hostapd software, which will allow us to turn the Raspberry Pi into an access point. And to facilitate the installation and administration of this access point, we will also install a web interface that will allow us to control our hotspot, RaspAP (for more info, go to the Github page of the software, https://github.com/billz/raspap-webgui).
And the good news is that to do all this we will need to run only one command:
wget -q https://git.io/voEUQ -O /tmp/raspap && bash /tmp/raspap
Once the command is launched, you only have to answer the few questions that will be asked, and the installation of all the components will be done by itself.
Connect to your Wi-Fi hotspot
When the installation is complete, your Raspberry Pi restarts, and you should see a “raspi-webgui” network in the list of accessible networks.
If, however, the network does not appear, find the IP of the Raspberry Pi, and connect to it via your web browser. You should arrive on the hotspot administration interface, the default password is shown on the github page of the software. Once connected, go to the “Configure Hotspot” section, and change the “Wireless Mode” field, this should solve the problem.
Once the network is visible, all you have to do is connect to it, the default password is ChangeMe
.
You can change this password, network name, and many other things by connecting to the admin interface of your Raspberry hotspot via your web browser, by default the address should be 10.3.141.1
.
And if it still does not work?
For some time, we do not know why, but it seems that Internet access is no longer functional by default after installation. To solve this problem you only need to do the following two things.
As a first step, enable the transfer of IPv4 packets. To do this, edit the file /etc/sysctl.conf
and uncomment (ie remove it #
at the beginning) the following line:
#net.ipv4.ip_forward=1
This done, we will modify iptables to define the output IP that will be indicated so that the servers know who to answer (well, from what I understand, if I’m wrong rectifications are welcome ). To do this, open the file /etc/rc.local
and add the following line before the “exit 0” part:
iptables -t nat -A POSTROUTING -j MASQUERADE
Restart the pi and everything should now work as it should!
All you have to do is configure your hotspot to suit your needs!
We hope that this tutorial will have helped you, do not hesitate to consult our other tutorials, such as the one on the creation of a retro-gaming console with the Raspberry Pi, and if you need help, do not hesitate to ask for on the comments !
hi, I have gone through this forum and successfully installed raspap but i am not able click on the wifi client AP mode and i tried that second part in which uncomment the net.ipv4.ip_forward=1 and added iptables -t nat -A POSTROUTING -j MASQUERADE in the rc.local file but that is still not working ……please if anybody done this one …..please help me to solve this….thank you
Install pihole first if using pihole with the VPN.
What is the connection range of the router and can it be extended?
Well that depend mostly on the Wi-Fi antena used. More powerfull the antenna is, larger is the range.
One problem that I had is that I have installed `ufw` on RPi and it was not working. Finally I found that I should edit `/etc/default/ufw` and set `DEFAULT_FORWARD_POLICY=”ACCEPT”`.
Maybe this can be useful to other people too.
Hi, installed per directions on Pi 3B, works…after trying a couple other tutorials for this without success, I am thrilled it works. I even have it running as a vpn client with Nordvpn.
My problem:
I have two Debian Buster machines ( a laptop and a desktop ) connected and working fine, I even connected my Android 10 phone and it works. HOWEVER, I have a Pi 2, a Pi 3B, and a Pi 4, all running Raspbian that I cannot get to connect. I used raspi-config to enter the SSID and passphrase but no go. even modified wpa_supplicant.conf to only have only the AP info, but no go (doesn’t connect at all). I am at the end of my knowledge/experience, which isn’t very much, so any guidance as to where to go from here would be appreciated. thanks
Hello, maybe the network use a protocol not compatible with the raspberry pi wireless interface. The pi only support /n and /ac wifi.
Hi!
Thank you for the tutorial! I use a RP 4. I have installed and the default configuration is working. However once I change the hotspot’s SSID and mode and security, the hostapd stops working, no wifi. Do you have any solution for this?
I’ve never had the problem, maybe a bad configuration. You should ask the question on the raspberry pi forum.
life saver man… love you … works perfectly
Thank you very much for this
After instalation it works perfectly.
But i have a problem :
I had an Apache2 web app configurated , and now it stopped to work. I think web page of the hostpot are no compatible with Apache2 , Do u have any solution? thanks
Salut, le problème ne viendrait-il pas plutôt d’un changement d’IP de la machine ? Je ne vois pas de raisons à priori pour un conflit entre Apache et un hostspot. À la limite il faudrait vérifier les fichiers de config de la partie web du hotspot pour voir s’ils ne viennent pas remplacer les tiens ou un truc du genre.
works fine at once after installation
raspi 3b+
thanx
I had ap intermittently disconnecting, which required raspi restart. I updated conf file via web gui to disable security and hide ssid. Works fine now.
The directory in your second line of code does not exist: “/dev/null/etc/…”
Hello, we fixed it a space was missing
Everything’s working fine. But sometime hotspot crashes when i attempt to connect again. I’m using it mqtt clients
Thank you for this tutorial.
I followed the instructions and I got the hotspot working and it connects to the internet.
However, it is only if it connected directly to the router.
I connected it to another ethernet wall jack that is active, and I can see the hotspot but there is no internet.
I was hoping to use it to extend my router, is that possible?
In addition, can the RPI3 B connect to the router via wifi, and then serve as a hotspot?
Thank you
Hello, i can’t see why ethernet wall can’t work if it’s directly link to router :/ Maybe a rule on the port or something like that, i just dont know :/.
I presume it’s possible to use Wi-Fi instead of Ethernet, but you will probably need to modify some configuration to use a second Wi-Fi adapter instead of Ethernet for that.
The “And if it still does not work?” section can now be disregarded as the installation script has been fixed as of today. (See: https://github.com/billz/raspap-webgui/issues/174)
Basically, RaspAP’s quick installer script had a few bugs to prevent adding the IPv4 forwarding and the iptables lines to the /etc/rc.local file.
I did a test just now of the quick installer method (wget -q https://git.io/voEUQ -O /tmp/raspap && bash /tmp/raspap) on a clean Raspbian Stretch (2018-03-13) installation, and it worked fine without having to do anything in the “And if it still does not work?” section.
Okay, thanks for the return, we keep it for now as it may still help peoples. Maybe we will remove it in futur.
I have now read the last section of the tutorial to enable ethernet, making changes to the .conf files, but when i try save the changes made, I get an error saying “Cant open files to write”. Any idea what went wrong? Also how after turning off the hotspot do i turn it back on again?
Thanks in advance
Hello, probably need to do a sudo before your command.
I have followed the steps and the hotspot has appeared and I have connected to it however, there is no internet and when I type in the IP address you gave it requires a username and password. I tried the login details that I had setup on the rasp pi but that doesn’t work. Any idea what they could be?
As said in the tutorial login and password are available on the github page of the projet.
Hello,
I have successfully configured a wifi using above tutorial.
Now I wanted to remove hotspot password. Can I able to configure hotspot without password if yes how?
I presume it’s possible by empty it via the webinterface.
Do not empty the wpa_supplicant.conf file by running the below command:
sudo cp /dev/null /etc/wpa_supplicant/wpa_supplicant.conf
Instead edit the wpa_supplicant.conf file to contain only the following two lines:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
Because if you try to connect to a wifi client from RaspAP WebGUI , none will be visible.
https://cloud.githubusercontent.com/assets/13056292/18283917/ea7e5046-7467-11e6-99af-0b391e9b05b8.png
Thanks for your return, we will modify that !
Hi,
Thx for your tutorial.
Is it possible to enable DNSMasq?
We will configure DNSMasq to point all domains back to 10.0.0.1 to connect to our local server.
I’ve never tried, but it’s probably possible.
Hi,
I get “No wireless Interfaces found” on the RPi after I have done this, I followed this step but still no luck:
If, however, the network does not appear, find the IP of the raspberry pi, and connect to it via your web browser. You should arrive on the hotspot administration interface, the default password is shown on the github page of the software. Once connected, go to the “Configure Hotspot” section, and change the “Wireless Mode” field, this should solve the problem.
I can see the raspi-webgui network from my phone but cannot connect with the ChangeMe password but had no luck, tried from my laptop also.
Maybe a bad configuration in encryption protocol, etc. ?
Hi! I’ve installed the hotspot. I can successfully connect to it and access web UI. But there is no Internet, even though Raspberry Pi has access to Internet via Ethernet (i checked via Chromium – it’s working fine)
Hey, check that the hotspot is correctly set to use Ethernet as source for internet.
Hi I can successfully connect to it and access web UI. But there is no Internet, even though Raspberry Pi has access to Internet via Ethernet. But If I want to set up use Ethernet as source for internet at Network preferences, I get : “Error saving /etc/dhcpcd.conf access denied”.
The last section of this tutorial now fix this problem.
I have the same problem, No internet access. I visited all the options in the configuration web page but I did not find “how to use Ethernet as source for internet”. Please, place some screen shots about how to do it.
Last section of this tutorial should now fixed that problem.
I do know if this is a dumb question, however, I was wondering if after you have programmed the pi to be a WiFi hub, do you still need to have it hooked up via Ethernet to a router. Or, is it possible to take this with me to somewhere like the beach and have some WiFi? I would appreciate your response greatly, and I apologize for my poor grammar.
Hey, no you cannot have a Wi-Fi access to internet without a router from your FAI. Though, you could steel connect to the Raspberry Pi Wireless Network, but it will not give you access to internet.
Hi , I was able to see the raspi-webgui network in the list of available networks but when I try to connect it fails. I use the default password stated in the instructions (ChangeMe) and it seems that the networks accepts the password but overall does not succeed in providing internet. It shows a strong signal but again, can’t connect successfully,
Any help would be appreciated!
Hey, we just fixed that problem in the last section of the article.
Hello,
I have the hotspot all set up but it is not receiving or transferring any packets/data. The RPi 3B is connected to eth0 and is able to access the internet. When I connect to the hotspot through my iPhone it says there is no internet connection available. On the Hotspot Dashboard, in the Interface Statistics it shows that no data is being recieved or transfered. Is there a step I am missing where I have to connect the ethernet connection to the RaspAP module?
Please get back to me at my email, mbellucc@villanova.edu
We just add a new part to the tutorial to fix this specific problem.
Hi, this worked really nice, but there were 2 things I wanted to make clear
1. Can I use my other wifi interface? I’m using RPi3 with additional wifi dongle, after I modified hotspot configurations, I still can’t use other wifi interface. How can I access to that one
2. Is there anyway to start vpn/tor and use this wifi as “proxy-wifi” ?
After 3 days of straight work on network files and many, MANY websites, your way actually got this thing work. that was really awesome.
Hey, you should take a look at the github page of the project, you could probably find help.
Thank you so much