Question
Rpi3B+ Stretch9 WiFi Station + AP IOT Hotspot Docker Setting Up Problem
Short Answer
1. WiFi Station + AP IOT Hotspot Based Config API Setup Notes V1.0
Now I am doing the first step of setting up - Installing the docker.
This setup step is summarized in Appendix H below.
Update 2019jun25hkt2104
Docker Hello World running OK, though I don't know what is going on. Need to google again before moving on.
/ to continue, ...
Long Answer
Introduction
The OP's setup involving docker is a bit complicated. I need to do
much research before I can duplicate his setup and tried to find the
problem.
I have heard about the Docker thing for some time, but I have never
tried it. Just now I skimmed the wikipedia and guess that it is sort
light weight and therefore space/time/process efficient virtual
machine thing like the very old guy System 360 VM. Microsoft also has
similar light virtualization stuff. Perhaps I start learning by doing, sort of MIT style ...
One thing I don't understand is why the Wifi called "IOT WiFi". Anyway, I think I can start messing around without understanding everything. I am a huge fan of Oliver Heaviside. I always remember him saying the following:
Am I to refuse to eat because I do not fully understand the mechanism
of digestion? - Heaviside
Research Notes
Engineering Experimentation Notes
References
Rpi3 WiFi Station + AP IOT hotspot based configuration API – Craig Johnston 2018mar15
About Craig Johnston
Rpi3 As Wireless Client And Wireless AP – Raspberry Pi forum thread
Tutorial on Setting up a Raspberry Pi as a WiFi access point – Adafruit
How to connect to a WPA/WPA2 WiFi network using Linux command line – linuxcommando
Automatically connect a Raspberry Pi to a Wifi network – weWorkWePlay
Docker - Wikipedia
Go - Wikipedia
Virtualisation – Wikipedia
WAP (Wireless Access Point) - Wikipedia
Hotspot (Wi-Fi) - Wikipedia
12. Setting up a Raspberry Pi as an access point in a standalone network (NAT) - Rpi
13. cjimti iotwifi giihub
14. No Internet on AP - zeyadtarek 2019jun23
15. Wireless repeater - Wikipedia
16. Wireless (Network) Bridge - Wikipedia
17. Access point as WiFi router/repeater, optional with bridge
Appendices
Appendix A - WiFi Station + AP IOT HotsSpot (Craig Johnston) Learning Notes
IOT Wifi is very small/8MB Docker Container built for the
Raspberry Pi 3. IOT Wifi exposes a simple JSON based REST API for
controlling the wireless network interface. This container allows
the Raspberry Pi to accept wifi connections as an access point (aka
AP) while at the same time connecting to an existing wifi
network (station mode).
Go (Golang) was used to develop the main application code, to produce
a minimal docker image with great performance. The container runs
Alpine Linux with small, optimized versions of hostapd,
wpa_supplicant and dnsmasq, controlled by the container’s API
endpoints.
Appendix B - Docker - Wikipedia Learning Notes
Docker is a set of coupled software-as-a-service and
platform-as-a-service products that use operating-system-level
virtualization to develop and deliver software in packages called containers. The software that hosts the containers is
called Docker Engine.
Containers are isolated from each other and bundle their own software,
libraries and configuration files; they can communicate with each
other through well-defined channels. All containers are run by a
single operating-system kernel and are thus more lightweight than
virtual machines. Containers are created from images that specify
their precise contents.
Appendix C - Virtualization - Wikipedia Learning Notes
OS-level virtualization refers to an operating system paradigm in
which the kernel allows the existence of multiple isolated
user-space instances. Such instances, called containers ...
may look like real computers from the point of view of programs running in them. A computer program running on an ordinary operating
system can see all resources (connected devices, files and folders,
network shares, CPU power, quantifiable hardware capabilities) of that
computer. However, programs running inside of a container can only
see the container's contents and devices assigned to the container.
On ordinary operating systems for personal computers [tlfong01 - Rpi
included?], a computer program can see (even though it might not be
able to access) all the system's resources. They include:
Hardware capabilities, such as the CPU and the network connection Data
that can be read or written, such as files, folders and network shares
Connected peripherals it can interact with, such as webcam, printer,
scanner, or fax
With operating-system-virtualization, or containerization, it is
possible to run programs within containers, to which only parts of
these resources are allocated.
Appendix D - Go Wikipedia Learning Notes
Go, also known as Golang, is a statically typed, compiled
programming language designed at Google. Go is syntactically similar
to C, but with memory safety, garbage collection, structural typing,
and CSP-style concurrency.
Go was designed at Google in 2007 to improve programming productivity
in an era of multicore, networked machines and large codebases.
The designers wanted to address criticism of other languages in use at
Google, but keep their useful characteristics:
Static typing and run-time efficiency (like C++)
Readability and usability (like Python or JavaScript)
High-performance networking and multiprocessing
The designers were primarily motivated by their shared dislike of C++.
Go is influenced by C
Distinctive approaches to particular problems:
Built-in concurrency primitives: light-weight processes, channels, and
the select statement.
An interface system in place of virtual inheritance, and type
embedding instead of non-virtual inheritance.
A desire to keep the language specification simple enough to hold
in a programmer's head, in part by omitting features which are
common in similar languages.
Go's syntax includes changes from C aimed at keeping code concise and
readable.
Go has a number of built-in types, ... Record types can be defined
with the struct keyword.
Pointers are available for all types,
For a pair of types K, V, the type map[K]V is the type of hash
tables mapping are built into the language
Go provides two features that replace class inheritance:
embedding, which can be viewed as an automated form of composition or delegation, interfaces, which provides runtime
polymorphism.
In Go's package system, each package has a path and a name
The Go language has built-in facilities, as well as library support,
for writing concurrent programs. Concurrency refers not only to CPU
parallelism, but also to asynchrony: letting slow operations like a
database or network-read run while the program does other work, as is
common in event-based servers.
Go's concurrency can be used to program shared memory
multi-processor machines.
Appendix E - WAP (Wireless Access Point) - Wikipedia Learning Notes
In computer networking, a wireless access point (WAP), or more
generally just access point (AP), is a networking hardware device
that allows other Wi-Fi devices to connect to a wired network.
The AP usually connects to a router (via a wired network) as a standalone device, but it can also be an integral component of the
router itself. An AP is differentiated from a hotspot, which is
the physical location where Wi-Fi access to a WLAN is available.
An AP connects directly to a wired local area network, typically
Ethernet, and the AP then provides wireless connections using wireless
LAN technology, typically Wi-Fi, for other devices to use that wired
connection. APs support the connection of multiple wireless devices
through their one wired connection.
Wireless access point vs ad hoc network
Some people confuse wireless access points with wireless ad hoc
networks. An ad hoc network uses a connection between two or more
devices without using a wireless access point; The devices communicate
directly when in range. Because setup is easy and does not require an
access point, an ad hoc network is used in situations such as a quick
data exchange or a multiplayer video game. Due to its peer-to-peer
layout, ad hoc Wi-Fi connections are similar to connections available
using Bluetooth.
Wireless networking lags wired networking in terms of increasing
bandwidth and throughput. As of 2013, high-density 256-QAM (TurboQAM)
modulation, 3-antenna wireless devices reach speeds 240 Mbit/s 13m,
360Mbit/s at 10m, 380 Mbit/s at 2m, or 20 to 25 Mbit/s at 2m line of
sight (IEEE 802.11g), wired hardware of similar cost reaches closer to
1000 Mbit/s up to specified distance of 100 m with twisted-pair
cabling in optimal conditions (Cat5 or better cabling with Gigabit
Ethernet).
Appendix F - Hotspot (Wi-Fi) - Wikipedia Learning Notes
A hotspot is a physical location where people may obtain Internet access, typically using Wi-Fi technology, via a wireless local area
network (WLAN) using a router connected to an internet service
provider.
Public hotspots may be created by a business for use by customers,
such as coffee shops or hotels. Public hotspots are typically created
from wireless access points configured to provide Internet access,
controlled to some degree by the venue. In its simplest form, venues
that have broadband Internet access can create public wireless access
by configuring an access point (AP), in conjunction with a router and
connecting the AP to the Internet connection. A single wireless router
combining these functions may suffice.
Private hotspots may be configured on a smartphone or tablet with a mobile network data plan to allow Internet access to other devices via
Bluetooth pairing or if both the hotspot device and the device/s
accessing it are connected to the same Wi-Fi network.
The public can use a laptop or other suitable portable device to access the wireless connection (usually Wi-Fi) provided. Of the
estimated 150 million laptops, 14 million PDAs, and other emerging
Wi-Fi devices sold per year for the last few years, most include the
Wi-Fi feature.
Public hotspots are often found at airports, bookstores, coffee shops,
department stores, fuel stations, hotels, hospitals, libraries, public
pay phones, restaurants, RV parks and campgrounds, supermarkets, train
stations, and other public places. Additionally, many schools and
universities have wireless networks on their campuses.
Free hotspots operate in two ways: Using an open public network is the
easiest way to create a free hotspot. All that is needed is a Wi-Fi
router. Similarly, when users of private wireless routers turn off
their authentication requirements, opening their connection,
intentionally or not, they permit piggybacking (sharing) by anyone in
range.
Closed public networks use a HotSpot Management System to control
access to hotspots. This software runs on the router itself or an
external computer allowing operators to authorize only specific users
to access the Internet.
A commercial hotspot may feature a captive portal / login screen /
splash page that users are redirected to for authentication and/or
payment.
Software hotspots
Many Wi-Fi adapters built into or easily added to consumer computers
and mobile devices include the functionality to operate as private or
mobile hotspots, sometimes referred to as "mi-fi". The use of a
private hotspot to enable other personal devices to access the WAN
(usually but not always the Internet) is a form of bridging, and known
as tethering.
Manufacturers and firmware creators can enable this functionality in
Wi-Fi devices on many Wi-Fi devices, depending upon the capabilities
of the hardware, and most modern consumer operating systems, including
Android, Apple OS X 10.6 and later, Windows mobile, and Linux include
features to support this. Additionally wireless chipset manufacturers
such as Atheros, Broadcom, Intel and others, may add the capability
for certain Wi-Fi NICs, usually used in a client role, to also be used
for hotspot purposes. However, some service providers, such as AT&T,
Sprint, and T-Mobile charge users for this service or prohibit and
disconnect user connections if tethering is detected.
Third-party software vendors offer applications to allow users to
operate their own hotspot, whether to access the Internet when on the
go, share an existing connection, or extend the range of another
hotspot.
Appendix G - Rpi3 WiFi Station + AP IOT Config API Learning Notes
IOT Wifi is very small/8MB Docker Container built for Rpi3. IOT Wifi
exposes a simple JSON based REST API for controlling the wireless
network interface. This container allows the Raspberry Pi to accept
wifi connections as an access point (aka AP) while at the same time
connecting to an existing wifi network (station mode).
> IOT Wifi sets up network interfaces, runs hostapd, wpa_supplicant and
dnsmasq to run simultaneously, allowing a user (or another service) to
connect to the Raspberry Pi via hostapd/dnsmasq and issue commands
that configure and connect wpa_supplicant to another AP. IOT Wifi then
exposes a small web server on the Pi and offers a JSON based REST API
to configure Wifi. The IOT Wifi container allows you to build a custom
Captive Portal web page or even programmatically connect from another
device and use the exposed API to configure the target device.
Using wifi to configure a wifi connection is often a standard
requirement for IOT. As Raspberry Pis are becoming a popular choice as
an IOT platform, this helps solve the frequent need to manage AP and
Station modes.
Appendix H Rpi3 WiFi Station + AP Setup notes
Disable wpa_supplicant on Raspberry Pi
You do not want the default wpa_supplicant (the software that
communicates with the wifi driver and connects to Wifi networks,)
running and competing with the IOT Wifi container.
prevent wpa_supplicant from starting on boot $ sudo systemctl mask wpa_supplicant.service
rename wpa_supplicant on the host to ensure that it is not # used. sudo mv /sbin/wpa_supplicant /sbin/no_wpa_supplicant
kill any running processes named wpa_supplicant $ sudo pkill wpa_supplicant
Install Docker on Raspberry Pi
Ssh into the Pi or use the terminal application from the desktop on
the Pi to get a Bash shell.
Install Docker
- add pi user to Docker user group $ sudo usermod -aG docker pi
Usermod Docker
Reboot the Pi and test Docker.
$ sudo reboot
After reboot, ensure Docker is installed correctly by running a Hello
World Docker container.
- run the Docker Hello World container and remove the container
- when finished (the --rm flag)
Appendix I - Wireless Repeater - Wikipedia Learning Notes
A wireless repeater (also called wireless range extender) takes an
existing signal from a wireless router or wireless access point and
rebroadcasts it to create a second network. When two or more hosts
have to be connected with one another over the IEEE 802.11 protocol
and the distance is too long for a direct connection to be
established, a wireless repeater is used to bridge the gap. It can be
a specialized stand alone computer networking device. Also, some
wireless network interface controllers (WNIC)s optionally support
operating in such a mode. Those outside of the primary network will be
able to connect through the new "repeated" network. However, as far as
the original router or access point is concerned, only the repeater
MAC is connected, making it necessary to enable safety features on the
wireless repeater. Wireless repeaters are commonly used to improve
signal range and strength within homes and small offices.
Uses - area has no wireless hotspot, area with much interference,
computer between access point too great
Some wireless range extending devices connect via a USB port. These
USB adapters add Wi-Fi capability to desktop PCs and other devices
that have standard USB ports. USB supports not only the data transfers
required for networking, but it also supplies a power source so that
these adapters do not require electrical plugs.
Appendix J - Wireless Bridge - Wikipedia Learning Notes
A network bridge is a computer networking device that creates a single
aggregate network from multiple communication networks or network
segments. This function is called network bridging. Bridging is
distinct from routing. Routing allows multiple networks to communicate
independently and yet remain separate, whereas bridging connects two
separate networks as if they were a single network.
In the OSI model, bridging is performed in the data link layer (layer
2).4 If one or more segments of the bridged network are wireless,
the device is known as a wireless bridge.
/ to continue, ...
.END