Update remote_access.rst

This commit is contained in:
tpollina 2019-12-04 16:19:24 -08:00 committed by GitHub
parent 2cea563f7f
commit edf98f730e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,24 +33,75 @@ Install the packages for the standalone WiFi ::
$ cd RPi_Cam_Web_Interface $ cd RPi_Cam_Web_Interface
$ ./install.sh $ ./install.sh
#
.. _test_suite: #
#
#
#
Test suite
==========
If you wish to run the picamera test suite, follow the instructions in Setting up a Raspberry Pi as an access point in a standalone network (NAT)
:ref:`dev_install` above and then make the "test" target within the sandbox:: ==========================================================================
$ source sandbox/bin/activate The Raspberry Pi can be used as a wireless access point, running a standalone network. This can be done using the inbuilt wireless features of the Raspberry Pi 3 or Raspberry Pi Zero W, or by using a suitable USB wireless dongle that supports access points.
(sandbox) $ cd picamera
(sandbox) $ make test
.. warning:: Note that this documentation was tested on a Raspberry Pi 3, and it is possible that some USB dongles may need slight changes to their settings. If you are having trouble with a USB wireless dongle, please check the forums.
The test suite takes a *very* long time to execute (at least 1 hour on an To add a Raspberry Pi-based access point to an existing network, see this section.
overclocked Pi 3). Depending on configuration, it can also lockup the
camera requiring a reboot to reset, so ensure you are familiar with SSH or
using alternate TTYs to access a command line in the event you need to
reboot.
In order to work as an access point, the Raspberry Pi will need to have access point software installed, along with DHCP server software to provide connecting devices with a network address.
To create an access point, we'll need DNSMasq and HostAPD. Install all the required software in one go with this command::
sudo apt install dnsmasq hostapd
Since the configuration files are not ready yet, turn the new software off as follows::
sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
Configuring a static IP
=======================
We are configuring a standalone network to act as a server, so the Raspberry Pi needs to have a static IP address assigned to the wireless port. This documentation assumes that we are using the standard 192.168.x.x IP addresses for our wireless network, so we will assign the server the IP address 192.168.4.1. It is also assumed that the wireless device being used is wlan0.
To configure the static IP address, edit the dhcpcd configuration file with::
sudo touch /etc/dhcpcd.conf
chmod 777 /etc/dhcpcd.conf
Send the desired IP address to the end of the previous generated .conf::
echo "interface wlan0" >> /etc/dhcpcd.conf
echo " static ip_address=192.168.4.1/24" >> /etc/dhcpcd.conf
echo " nohook wpa_supplicant" >> /etc/dhcpcd.conf
Now restart the dhcpcd daemon and set up the new wlan0 configuration::
sudo service dhcpcd restart
Configuring the DHCP server (dnsmasq)
=====================================
The DHCP service is provided by dnsmasq. By default, the configuration file contains a lot of information that is not needed, and it is easier to start from scratch. Rename this configuration file, and edit a new one:
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo touch /etc/dnsmasq.conf
sudo chmod 777 /etc/dnsmasq.conf
Type or copy the following information into the dnsmasq configuration file and save it::
sudo echo "interface=wlan0" >> /etc/dnsmasq.conf
sudo echo " dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h" >> /etc/dnsmasq.conf
So for wlan0, we are going to provide IP addresses between 192.168.4.2 and 192.168.4.20, with a lease time of 24 hours. If you are providing DHCP services for other network devices (e.g. eth0), you could add more sections with the appropriate interface header, with the range of addresses you intend to provide to that interface.
There are many more options for dnsmasq; see the dnsmasq documentation_ for more details.
.. _documentation: http://www.thekelleys.org.uk/dnsmasq/doc.html
Reload dnsmasq to use the updated configuration::
sudo systemctl reload dnsmasq