Advertisements

How to Convert Raspberry Pi into a Captive Portal Wifi Access Point

In this guide, I will tell you how to convert Raspberry Pi into a Captive Portal WiFi access point. This means you can access the internet by entering some credentials on Raspberry. The latter will act as a router. It’s the same process when you try to use the internet in an airport. When you try to access a website, a webpage greets you to enter credentials to connect to the native network to continue your browsing.

For this, you have to use Raspberry 3 or Raspberry 4 for they come with Ethernet port. You have to use the latest OS version of Raspberry. Next, set up an access point using RaspAP software. Then you have to create and configure a captive portal. I have described all the steps in this guide. So, you can follow them and convert your Raspberry Pi into a captive portal WiFi router.
Raspberry Pi conversion into A Captive Portal Webpage

Related | How to Install LineageOS 16 on Raspberry Pi 4

Convert Raspberry Pi into a Captive Portal Wifi Access Point

Let’s carry out each of the steps one-by-one. But before beginning here is a list of things you need to accomplish the goal of this guide efficiently.

Pre-Requisites

  • Raspberry Pi
  • External monitor
  • Ethernet cable.
  • A Raspberry compatible Power cable
  • External keyboard
  • HDMI Cable
  • Install RaspAP program

Also Read: How to Install CentOS on a Raspberry Pi?

Update Raspberry Pi OS

Here are the steps.

  • Connect your monitor, external keyboard, and the ethernet cable.
  • Use some source of power to connect Raspberry pi. Boot it up
  • Open terminal and type the following command
    sudo apt update && sudo apt -y upgrade
  • Give this command to reboot the Pi
    sudo reboots

That’s it your device is now up-to-date.

Creating A Wireless Access Point

First, you need to install RaspAP. Here is the command to do it

  • Open terminal and type the command
    curl -sL https://install.raspap.com | bash
  • Post-installation you have to reboot your Pi. Give this command for that.
    reboot

Now, as the access point is set up, you should be able to see its attributes. This is how it should be.

Raspberry WiFi Access Details

  • IP address: 10.3.141.1 [default IP for RaspAP]
  • Username: admin
  • Password: secret
  • SSID: raspi-webgui
  • DHCP range: 10.3.141.50 to 10.3.141.255
  • Wi-Fi Password: ChangeMe

Go to any device with Wi-fi enabled on it. Go to its available networks page to see a new network is available. Its name is the same as that of SSID I have mentioned above. Its raspi-webgui. You can even connect to it by entering the credentials that are the SSID and the password.

Now, the thing is the password above is pretty simple and of course not secure at all. So, you have to change it.

Advertisements

Make the Access Point Secure

  • Use the web browser and enter the IP address in the URL section and hit enter
  • Then put the username and the password of the newly set Pi
  • You will be re-directed to the RaspAP web interface
  • On the left-hand side panel select Hotspot
  • Then under that, click on the Security tab
  • You should see a section called PSK. Click on it
  • Here you have to enter your new password for Raspberry Pi.
  • Once you finish, then click on Save Settings

Setting Up the Captive Portal

Now, you have to install a package to compile the Nodogsplash captive portal program.

  • On the Raspberry Pi terminal, write and execute the following command
    sudo apt install git libmicrohttpd-dev
  • Copy the repository consisting the Nodogsplash code fragment
    cd ~
    git clone https://github.com/nodogsplash/nodogsplash.git
  • Next, you have to install Nodogsplash
    cd ~/nodogsplash
    make
    sudo make install

Captive Portal Configuration

Above we have the RaspAP IP address 10.3.141.1. Now, we have to configure the same into the Nodogsplash settings.

  • To open the Nodogsplash configuration, write the following command
  • Make the following changes
    GatewayInterface wlan0
    GatewayAddress 10.3.141.1
    MaxClients 250
    AuthIdleTimeout 480
  • To save the changes press Ctrl +o and Ctrl + x
  • Launch the captive portal with this command
    sudo nodogsplash
  • Now, as you try to connect your captive portal to the available hotspot, you will land at the default captive portal page of nodogsplash.

How to Keep the Portal Online.?

Our next target is to keep this captive portal active post every access to Raspberry Pi. This means Nodogsplash will launch automatically when you boot up your device. For that, you have to edit the rc.local file.

Advertisements
  • Open the terminal and type the following
  • Find the line where it mentions this code exit0
  • Just above that type the following
    nodogsplash
  • Now, use Ctrl + o and Ctrl + X to save your changes

Guide | Install LineageOS 14.1 on Raspberry Pi 3

So, that’s all you need to know to convert the Raspberry Pi into a captive portal WiFi access point. If you have the device, then try this out.

You May Like,

source taken from GitHub

Leave a Reply

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

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