Skip to content

Using WiFi during IIAB Installation on the Pi 3 and W

A Holt edited this page Mar 1, 2018 · 5 revisions

Overview

  • On the Raspberry Pi, installation of Internet-in-a-Box (IIAB) usually starts with downloading the Raspbian OS from the Raspberry Pi Foundation — either the Graphical/Desktop or Lite version. The Lite version is most useful for installing without keyboard and monitor (headless), e.g. when working on the Pi Zero W to avoid special small cable adapters.
  • Use Linux, Windows, or a Mac to write this downloaded Raspbian image to an SD card. (links at bottom for different Operating Systems)
  • If you've installed the Graphical/Desktop version of Raspbian on an SD card, insert this directly into your Raspberry Pi. After booting, it provides a Wi-Fi configuration icon on the upper-right menu line. And a terminal screen is equally handy under the Raspberry menu top-left. This is all that's needed to get started with the Graphical/Desktop image: proceed to "IIAB's one-line installer instructions", about halfway down this page.
  • If your Raspberry Pi does not have an attached keyboard and screen, make changes to the SD card's FAT partition before you insert the SD card into the Raspberry Pi. (The first of the two partitions should be available on all platforms, as it's in the FAT format and pretty universally supported on Linux, Windows and Mac.)
  • Reinsert the SD card into your computer you used to write the image. The two steps below should permit you to connect to your Raspberry Pi using any ssh (Secure Shell) terminal session.
  • Create /etc/wpa_supplicant/wpa_supplicant.conf on the SD card, so that it contains the correct SSID and password, for the wifi Access Point that will provide your internet connectivity. Use either of these 2 methods:
    • Use the command line approach.
    • Is your RPi already live with a keyboard and screen? Enter command raspi-config -> 2 Network Options -> N2 Wi-fi.
  • The ssh server in the image is disabled by default. Enable it using either of these 2 methods:
    • Create an empty file named "ssh" in the root of the first partition on the SD card, and ssh will be enabled on its next boot.
    • Is your RPi already live with a keyboard and screen? Enter command raspi-config -> 5 Interfacing Options -> P2 SSH -> Yes. ("touch /boot/ssh" and then rebooting accomplishes the same.)
  • Put the SD card into the Pi, wait for up to 4 minutes (the Pi Zero W is slower). Log into the Pi using ssh:
   ssh pi@<Pi's IP address>      (password is raspberry, change it!)
  • Discovering your Pi's IP address can be easy or difficult depending on your situation. But there are a number of approaches. Often just typing the following into the terminal of a computer connected to the same network, will be sufficient: (Macs have a bonjour client you can run)
   ping pi.local

This uses the avahi server (mDNS/DNS-SD) running on your Pi (part of Raspbian).

Converting IIAB to a HOTSPOT

  • Successful completion of the 9+ IIAB installation steps (after ./iiab-install completes) will be indicated by the following on your screen:
   PLAY RECAP ******************************************************************
     127.0.0.1                  : ok=331  changed=218  unreachable=0    failed=0   

The "failed=0" is the only number that really matters. But don't worry if you the above went by in a hurry, as IIAB's one-line installer proceeds to the end, rebooting when done.

  • After successful completion, you can type:
   root@box:~# iiab-hotspot-on

This prepares the Wi-Fi in your Pi for both behaviors: (1) a hotspot (Wi-Fi Access Point) will be turned on, and (2) an internet-facing Wi-Fi client (can be turned on simultaneously with the above, see iiab-internet-on below).

  • Nearby Wi-Fi enabled computers can associate to the Pi's Wi-Fi SSID "Internet in a Box", and then login to the Pi over the air using:
   ssh [email protected]      (password is raspberry, change it!)
  • In general, an internet connection is not available, or even wanted, in many educational and medical environments. If however there's a Wi-Fi upstream internet connection available (assuming /etc/wpa_supplicant/wpa_supplicant.conf credentials are set properly), the following will connect your Pi to the Internet until next boot:
   root@box:~# iiab-internet-on

WARNING: There is a variable in vars/local_vars.yml named iiab_gateway_enabled. Its default is False, preventing student devices from reaching the Internet (a.k.a. pass-through or masquerading). This can be overridden (providing internet to student devices, until next boot) with command:

   root@box:~# iiab-internet-on --force       (or -f)
  • Plugging an Ethernet wire into the Pi accomplishes much the same as the "iiab-internet-on" command.
  • The "iiab-hotspot-off" command disables the Pi's Wi-Fi AP, and makes all the IIAB services available to the Ethernet wire.
  • Permanent upstream internet connection is possible by adding a 20 second delay, and the "iiab-internet-on" command to /etc/rc.local:
   # Print the IP address
   _IP=$(hostname -I) || true
   if [ "$_IP" ]; then
     printf "My IP address is %s\n" "$_IP"
   fi

   #added to enable upstream internet connectivity on every reboot
   sleep 20
   iiab-internet-on

   exit 0