Building a standalone access point using a Raspberry Pi Zero W

Similar documents
Raspberry Pi 3 Model B+ and JMRI with WiFi Access Point for Pi- SPROG One and Pi-SPROG Nano raspian-stretch build

Raspberry Pi 3 Model B and JMRI with WiFi Access Point for Pi-SPROG One and Pi-SPROG Nano raspian-jessie build

dnsmasq configuration

Raspberry Pi 3 Model B and JMRI with WiFi Access Point for Pi-SPROG One and Pi-SPROG Nano

Digital Free Library. Created by Kirby Griese. Last updated on :35:15 PM UTC

Raspberry Pi as a VPN Wireless Access Point

Lab 0: Intro to running Jupyter Notebook on a Raspberry Pi

My guide for setting up a raspberry pi zero w as a wifi rerouter and access point

Setting up a Raspberry Pi as a WiFi access point

Setting up a Raspberry Pi as a WiFi access point

XLink Kai Raspberry Pi Beginners Tutorial

RaspiDigiHamClock. Raspberry Pi Amateur Radio Digital Clock. v WA4EFH R.Grokett

Getting started with Raspberry Pi (and WebIoPi framework)

#Uncomment the second line to enable any form of FTP write command. #write_enable=yes

Connect the GSM-DSA to a router where the network is configured to x with a mask

Microprocessor-Based Systems (E155)

RETROPIE INSTALLATION GUIDE

Raspberry Pi NTP Clock Setup Guide

Raspberry Pi Setup Tutorial

Topics. What is a RaspberryPi? Why should I want one? What is Raspbian? What is SSH? What is FTP? What is LAMP? Making a LAMP Stack!

Sigma Tile Workshop Guide. This guide describes the initial configuration steps to get started with the Sigma Tile.

Adafruit's Raspberry Pi Lesson 1. Preparing an SD Card for your Raspberry Pi

Adafruit's Raspberry Pi Lesson 6. Using SSH

High Voltage Module Raspberry Pi Documentation Page 1

Experimental Procedure. Frequently Asked Questions (FAQ) Kit General Questions. Setting Up and Using Your Raspberry Pi Projects Kit

Raspberry Pi 3 Starter Kit Hookup Guide

PiCloud. Building owncloud on a Raspberry PI

Software gsv-6towamp. Access data for the demo installation. Structure of the software

More Raspian. An editor Configuration files Shell scripts Shell variables System admin

Preparing SD card for Pi

UDRC Step by Step Installation Process as Completed by Rich KR4PI

Communication protocols and services

How to Make a Raspberry Pi Web Server

TELE3119 Trusted Networks Lab 1 (a), (b) Sniffing wireless traffic

The software is modular, which means that components can be exchanged more easily. WAM P- Router

Setup Guide for Hard-Wire Ethernet Connected TP-Link TL-WR841N 300 Mbps Wireless N Router AARP Foundation Tax-Aide Colorado Technology Specialist

Setup Wireless LAN (WLAN) on the Raspberry Pi

Installation guide. Step1. Install the OS for Raspberry Pi 3. Go to to download Raspbian to the PC.

WISP Setup Guide for TP-Link TL-WR841N 300 Mbps Wireless N Router AARP Foundation Tax-Aide Colorado Technology Specialist

Wireless Access Point

Adafruit PiUART - USB Console and Power Add-on for Raspberry Pi

NANO-SPOT Personal Digital Hotspot

Adafruit WebIDE. Created by Tyler Cooper. Last updated on :29:47 PM UTC

Adafruit NFC/RFID on Raspberry Pi

Experiments 1 How to set up Raspberry Pi B+ The little computer you can cook into DIY tech projects

Adafruit NFC/RFID on Raspberry Pi

Bluetooth Keyboard Setup Instructions

You will need to know the IP address or the hostname of the pi (as discussed above) to continue and login to your pi via putty over Ethernet.

5inch HDMI LCD (B) User Manual

We want to install putty, an ssh client on the laptops. In the web browser goto:

Access New Campus Wi-Fi Using: Apple iphone/ipad

Linux Systems Administration Getting Started with Linux

Remote Control for Telescope

Setting up a Raspbian Linux System on an SD Card

Migrating the Cisco StadiumVision Director Server Environment to Platform 2 from the Cisco ADE 2140 Series Appliance

Davide Cavaliere 18 th February 2017

A Step by Step Guide to Installing VPN on Raspberry Pi. Whitepaper

Raspberry Pi 2b PART 1. Table of Contents. Step by step guide. 1. Hardware (0:05) RS Online (ex-tax prices)... 3 MSY ebay...

Wallet Installation Guide for Staking on Raspberry PI

O ptima S aver P i. User Guide. January 2017 Version 1.0

L.A.M.P. Stack Part I

Node-RED Dashboard: Pi Control

Overview of the Raspberry Pi Models 3B & 2B

Spreedbox Getting Started Guide

CMSC 201 Spring 2017 Lab 01 Hello World

INTRODUCTION. To avoid the PHP7 conflicts use this OS image: STEP 1 - Parts List:

Security Camera. by maartenbrysbaert. The SeCam is a security camera that allows you to: - Livestream. - Rotate your camera 180 degrees

Creating a Yubikey MFA Service in AWS

10.1inch HDMI LCD (B) User Manual

Manual of ET-LCD SW HAT

ELE409 SPRING2018 LAB0

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

How to set up your wireless network

D, E I, J, K. Generalized Regular Expression Parser (GREP), 110 Generic 105 key (Intl) PC, 29 git command, 242

Raspberry Pi WiFi Radio

Hands-on Labs using the WLAN Pros ODROID Performance Testing Device

Adafruit's Raspberry Pi Lesson 1. Preparing an SD Card for your Raspberry Pi

A Slice of Raspberry Pi

Lab 1: Accessing the Linux Operating System Spring 2009

Manual to install experimental firmware on a TYTERA MD380

Installing MediaWiki using VirtualBox

IoTivity Development on ARTIK 530s

Gooligum Electronics 2015

Installing and Upgrading Cisco Network Registrar Virtual Appliance

Microprocessor-Based Systems (E155)

Contents. Crave Masternode Setup Guides. Single / Multiple Local Masternode(s) Single Masternode using a VPS. Multiple Masternodes using a VPS

This tutorial will guide you how to setup and run your own minecraft server on a Linux CentOS 6 in no time.

Setting up a Chaincoin Masternode

Networked Thermal Printer using Raspberry Pi and CUPS

ZUMspot/Pi-Star Bring-up and initialization Presented to PAPA SD Luncheon. David Hull, KC6N January 20, 2018

Node-RED Dashboard: Pi Control

CMSC 201 Spring 2018 Lab 01 Hello World

Computer Password Remote

iptables and ip6tables An introduction to LINUX firewall

Instruction with Screenshot for WEB

How To Force Restore A Computer That Won Boot Up After System

WA2572 Introduction to Responsive Web Development for Mac. Classroom Setup Guide. Web Age Solutions Inc.

Day 1 IT Network Systems Administration Trade 39 WSC 2011 London

Orchid Fusion VMS Installation Guide

Thank You for purchasing our firmware. This guide aims to guide you one step at a time to mod your Seagate Wireless Plus(W+)!

Transcription:

Building a standalone access point using a Raspberry Pi Zero W by Barry Robinson The Raspberry Pi Zero W is a small, single board computer (SBC) that has WiFi and Bluetooth connectivity built-in. It is cheap, at $10 U.S. and runs the Linux open-source operating system (OS). You can program the Pi in a variety of languages including Python and C++. The Pi has a 40 pin general purpose input/output (GPIO) that take boards called hats. A Pi hat is installed by pushing it onto the GPIO pins; easy! One example of a Pi hat is a motor controller; these are priced as low as $20 U.S. and can control several motors. In the following I ll describe how to set up the Pi Zero as a standalone access point. A standalone access point is a WiFi connection, usually to the Internet. In this case, the access point does not connect to the Internet but does connect to an Apache web server that can serve active (PHP) web pages and run CGI (Computer Gateway Interface) scripts. What good is this? It lets you control devices using any device which has WiFi and a web browser. You don t need to download any special apps, just use web pages to do what you want. This means most smart phones, tablets, laptops and other devices. What you do, or can do, with this is left up to your imagination. Note: The command "sudo" gives the user the permissions of the superuser. Since you own the Pi (and Pi doesn't know any better) you CAN logon as the superuser but this is generally not a good idea. The superuser can change anything and it is easy to make a mistake and mess up your operating system when you are logged in as the superuser. It won't physically damage the Pi but it may cost you time and cause you frustration. sudo is a safer way of executing some system commands since it only gives you permission once each time you call it. Think of sudo as (s)uper (u)ser (do). It prefaces the commands that it provides permission to run. For example: sudo chmod 666 anyfile In the above example sudo lets the user change the permissions on a file called anyfile using chmod. You ll also see a program called nano; this is a simple text editor available on the Raspberry Pi operating system. get a Raspberry Pi Zero W (built-in WiFi and Bluetooth) download and install PuTTY on your computer. This is a free (GPL license) terminal program. 8GB SD micro card 1 P a g e

get Raspian lite image. Raspian is a distribution ( distro ) of Linux built for the Raspberry Pi. The lite refers to the small size and simplicity of this particular distro. Format the micro SD card then image the SD card with the Raspian image. I use SDFormatter and Win32DiskImager; both are Windows programs. Raspian lite is a command line based system; no fancy-pants graphical user interface (GUI) that will slow down the OS. The Pi is quite impressive for what it is but it is not as powerful as a current desktop or laptop computer. Using your computer, open the image on the SD. If you ve used your computer to put the image on the micro SD card, you can just leave it in the card reader and open it from there. I'm using Windows; if you're using something else you will have to figure it out for yourself. The image should open in the boot folder. Right click with mouse and select "New" > "Text file" Name the file "wpa_supplicant.conf". DO NOT USE the ".txt" extension, use ".conf" instead. The program will ask you "If you change a file name extension, the file might become unusable. Are you sure you want to change it?" Click on "Yes" to accept the file name change. Click on the wpa_supplicant.conf file you've created; it should open in Notepad. Add the following lines: ctrl_interface=dir=/var/run/wpa_supplicant GROUP=netdev update_config=1 country=ca network={ ssid="ssid" psk="password" scan_ssid=1 } The SSID and PASSWORD can usually be found on your wireless modem. These two items must be in quotes as shown. Do not add any spaces between the "=". The country code given is for Canada, change for the country where you are. Save the file and close Notepad. Right click again and select "New" > "Text file" Name file "ssh". There is no file extension; DO NOT USE the ".txt" extension. The program will prompt you to accept the change. Leave the ssh file empty. Find the "config.txt" file; it already exists. Now click on the "config.txt"; it will open in Notepad. You may find it easier to open this file in Wordpad due to the 2 P a g e

formatting. Either program seems to work. Scroll down to the end of the file and add in the two following lines: # Enable UART enable_uart=1 Now eject the SD card and insert into your Pi Zero W. Power up your Pi Zero W with a recommended 5vdc power supply connecting to the micro USB port near the end opposite of the SD card holder. The green LED should begin blinking. Wait 2 minutes for the OS to load, then connect to the Pi with PuTTY using the following. Port: 22 Connectiion type: SSH Host name: pi@raspberrypi.local You may be warned about a POTENTIAL SECURITY BREACH! especially if you've reset the Pi (the server's host key doesn't match the one that your terminal program has in the registry) Don't worry, just proceed. The login will prompt you for a password which is "raspberry" (without quotes). Enter the password. You are now logged into your Raspberry Pi over a WiFi connection and you are connected to the Internet. Now you can update and upgrade your system. Note: The system may ask you to approve updates/upgrades that take space on your system. Answer yes. Each command below is run separately. The script raspi-config lets you configure your system. sudo apt-get update sudo apt-get upgrade sudo raspi-config Expand filesystem using "Advanced Options" from the menu. Check keyboard installation using "Localisation Options" from the menu. Correct as necessary. Enable I2C and Serial interfaces using "Interfacing Options". Finish raspi-config and reboot the Pi. You may be given the option to reboot by raspi-config or you may use the following command to reboot: sudo shutdown -r now Wait a couple of minutes for everything to reload then reconnect to the Pi using PuTTY. You're ready to install the Apache web server so enter the following. 3 P a g e

sudo apt-get install apache2 Find your web address with the following: hostname -I Enter the web address in your desktop browser and you should see the Apache home page. Your web server is working. Now add MySQL database server and Python support. sudo apt-get install mysql-server python-mysqldb Now you can install php for active web pages: sudo apt install php php-mbstring Now begin the setup as an access point: sudo apt-get install dnsmasq hostapd Then stop the new software from running (at least for now): sudo systemctl stop dnsmasq sudo systemctl stop hostapd Now configure a static IP address. First, open the configuration file: sudo nano /etc/dhcpcd.conf Add this to the end of the file: interface wlan0 static ip_address=192.168.4.1/24 Save the file and restart the dhcpcd service: sudo service dhcpcd restart Get rid of the dnsmasq configuration file and make a new one: sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig Open the new file with nano: sudo nano /etc/dnsmasq.conf 4 P a g e

Add the following: interface=wlan0 # use wlan0 wireless interface dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h Configure hostapd by opening the file with nano: sudo nano /etc/hostapd/hostapd.conf And add this: interface=wlan0 ssid=nurse123 hw_mode=g channel=7 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=nurse123 wpa_key_mgmt=wpa-psk wpa_pairwise=tkip rsn_pairwise=ccmp Note: In the above I have made my SSID nurse123 and my wpa_passphrase nurse123 to be the same and very simple since I want to let people log into the access point very, very easily and I'm not concerned with security since I am not connected to a public network and I am usually using this in a restricted area. If you are concerned about security, don't do this!! Open: sudo nano /etc/default/hostapd Where to find the configuration file, modify the line DAEMON_CONF as follows: DAEMON_CONF="/etc/hostapd/hostapd.conf" Start these services one at a time: sudo systemctl start hostapd sudo systemctl start dnsmasq 5 P a g e

Open the following: sudo nano /etc/sysctl.conf Uncomment (that is remove the # from in front of the line) the following line: net.ipv4.ip_forward=1 Add a masquerade for eth0 (your hardwired connection if you are using one): sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE sudo sh -c "iptables-save > /etc/iptables.ipv4.nat" Open: sudo nano /etc/rc.local Add the following just before the "exit 0" line: iptables-restore < /etc/iptables.ipv4.nat Rename your wpa_supplicant.conf to wpa_supplicant.conf.orig (the following is all on one line and is one command): sudo mv /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.orig If you do not do this step, the Pi will still be connected to your original network! Once you do this you will not be able to access the Internet unless you use a wired connection. Reboot the Pi. Use: sudo shutdown -r now Wait about 2 minutes and then connect to the network. You use whatever you have programmed. In my example I use as my SSID nurse123 with the passcode nurse123 When you want to shut down your Raspberry Pi be sure to use shutdown before powering down the Pi so you don't corrupt your SD card. Use: sudo shutdown now You can log in via a terminal program using SSH through port 22 at 192.168.4.1 as user pi@192.168.4.1 You can use the browser to see the webpage (index.php or index.html) at http://192.168.4.1 6 P a g e

Place your webpages (html or php) in the directory /var/www/html Your browser will always go to index.php or index.html as the home page. Create sub directories for images or downloads. Be sure to give yourself pi permission to use this directory. For those using CGI scripts/programs the CGI directory is at /usr/lib/cgi-bin To transfer files using the following on any FTP client: Host/IP/URL the IP address for your Pi, use hostname -I to find this Your username/password. Your username should be "pi" unless you've changed it. Port 22 (same as for SSH) Connection type is SSH/SFTP Assuming you have not changed your user name from "pi" do the following: mkdir /home/pi/ftp mkdir /home/pi/ftp/files sudo chmod a-w /home/pi/ftp When you connect with SFTP go to the /home/pi/ftp/files directory. The above commands give you permission to transfer files as "pi" Have fun, be brave, and be creative. 7 P a g e