1.2.3.1 Lab – Set Up PL-App on a Raspberry Pi Answers

1.2.3.1 Lab – Set Up PL-App on a Raspberry Pi (Instructor Version)

Lab Topology

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 10

Objectives

  • Set up a Raspberry Pi board as a The Prototyping Lab Application (PL-App) device
  • Use PL-App Launcher to provision and discover PL-App devices

Background

The IoT Security lab topology uses a Raspberry Pi that is connected to a PC. The PC will be used to work with Python and Jupyter notebooks that are running on the Raspberry Pi. In addition, for some labs, the PC will run a virtual machine (VM) that interacts with the Pi.

PL-App consists of two components. The first is the PL-App launcher application that runs on the PC. It is used to provision a PL-App image that is written to a microSD card (µSD) card for the Raspberry Pi. In addition, PL-App runs on the Raspberry Pi. It contains the Jupyter notebooks software and enables access to the notebooks and other functions of the Raspberry Pi.

With PL-App, you can access existing IoT Fundamentals labs in the Course Materials folder or write your own new applications directly on the Raspberry Pi, execute them, and monitor the output from the board with various visualizations.

Required Resources

  • PL-App Launcher application
  • PL-App Image file
  • Wired Ethernet or Wi-Fi connection to the local-area network with DHCP
  • Raspberry Pi with a power adapter
  • Google Chrome or other modern web browser
  • 8GB µSD
  • USB to µSD card reader

Part 1: Setting up the PL-App

Step 1: Download and Install the PL-App Launcher.

a. Navigate to www.netacad.com in your web browser and access your IoT Security class.

b. From the Student Resources page, download the PL-App Launcher application installer for your operating system.

c. After a successful download, install the PL-App Launcher application.

Note: Windows 7+ and Mac OS are supported. See the procedure at the alternate step 4 for manually installing PL-App on a Linux computer from the command line.

d. After a successful installation, start the PL-App Launcher.

Step 2: Download and Install the PL-App Image.

From the Student Resources page, download the PL-App image zip file. Although the PL-App image is a file with a .zip extension, there is no need to unpack the ZIP file.

Note: The PL-App image file is large and the download speed will vary based on your Internet connection.

Instructor Note: In a classroom with multiple computers, consider distributing the PL-App image file using a USB memory stick or using a local file server.

Step 3: Set up a micro SD card with PL-App.

a. Start the PL-App Launcher application. You should see the following screen with the Setup a New Device tab selected:

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 11

b. Obtain a µSD card that is at least 8 GB in size.

c. Insert the µSD card into your SD card reader and insert it into your computer.

d. Determine the drive letter of the µSD card using the file explorer.

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 12

e. In this example, it is the D: drive.

f. In the PL-App Launcher, select the µSD Card Removable Drive, in this example select the [D:\] drive. If not present in the menu, click the Refresh button.

Be careful to select the correct drive; if you select the wrong drive, you might destroy your data on the selected drive.

g. Click the Find Image: Browse button in the application and select the PL-App image zip file that you downloaded.

Step 4: Configure the Image.

a. To personalize the PL-App installation on the µSD card, enter the configurations section of the PL-App Launcher application and configure:

  • Device Name – This is the name of the PL-App Raspberry Pi instance on your LAN. Make sure the selected device name is unique on the LAN, otherwise naming problems might occur. For example, you can use your name followed by a number, or your username, or initials (e.g. myname-myRPi1). The Device Name can contain letters (a-z), numbers (0-9) and dashes (-). The first character must be a letter.
  • Device Password – This is a password that you will need to enter when accessing PL-App on the Raspberry Pi. The password is stored in its clear-text form on the µSD card. For security reasons, always use a unique password (i.e. never use the same password as your email, social media, netacad.com, etc.).

Instructor Note: PL-App Launcher can also be used to find Raspberry Pis on the network and provide an easy way to connect to them. However, PL-App Launcher will only list the devices that are running images that were created on a specific computer. In other words, if a Raspberry Pi is connected to a computer other than the one on which its PL-App image was created, it will not appear in the list of Available Devices (see below). It is possible to manually enable PL-App Launcher to find other Raspberry Pis on the network, however the device name must be known. For this reason, it is important to make note of the device names provided to the PL-App images.

b. If your Raspberry Pi will be connected to the network over Wi-Fi, enter the optional settings section and configure the following:

  • Wi-Fi SSID – The name of the Wi-Fi network to join (e.g. ClassroomWiFi)
  • Wi-Fi Password – The WPA2 Pre-Shared Key

c. When your settings are correct, click the Write Disk Image button to write the PL-App image to the selected SD card. This will overwrite all data on the card. The process will also write your configuration settings to the SD card in a file called chestnut.txt. Depending on the speed of your µSD card, this process might take 5-10 minutes to complete.

Note: If the µSD card has already been flashed with the PL-App image, and you only want to change the existing settings (e.g. Device Name, Wireless Settings, etc.), then click the Update Config Only button to update only the setup configuration.

d. When the µSD card setup is complete, use the file explorer to verify the contents of the µSD card. You should see the µSD card drive name has changed to CISCO-PLAPP.

e. Explore the µSD card drive. You should see the notebooks folder and the chestnut.txt setup file:

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 13

  • The D:\chestnut.txt file contains the setup information that was created using the PL-App Launcher. If you need to change any of these settings, you can either use the PL-App Launcher with the Update Config Only button to update these settings and preserve all the other contents of the SD card, or edit this file manually.
  • The D:\notebooks\Course Materials folder contains all the default notebook files that were bundled with the release of the PL-App image that was flashed on the µSD card. If you want the most recent, or unmodified, version of the lab notebooks, download the notebooks zip archive from the course page and unpack it to the D:\notebooks\Course Materials\coursename folder (the drive letter D: might be different on your computer). You can also easily backup either your own notebook files, or the Course Materials, by copying this folder to your computer.

f. You will need secure shell (SSH) access to your Raspberry Pi in later labs. SSH can be enabled by placing an empty file named ssh in D drive (D:\ssh). When the Raspberry Pi boots, SSH is enabled when the file is found, and the file ssh is deleted from the file system.

g. Before removing the µSD card from your computer, make sure to safely unmount it by right-clicking the drive and selecting Eject USB Storage.

h. Remove the µSD card from your computer.

Alternate Step 4 for Advanced Linux users: Setup a µSD card with PL-App

This is a command-line only guide for advanced Linux users. Be very careful. Incorrect use of these tools might overwrite the data on your primary hard disk. All the existing contents of the µSD card will be overwritten in this step.

a. Change the current working directory to the location of the PL-App image zip file that you downloaded previously:

cd Downloads

b. Identify the device name of your µSD card (e.g. sdb):

sudo fdisk –l

c. Check if any of the µSD card partitions are mounted using the mount command and then unmount them.

d. Using dd, transfer the PL-App image to your µSD card (Use caution at this step. Selecting a wrong output file “of=” parameter can overwrite your own hard disk drive and your own data):

unzip -p -d chestnut.img PL-App-xxxxxx.zip | sudo dd bs=1M of=/dev/{SD card device name}

e. Wait for dd to complete. It might take 5-10 minutes without showing any output. Be patient.

f. When completed, remove the µSD card USB reader, wait a second, and then plug it back in to mount the newly created partition on it.

g. In the mounted µSD card partition (with FAT file system and 1 GB in size), create a new text file called chestnut.txt in the CISCO-PLAPP with the following contents:

Device_Name="{YOUR-NETACAD-USERNAME}-{YOUR-RPi-DEVICE-NAME}"
Device_Password="{YOUR-PL-App-PASSWORD}"
SSID="{YOUR-WIFI-SSID}"
Wifi_Password="{YOUR-WIFI-PASSWORD}"

Example:

Device_Name="myNetAcadUsername-myRPi1"
Device_Password="this is my device password"
SSID="ClassroomWIFI"
Wifi_Password="WPA2password"

h. You will need secure shell (SSH) access to your Raspberry Pi in later labs. SSH can be enabled by creating an empty file named ssh in CISCO-PLAPP partition. When the Raspberry Pi boots, SSH is enabled when the file is found, and the file ssh is deleted from the file system.

touch ssh

i. Unmount and remove the µSD card USB reader from your computer.

j. Make sure your Linux computer supports mDNS discovery of hostnames:

sudo apt-get install libnss-mdns

Part 2: Accessing PL-App on a Raspberry Pi on the Network

a. Make sure that the Raspberry Pi is powered off. Insert the µSD card into your Raspberry Pi. The µSD card slot is on the underside of the board:

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 14

b. Before entering or removing the µSD card, always make sure that the Raspberry Pi is powered off.

c. Connect the Raspberry Pi to the LAN. If you are using an Ethernet cable, connect the cable to the Raspberry Pi. Your computer and the Raspberry Pi must be in the same subnet for the PL-App Launcher discovery to work.

Note: Some labs require Internet connectivity, so a separate Internet connection is desirable.

Instructor Note: The LAN should provide IP addresses to the Raspberry Pi devices using DHCP. In addition, the network must not block multicast communication. Auto-configured APIPA addresses may also be used for labs that do not require a connection to the Internet or other LAN resources.

d. Recommended network topology for a classroom with PL-App:

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 15

e. Power on your Raspberry Pi by connecting the micro USB cable with a power supply that provides enough current to the Raspberry Pi board. The recommended PSU provides 2.5A to power the Raspberry Pi 3 Model B.

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 16

Note: The red Power LED must be on. If the Power LED is blinking, or is off, the power source from the PSU is not providing enough power to the board.

f. Start the PL-App Launcher application on a PC that is on the same network as the Raspberry Pi. You should see the following screen with the Available Devices tab:

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 17

g. The Available Devices tab lists all the PL-App devices that have been set up on this computer with PLApp Launcher, or that were manually added to the list using the Add Device Name button.

PL-App Launcher is continuously trying to discover the listed PL-App Raspberry Pi devices even if they are not connected to the network. When a device is discovered, its current IP address is shown in the list and the Connect button turns green.

Note: The first startup of a freshly written µSD card might take longer to connect due to the initial setup process (expanding the file system of the µSD card, etc.).

Instructor Note: PL-App Launcher is using multicast DNS (mDNS, Bonjour) to discover the listed PL-App Raspberry Pi devices. Without mDNS routing configured, the discovery mechanism only works within the same one subnet segment. If the network is blocking multicast communication, PL-App Launcher will be unable to discover connected devices. In that case, try to select the “Use Broadcast mDNS option” in the PL-App Launcher to fallback from multicast to broadcast packets.

As mentioned above, only PL-App images created on the computer will show up in the list of available devices. Devices can be added manually, however the device name must be entered to enable this.

h. Click the green Connect button of your device in PL-App Launcher to directly connect to the local PL-App web interface that is running on your Raspberry Pi. This opens a new web browser window and establishes a connection to the selected PL-App over HTTP.

i. Log in to the web interface of PL-App. Use the device password you specified in PL-App Launcher in the setup process of the µSD card.

After a successful login, the PL-App directory browser opens the root directory of the notebooks:

1.2.3.1 Lab - Set Up PL-App on a Raspberry Pi Answers 18

This is the PL-App’s representation of the notebooks folder that was created on the µSD card.

The basic structure of the folders in the root notebooks directory is as follows:

  • Course Materials: this folder contains Cisco authored labs in the form of Jupyter Notebooks.
  • myfiles: this folder is your space to create your own Jupyter Notebooks and other files.

Appendix: Troubleshooting PL-App

a. Make sure the computer with PL-App meets these criteria:

  • On the same subnet as the PL-App Raspberry Pi
  • Not connected to VPN

b. If the onboard Red Power LED is anything but solid on (blinking, off, etc.), replace the PSU. The PSU is unable to provide enough power for the Raspberry Pi.

c. If the onboard green µSD card LED is constantly off or constantly on (more than 30 seconds) perform these steps:

  1. Check that the SD card is correctly inserted in the SD card slot on the underside of the Raspberry Pi board.
  2. Re-flash the µSD card with PL-App Launcher and the PL-App image.
  3. Replace the µSD card. It has been found that some SD cards are not compatible with the Raspberry Pi.

d. Verify the µSD card drive on a computer. Check the chestnut.txt file in the root directory of the µSD card drive. Verify that the Device_Name specified in chestnut.txt matches the PL App device name in the PLApp Launcher Devices tab.

e. If connecting with Wi-Fi, perform these steps:

  1. Verify the network name (SSID) and corresponding WPA2 password in chestnut.txt.
  2. Connect to the network with an Ethernet cable (connect the computer too).
  3. Check if multicast is enabled on the Wi-Fi network.

f. If connecting with an Ethernet cable, perform these steps:

  1. Make sure multicast is not blocked or filtered.
  2. Make sure DHCP is assigning IP addresses from the same subnet to the Raspberry Pi and the computer.

g. Try to connect to a different Raspberry Pi board.

 

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x