User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Mon Oct 05, 2020 9:00 pm

.
EXECUTIVE SUMMARY:
I have created a "toggle switch" that instantly transforms a Raspberry Pi into a WiFi-to-WiFi router. Among other things, my router will completely "normalize" the mobile hotspot of any smartphone or tablet.

The Bash script I have written does all of this automatically with just a standard copy of the Raspberry's desktop operating system — without any additional software whatsoever. That means my solution has no need for hostapd, dnsmasq or any other package.
WiFi-to-WiFi_Router_Topology_RPi_Mike.jpg
WiFi-to-WiFi_Router_Topology_RPi_Mike.jpg (244.33 KiB) Viewed 6659 times


That's a lot of terms, so let me explain each one:

The typical "wireless router" is really a wired-to-wireless router. In other words, a so-called wireless router is only half wireless! What it really does is take a wired Ethernet connection to the internet and "converts" it into a WiFi hotspot. In that sense, a wireless router is really an Ethernet-to-WiFi router.

My script instantly converts your Raspberry into a different kind of router — a WiFi-to-WiFi router. It does this by taking an existing WiFi hotspot from a mobile or non-mobile device that already has an internet connection and makes it available from a brand-new WiFi Access Point on your Raspberry!

By "toggle switch", I'm referring to a simple icon on your desktop that always reveals the on/off status of the WiFi-to-WiFi router. If it currently says it's off and you wish to turn it on, simply double-click it and BOOM — your Raspberry will automatically reboot and instantly become a WiFi-to-WiFi router! If you wish to turn the router off and bring your Raspberry back to its completely normal WiFi state, same thing — just flip the toggle switch!

The manufacturers of smartphones and tablets use a variety of terms for the WiFi hotspot provided by a device's cellular-data connection. For example, on iPhones and iPads, Apple uses the term "Personal Hotspot". In the Android world, the term "Mobile Hotspot" is typically used — and on some other Android devices, it's generically referred to as a "Wi-Fi Hotspot" or simply "tethering".

No matter what the exact term, the concept is the same — it turns your mobile device into the near-equivalent of a traditional WiFi hotspot — the kind you would find at your friend's house or a local Starbucks or McDonald's.

If you noticed, however, I said that a mobile hotspot is the "near-equivalent" of a traditional WiFi hotspot. The reason I say that is because some devices can tell the difference.

So if you want a super-convenient way to instantly "normalize" your mobile hotspot by transforming it into a traditional hotspot, look no further.

I call my technique MHN — Mobile Hotspot Normalization.

But why is my solution so useful?

Among other things, many devices require a traditional WiFi hotspot to download critical system updates. If they detect otherwise, the download will not occur. For example, some devices will say "this update requires a Wi-Fi network connection to download". That's a vague way of saying that they require a traditional, non-mobile WiFi hotspot. My solution fully satisfies that requirement.

A WiFi-to-WiFi router can also be very useful as a WiFi "repeater" or "extender" — almost like an extension cord for WiFi. So if your wireless router has a reliable range of 100 feet, for example, you can use a WiFi-to-WiFi router at the 100-foot mark — which will then extend the WiFi connection by another 100 feet (under a different SSID). By creating a "daisy chain" of multiple WiFi-to-WiFi routers, you can extend the connection even further.

Although several router-related tutorials already exist for the Raspberry, almost all of them mention the "eth0" interface — a dead giveaway that they're describing a commonplace Ethernet-to-WiFi router. And a tiny portion are indeed specific to networking wlan0 with wlan1. But after an exhaustive search, my findings are this: With just one exception, there is not a single MHN-related tutorial or script in the entire Googleverse that actually works on the latest Raspberry platform — with or without hostapd.

I will describe that one exception and explain how I dramatically enhanced it and fully automated it!




WOW MIKE, THIS LOOKS COMPLICATED! HOW LONG WILL IT TAKE TO DO ALL OF THIS?
This might look like a long and complicated tutorial — but that's only because I'm trying to be as thorough and comprehensive as possible.

Believe it or not, the total time it takes to set everything up — which you will only need to do once — is about 2 minutes!

All you have to do is edit a few items — like whether you live in the UK, Germany, Japan or another country. And then you simply run my fully-automated installation script — which takes just 5 seconds to execute.

Once you've done that, you're all set — from then on, it will take just 1 second of effort to flip your Raspberry back and forth between WiFi-to-WiFi router mode and normal WiFi mode!

Why 1 second?

Because that's how long it takes to double-click my toggle switch!




AN EXAMPLE OF WHAT A NORMALIZED MOBILE HOTSPOT LOOKS LIKE:
Here's a screenshot from my iPhone 11 Pro Max running iOS 14.

As you can see, there are two WiFi networks currently available — "Mobile Hotspot" and "Mobile Hotspot via Raspberry".

Yet "under the hood", both networks are ultimately emanating from the same mobile device!

If you look carefully, you'll see that "Mobile Hotspot" has a "chain link" icon next to it — whereas "Mobile Hotspot via Raspberry" has a traditional WiFi icon.

This demonstrates that by running the mobile hotspot through my Raspberry-based WiFi-to-WiFi router, the connection is completely "normalized" so that it looks and behaves like a traditional WiFi hotspot!
Mobile_Hotspot_via_Raspberry_RPi_Mike.png
Mobile_Hotspot_via_Raspberry_RPi_Mike.png (153.94 KiB) Viewed 6659 times




SO MIKE — WHAT DO I NEED TO CREATE YOUR WIFI-TO-WIFI ROUTER?
You need just four things — and the last two are completely free:

(1) Any Raspberry Pi 4 or 3 (both the 3B and 3B+)

(2) Any standard USB WiFi dongle that's known to work with the Raspberry

(3) The completely free Raspberry Pi OS (32-bit) with Desktop or the beta version of Raspberry Pi OS (64-bit) with Desktop.

(4) My completely free and automated Bash script!

My installation script will automatically create two new commands on your system at /usr/local/bin: router-on and router-off. But you won't need to "use" these commands directly or even understand them. Instead, they will be linked to a convenient toggle switch on your desktop. The switch's icon will always indicate the WiFi-to-WiFi router's current status by saying either "Router is Off" or "Router is On". If you double-click the icon, it will reverse its current status. In other words, if the router is currently off, double-clicking it will turn it on. If the router is currently on, double-clicking it will turn it off. Simple as that!

MULTIPLE PLATFORMS: My WiFi-to-WiFi router works on six different platforms — both the 32-bit and 64-bit operating systems running on three different models: The Raspberry Pi 3B, 3B+ and 4. In fact, I was pleasantly surprised by the excellent performance of the older models — even the model 3B in 64-bit mode. But for the most exceptional performance, I would still recommend a Raspberry Pi 4 with at least 2 GB of memory.




THE CORE TECHNIQUE I DRAMATICALLY ENHANCED:
I give tremendous credit to "Ingo". He's a developer from Germany with the highest reputation score on the entire Raspberry Pi Stack Exchange for the year 2020. I could not have done what I did without his technical inspiration — so I really appreciate his innovative approach.

Unlike anything else out there, Ingo's core technique completely avoids the added complications and configuration issues of hostapd and dnsmasq. Instead, he uses the little-known capability of wpa_supplicant to provide Access Point (AP) functionality all by itself. What's great about this is that wpa_supplicant is the standard WiFi security solution — and it comes as a built-in feature of the Raspberry's operating system, so it does not require the installation of any software!

Put simply, I took Ingo's core approach and made it even better — and I made it instantly reversible. On top of that, instead of it being a rather tedious and time-consuming manual conversion process, I automated the entire thing with a Bash script that puts a clickable toggle switch on your desktop that does everything for you.

Here are some of the unique enhancements I developed exclusively for my tutorial:




MY SOLUTION IS EXTREMELY QUICK AND CONVENIENT:
My Bash script automatically builds a custom-designed toggle switch on your desktop that changes appearance based on whether the WiFi-to-WiFi router is on or off. Just flip the toggle switch and BOOM — your system will flip back and forth between WiFi states whenever you want. The icon images, by the way, are "procedurally generated" through pure code in my script — no actual image is downloaded to your system.
WiFi-to-WiFi_Toggle_Switch_RPi_Mike.png
WiFi-to-WiFi_Toggle_Switch_RPi_Mike.png (80.44 KiB) Viewed 6659 times




MY SOLUTION IS COMPLETELY NON-DESTRUCTIVE:
Ingo makes clear that his approach requires "a complete [networking] switch. There is no way to mix [it] up with Debian networking and/or dhcpcd." In other words, he requires the enabling of systemd-networkd by doing a forced purge of multiple networking packages that come standard with the Raspberry's operating system — including ifupdown, dhcpcd5, isc-dhcp-client, isc-dhcp-common and rsyslog. That method might be fine for converting the Raspberry into a "permanent" WiFi-to-WiFi router. But being able to switch the WiFi-to-WiFi capability off and on — at will — non-destructively with a simple flip of a toggle switch — is a much more flexible solution. And that's exactly what my solution provides.




MY SOLUTION HAS STRONG SECURITY AND FULLY IMPLEMENTS WPA2:
When I tried Ingo's approach and connected my iPhone 11 Pro Max to the Raspberry's Access Point, everything worked — but my iPhone kept taunting me by describing the Access Point as having "Weak Security". Upon clicking the information button in my iPhone's WiFi settings, it said "Weak Security: WPA is not considered secure. If this is your Wi-Fi network, configure the router to use WPA2 (AES) or WPA3 security type."

To look more deeply into this matter, I ran the wpa_cli command in interactive mode. I then ran "scan", waited for the OK, and then ran "scan_results". Sure enough, the connection to the Access Point was being secured by the first-generation WPA, not WPA2. To be clear, however, this is NOT the fault of Ingo's core technique.

After much investigation and a lot of time wondering if there was some insanely obscure flaw in the approach Ingo and I were taking, it turned out that the culprit was a very unfortunate bug in wpa_supplicant v2.8 that causes the cryptographic key handling to break down during the handshake. That event, in turn, causes the handshake to abandon WPA2 and fall back to the more primitive WPA. As bad luck would have it, that's exactly the version of wpa_supplicant that comes with the latest version of Raspberry Pi OS!

(To be clear, the WPA2-related bug only affects the security of wpa_supplicant's Access Point feature — it has no impact on your Raspberry in normal WiFi mode.)

The good news is that I was able to fully resolve the "weak security" situation by creating yet another Bash script that automatically builds the latest version of wpa_supplicant — version 2.9. At some point, perhaps coinciding with the release of Debian Bullseye, the Raspberry Pi Foundation will update the wpa_supplicant package — but until then, my script does the job just fine — and it fully provides WPA2 security! This is an optional item, by the way — if you're comfortable with the weaker security of WPA and only need to use the WiFi-to-WiFi capability on occasion, you can disable "proto=RSN" and completely skip over my building script for wpa_supplicant v2.9. More details on this in a moment.




MY SOLUTION "LOCKS IN" BOTH WIFI INTERFACES — GUARANTEEING 100% PREDICTABILITY:
During my initial testing and development, there were times when Ingo's general approach didn't always work. At first, this was inexplicable — because I was doing the exact same thing each time. But it turns out that about 5% to 20% of the time, the Raspberry will REVERSE the order of its network interfaces during boot-up.

It's more likely to happen during a cold boot, but I also caught it happening during a reboot as well. In other words, "wlan0" is normally the interface designation for the Raspberry's on-board WiFi chip. And "wlan1" is normally the designation for any attached USB WiFi dongle. However, during the boot-up process, the first interface designation will sometimes be assigned to the dongle — thus the dongle will become "wlan0" instead of "wlan1"!

This has nothing to do with the approach that Ingo and I have taken. Instead, it's a fundamental behavior of the Raspberry itself. My script completely resolves this issue by associating the software-constructed network interfaces with the physical addresses of the hardware itself. I accomplished this by linking wlan0 to the MAC address of the Raspberry's on-board WiFi chip — and linking wlan1 to the MAC address of the USB WiFi dongle. That way, it's technically impossible for the two interfaces to ever get reversed!

I named the interface for the Raspberry's on-board WiFi chip OBwlan0 — "OB" standing for "On-Board". And I named the interface for the USB WiFi dongle as DGwlan1 — "DG" representing the key phonetics of the word "dongle". (Once you remove the USB WiFi dongle and switch off the router, your system will revert back to its original single interface — with the name wlan0.)

And by the way, I would have used longer and more intuitive interface names — but part of my lengthy testing and development process revealed that interface names should not exceed 7 characters. This is because some Linux systems, including the Raspberry, will sometimes internally prepend interface names with "p2p-dev-". The internal character limit is actually 15 — but when you take into account the 8 characters in "p2p-dev-", the effective limit for human-assigned names is only 7 characters! Exceeding this limit can cause a variety of bizarre errors.




MY SOLUTION IS COMPLETELY REVERSIBLE — AND I CAN PROVE IT:
When you flip the toggle switch and turn your Raspberry into a WiFi-to-WiFi router, you're not "committing" to anything. That's because I used a very potent command line to identify ANY file changes triggered by my "DO" script — the "router-on" command that converts your system into a WiFi-to-WiFi router. I initially developed this command line for an unrelated project. It reveals not only file modifications but even file movements without modification!

By carefully analyzing the effects of my "DO" script, I was able to write a perfect "UNDO" script that completely reverts your system back to its 100% original WiFi state — as though nothing had ever happened. That script became the "router-off" command.

Here's the file-scanning command line I used. Note the timestamps — it shows I scanned every single file on my system for any file change that occurred during a precise 10-second interval. This interval fully covered the run time of my "DO" script:

cd /; sudo find . -newerct "2020-09-27 18:33:00" ! -newerct "2020-09-27 18:33:10" -type f,l -exec ls -lchA --time-style=+"%Y-%m-%d %H:%M:%S.%1N" {} + | sort -k6 | grep -oP '2020-.*'

But I didn't stop there.

I then used the results of this thorough scan to inform my next step — an exhaustive binary compare with the "diff" command. That way, I was able to do a mathematically exact "before and after" comparison of the entire /etc directory — the only directory that experiences any persistent (post-boot) change from my "DO" command. On a brand-new system, before I did anything, I simply copied and pasted the entire /etc directory to a safe location — and then I copied and pasted the same /etc directory after running my two scripts (router-on; router-off). And then I ran the diff command to confirm that my undo script perfectly reverted my system to its original state:

diff -rq /home/pi/Before/etc /home/pi/After/etc

Finally, for those who might wish to confirm my claims with your own binary compare, you should know that ONE networking-related file will sometimes change on its own — the "/etc/resolv.conf" file — without having anything to do with my router system. For example, simply plugging in a WiFi dongle will automatically generate a second nameserver listing (for wlan1).




I ATE MY OWN DOG FOOD:
It's not an "enhancement" per se — but the famous Silicon Valley saying certainly applies to my tutorial. It means I deliberately pretended to be a Linux novice and ate my own "dog food" — I followed my own instructions on a brand-new, freshly-installed system to see if everything really works as I'm claiming. It does!

One of the most vexing oversights that many tutorial writers make is their unconscious assumption that "if I know it, everyone else must know it!" Well if everyone knew it, what would be the point of writing the tutorial in the first place? It's an example of the curse of knowledge — a cognitive bias I try to avoid. For this reason, I make a real attempt to assume minimal prior knowledge — while being explicit about everything and not skipping steps.

So here's the only big assumption I'm making: That you're following my instructions, to the letter, on a completely unmodified, fully-updated copy of the current desktop operating system — on either the Raspberry 4 or 3 (3B or 3B+). To fully update your system, run the following command line in Terminal — and then reboot, just in case there was a kernel update:

sudo apt update && sudo apt full-upgrade -y




WARNING:
If you're the kind that likes to "tinker" with your Raspberry in various unknown ways, that's perfectly fine — but don't expect these instructions to necessarily work for you! If you run my Bash script on a truly standard, unmodified system, I have confirmed that everything works perfectly — as of this writing.

Of course, at any time in the future, the operating system itself could change in a manner that somehow breaks my script — but that would obviously be beyond my control.

And when I say "truly standard", I mean it — so if you changed your home directory from /home/pi to /home/john, for instance, that alone is more than enough to break my script. I could have easily chosen relative paths, for example, to accommodate that possibility — but that's simply not my style. In general, I like explicit, absolute paths — where I can quickly see exactly where everything's going!

That's just one tiny example, of course — people do all kinds of things to "tweak" their systems. But that level of unpredictability cannot be my concern.




EXECUTABLE PROMPT — DISABLE IT IF YOU WISH:
Anytime you double-click an executable script on the Raspberry, you'll get a prompt that asks what you want to do. This is a built-in feature of the Raspberry's desktop operating system that has nothing to do with me. As a result, when you double-click my toggle switch on the desktop, you'll need to click the "Execute" button. For security reasons, some prefer this explicit form of consent for all executable files. However, if you'd like to disable this feature, simply go to File Manager and follow this click path:

Edit | Preferences | Check "Don't ask options on launch executable file"




USB WIFI DONGLES — LINUX KERNEL SUPPORT IS WHAT YOU WANT:
As you can see in my infographic at the top of this tutorial, I used a "Wi-Pi" dongle. It's based on the RT5370 chipset, made by a company called Ralink Technology. I bought it a few years ago — but a quick search reveals several other dongles currently on sale that use the same chipset. They should also work with my solution — though of course I haven't personally tested them. Most are around $10 US.

The Raspberry Pi Foundation is selling another dongle that uses the BCM43143 chipset. It's advertised as having "built-in support" for Raspberry Pi OS, so that should work too.

The complicated elements in my router-on command primarily occur at the Access Point (AP) — which exclusively involves the Raspberry's on-board WiFi chip, not the dongle. All the dongle does is establish a totally mainstream WiFi connection to the mobile (or non-mobile) hotspot.

Therefore, as long as a dongle is known to work on your Raspberry in a conventional WiFi capacity, it's almost certain to work with my solution!

In fact, I just dug up another dongle I got for an old Windows computer. It's based on a different chipset — the "RT2870/RT3070". It also works perfectly with my solution.

To determine your dongle's chipset, simply plug it in and run the lsusb command.

Just realize that some dongle chipsets are not natively supported by the Raspberry's Linux kernel — so don't assume that any random dongle will work. This is not a limitation of my tutorial — it means they will not work for ANY purpose on the Raspberry, unless you undertake the non-trivial task of building a "device driver" for it from scratch — a Linux kernel module — which would then need to be re-built anytime the kernel itself is updated.

To put it mildly, when it comes to devices, there's nothing like having built-in support from the Linux kernel!




QUICKLY CHANGE THE SETTINGS OF THE WIFI-TO-WIFI ROUTER:
After you've run my installation script, you can quickly change the router's settings at any time — such as the network name and password of the mobile hotspot or the Raspberry's Access Point.

If you change any of the hardware — either the Raspberry itself or the dongle — be sure to update the MAC address(es) or the router won't work (I will explain MAC addresses in a moment).

Also, be sure to have your USB WiFi dongle plugged in before you change the settings — because the system will automatically reboot into "Router On" mode and will expect to see that device. Otherwise, there will be a 90-second "start job is running" delay while the Raspberry's boot-up sequence keeps looking for a device that isn't there!

To change the router's settings, you can simply install this button. OR you can run the following command line in Terminal to edit the contents of the "router-on" command. Once you've saved the changes, run the router-on command so that the new configuration takes effect (your system will automatically reboot):

sudo mousepad /usr/local/bin/router-on &exit

router-on




OK MIKE, LET'S DO THIS! WHAT CHANGES DO I NEED TO MAKE IN YOUR TOGGLE SWITCH INSTALLATION SCRIPT BEFORE I RUN IT?
I marked everything in red that you MAY need to change in my toggle switch installation script — which appears as STEP 3 further down this page. Some of the items are optional, while other items should only be changed under specific circumstances — so it's important that you read this section carefully to understand exactly what you're doing. So here's the full run-down:

country=US: If you don't live in the US like me, be sure to change this to your country's 2-letter WiFi code — such as "GB" for the United Kingdom. Assuming you have an unmodified copy of the operating system with conventional WiFi, this command line will reveal your existing country code:

cat /etc/wpa_supplicant/wpa_supplicant.conf | grep -oP '(?<=country=).*'

Mobile Hotspot via Raspberry: This is the network name (SSID) for the Access Point that your Raspberry will be offering as a traditional WiFi hotspot — for any device that wishes to connect to it. Feel free to change this name!

AccessPointPassword: Choose your password for the Raspberry's Access Point. It must be at least 8 characters long.

proto=RSN: At the moment, the Raspberry's operating system comes with an older version of wpa_supplicant (v2.8) that contains an unfortunate bug — a bug that prevents the Raspberry's Access Point from accepting WPA2 connections. Due to a breakdown of cryptographic key handling, it automatically falls back to the less-secure WPA standard. Fortunately, a separate script I wrote fixes everything by automatically building the very latest version of wpa_supplicant (v2.9)! This appears as an optional STEP 2 in my instructions. If you use my building script to upgrade wpa_supplicant, be sure to include this line in my toggle switch installation script — "proto=RSN". By default, I've already included this line in my script — because I strongly encourage you to use WPA2 security. If you don't explicitly require RSN — which stands for Robust Security Network, a synonym for WPA2 — wpa_supplicant will automatically revert to the more primitive security of WPA. Conversely, if for some reason you don't wish to upgrade wpa_supplicant, that's fine too — just realize that your Access Point will offer the weak security of WPA, not WPA2. One last, critical thing: If you insist on using the older and less-secure version of wpa_supplicant (v2.8), be sure to disable "proto=RSN" by changing it to "#proto=RSN". If you don't do that, no connection of any kind will occur! It will either cause the Access Point to completely disappear from any list of WiFi networks — or your connecting device will say "incorrect password", even though you may have entered a perfectly correct password!

frequency=5180: Many dongles use the 2.4 GHz spectrum, so I decided to use a different part of the spectrum for the Raspberry's on-board chip by taking advantage of its dual-band capabilities. So I set the Access Point to a frequency in the 5 GHz spectrum. The appropriate frequency may vary in different countries, but 5180 is a good number for many of them. However, please consult this list of WiFi frequencies if you need to change it. Be certain that the device you intend to connect to the Raspberry's Access Point is capable of operating in the 5 GHz spectrum. Many devices — especially older ones — are only capable of connecting to Access Points in the 2.4 GHz spectrum. So if you have the Raspberry's Access Point set to a frequency of 5180, for example — but your connecting device can only handle 2.4 GHz frequencies — you could easily get extremely confused and frustrated. Why? Because your connecting device will see NOTHING — thus making it very easy to falsely assume there's something wrong with the Raspberry's Access Point — which might then lead to several needless hours of troubleshooting a non-existent "problem". So if your connecting device doesn't support 5 GHz frequencies — or you're just not sure — change this setting to frequency=2412 (or another suitable value in the 2.4 GHz spectrum). Don't forget that the 5 GHz spectrum only became available with the Raspberry Pi 3B+ (not the 3B). So be aware of the frequency you are trying to use. If it's not a match for your Raspberry's hardware, you won't get an error message or anything to indicate what the problem is. It just won't work!

country=US: Yes, I know I already listed this — but it needs to be changed a second time in my script if you don't live in the US!

Mobile Hotspot: This is the pre-existing name for the mobile hotspot that a 4G or 5G smartphone or tablet is providing. In other words, this is the "Mobile Hotspot" or "Personal Hotspot" that will be providing internet access for your Raspberry — and therefore, internet access for any device that's connected to your Raspberry's Access Point!

MobileHotspotPassword: Change this to the mobile hotspot's pre-existing password.

MACAddress=xx:xx:xx:xx:xx:xx: This represents the MAC address of the Raspberry's on-board WiFi chip. You need to change it to match your Raspberry's exact hardware. To do that, make sure that no WiFi device of any kind is currently plugged into your Raspberry and simply run the following command line. The output generated by my command line will be the physical address of your Raspberry's on-board WiFi chip. It will initially have the interface name of wlan0 — but whenever the router is on, my code will automatically assign it the name OBwlan0. Copy the unique hardware address for wlan0 and use it to replace the existing MAC address in my script that begins with "xx":

ip -o link | grep wlan | awk '{ print "\033[38;2;255;0;0;1m\n"$2"\033[0m\n"$17"\n" }'

MACAddress=yy:yy:yy:yy:yy:yy: This represents the MAC address of the USB WiFi dongle. You need to change it to match your dongle's hardware. To do that, plug it in, wait about 10 seconds, and then run the above command line again. Initially, the interface name will be wlan1 — but whenever the router is on, my code will automatically assign it the name DGwlan1. Copy the output for wlan1 and use it to replace the existing MAC address in my script that begins with "yy":





STEP 1: SKIP THIS ICON-GENERATING STEP — UNLESS YOU'RE A 64-BIT BETA OS USER — OR IT'S THE FUTURE AND THE RASPBERRY PI FOUNDATION HAS CHANGED ITS PRE-INSTALLED ICONS:

SHORT STORY:
Just copy the Bash script that appears in the code box below — and paste it into Terminal and hit the Enter key. That's it. Move on to STEP 2!

LONGER STORY:
I wanted to create custom-made icons for my on/off toggle switch. My first thought was to design them on MY computer and then share the icons as images inside this tutorial. I would have then instructed you to download them to a specific directory before running my installation script.

But I decided to get fancy and make the images on YOUR computer instead!

And that's exactly what I did in my toggle-switch code. I did this by using a series of "find and replace" sed commands to heavily manipulate the raw code inside an svg vector graphic that comes pre-installed with the Raspberry's 32-bit operating system. That way, I was able to "procedurally generate" two original images on your system — "Router On" and "Router Off" — without your system downloading any image from anywhere!

However, at least for now, the Raspberry Pi Foundation has chosen to not include any "HighContrast" icons in the 64-bit beta OS. These icons normally come pre-installed with the 32-bit OS.

And there's always the possibility these icons could disappear from future versions of the 32-bit OS as well.

The "source image" I manipulated is a generic illustration of a "WiFi tower". To confirm its presence, simply run this command line in Terminal:

sha256sum /usr/share/icons/HighContrast/scalable/devices/network-wireless.svg | grep -o 8ed1f7a

If the output shows the following hash code in bright red, it means you already have the correct icon and can skip this step. But you can still run my code in this step no matter what and it won't matter — because my code will simply overwrite the existing icon with a mathematically identical binary duplicate:

8ed1f7a

Code: Select all

{
sudo mkdir -p /usr/share/icons/HighContrast/scalable/devices

echo '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="48"
   height="48"
   id="svg2"
   sodipodi:version="0.32"
   inkscape:version="0.46"
   version="1.0"
   sodipodi:docname="network-wireless.svg"
   inkscape:output_extension="org.inkscape.output.svg.inkscape">
  <defs
     id="defs4">
    <inkscape:perspective
       sodipodi:type="inkscape:persp3d"
       inkscape:vp_x="0 : 526.18109 : 1"
       inkscape:vp_y="0 : 1000 : 0"
       inkscape:vp_z="744.09448 : 526.18109 : 1"
       inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
       id="perspective10" />
  </defs>
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="11.395833"
     inkscape:cx="38.873857"
     inkscape:cy="24"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="true"
     inkscape:object-paths="true"
     inkscape:object-nodes="true"
     inkscape:snap-bbox="true"
     objecttolerance="10000"
     gridtolerance="10000"
     guidetolerance="10000"
     inkscape:window-width="1022"
     inkscape:window-height="918"
     inkscape:window-x="256"
     inkscape:window-y="26">
    <inkscape:grid
       type="xygrid"
       id="grid2383"
       visible="true"
       enabled="true" />
  </sodipodi:namedview>
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title>Network Wireless</dc:title>
        <dc:date>December 2008</dc:date>
        <dc:creator>
          <cc:Agent>
            <dc:title>Luca Ferretti &lt;elle.uca@libero.it&gt;</dc:title>
          </cc:Agent>
        </dc:creator>
        <dc:subject>
          <rdf:Bag>
            <rdf:li>network</rdf:li>
            <rdf:li>wireless</rdf:li>
            <rdf:li>antenna</rdf:li>
          </rdf:Bag>
        </dc:subject>
        <dc:description>An antenna with EM waves</dc:description>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Livello 1"
     inkscape:groupmode="layer"
     id="layer1">
    <rect
       style="fill:none;fill-opacity:0.50000000000000000;stroke:none;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="rect3169"
       width="48"
       height="48"
       x="0"
       y="0" />
    <path
       sodipodi:nodetypes="cccc"
       id="path3201"
       d="M 20,34 L 32,41 L 24,23 L 16,41"
       style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:12;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
    <path
       sodipodi:type="arc"
       style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path3199"
       sodipodi:cx="24"
       sodipodi:cy="18"
       sodipodi:rx="14"
       sodipodi:ry="14"
       d="M 36.349644,11.405586 A 14,14 0 0 1 36.493432,24.317765"
       sodipodi:start="5.7927277"
       sodipodi:end="6.7513721"
       transform="matrix(-1,0,0,1,51.849644,0.1394818)"
       sodipodi:open="true" />
    <path
       sodipodi:type="arc"
       style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:12;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path3177"
       sodipodi:cx="24"
       sodipodi:cy="18"
       sodipodi:rx="19"
       sodipodi:ry="19"
       d="M 39.064398,6.4214032 A 19,19 0 0 1 39.24004,29.346418"
       sodipodi:start="5.6278819"
       sodipodi:end="6.9231659"
       sodipodi:open="true"
       transform="matrix(-1,0,0,1,49.122899,-0.4214032)" />
    <path
       transform="translate(-1.0658982,-0.4214032)"
       sodipodi:open="true"
       sodipodi:end="6.9231659"
       sodipodi:start="5.6278819"
       d="M 39.064398,6.4214032 A 19,19 0 0 1 39.24004,29.346418"
       sodipodi:ry="19"
       sodipodi:rx="19"
       sodipodi:cy="18"
       sodipodi:cx="24"
       id="path3175"
       style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:12;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       sodipodi:type="arc" />
    <path
       sodipodi:open="true"
       transform="translate(-3.600083,0.1394818)"
       sodipodi:end="6.7513721"
       sodipodi:start="5.7927277"
       d="M 36.349644,11.405586 A 14,14 0 0 1 36.493432,24.317765"
       sodipodi:ry="14"
       sodipodi:rx="14"
       sodipodi:cy="18"
       sodipodi:cx="24"
       id="path3173"
       style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:11;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       sodipodi:type="arc" />
    <path
       transform="translate(0,-6)"
       d="M 29,24 A 5,5 0 1 1 19,24 A 5,5 0 1 1 29,24 z"
       sodipodi:ry="5"
       sodipodi:rx="5"
       sodipodi:cy="24"
       sodipodi:cx="24"
       id="path3171"
       style="fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:8;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       sodipodi:type="arc" />
    <path
       sodipodi:type="arc"
       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path2385"
       sodipodi:cx="24"
       sodipodi:cy="24"
       sodipodi:rx="5"
       sodipodi:ry="5"
       d="M 29,24 A 5,5 0 1 1 19,24 A 5,5 0 1 1 29,24 z"
       transform="translate(0,-6)" />
    <path
       style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       d="M 20,34 L 32,41 L 24,23 L 16,41"
       id="path3157"
       sodipodi:nodetypes="cccc" />
    <path
       sodipodi:type="arc"
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path3159"
       sodipodi:cx="24"
       sodipodi:cy="18"
       sodipodi:rx="14"
       sodipodi:ry="14"
       d="M 36.349644,11.405586 A 14,14 0 0 1 36.493432,24.317765"
       sodipodi:start="5.7927277"
       sodipodi:end="6.7513721"
       transform="translate(-3.600083,0.1394818)"
       sodipodi:open="true" />
    <path
       sodipodi:open="true"
       sodipodi:end="6.7456074"
       sodipodi:start="5.8050181"
       d="M 36.429757,11.557862 A 14,14 0 0 1 36.529644,24.24564"
       sodipodi:ry="14"
       sodipodi:rx="14"
       sodipodi:cy="18"
       sodipodi:cx="24"
       id="path3163"
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       sodipodi:type="arc"
       transform="matrix(-1,0,0,1,51.600083,0.1394818)" />
    <path
       sodipodi:type="arc"
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       id="path3165"
       sodipodi:cx="24"
       sodipodi:cy="18"
       sodipodi:rx="19"
       sodipodi:ry="19"
       d="M 39.064398,6.4214032 A 19,19 0 0 1 39.24004,29.346418"
       sodipodi:start="5.6278819"
       sodipodi:end="6.9231659"
       sodipodi:open="true"
       transform="translate(-1.0658982,-0.4214032)" />
    <path
       sodipodi:open="true"
       sodipodi:end="6.9231659"
       sodipodi:start="5.6278819"
       d="M 39.064398,6.4214032 A 19,19 0 0 1 39.24004,29.346418"
       sodipodi:ry="19"
       sodipodi:rx="19"
       sodipodi:cy="18"
       sodipodi:cx="24"
       id="path3167"
       style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
       sodipodi:type="arc"
       transform="matrix(-1,0,0,1,49.24004,-0.3464176)" />
  </g>
</svg>' | sudo tee /usr/share/icons/HighContrast/scalable/devices/network-wireless.svg > /dev/null
}





STEP 2: OPTIONAL BUT STRONGLY RECOMMENDED — BUILD THE LATEST VERSION OF WPA_SUPPLICANT (v2.9):
Now we're really getting to the action!

If you want to protect the Access Point of your WiFi-to-WiFi router with WPA2 security instead of the weaker WPA, you'll need to do this step. My tutorial has already explained this in great detail — there's a WPA2-related bug in the older version of wpa_supplicant (v2.8) that comes with the Raspberry's current operating system.

At some point in the future, the Raspberry Pi Foundation will update this software and you won't need this step — so if you'd like to know your current version of wpa_supplicant, simply run wpa_supplicant -version in Terminal.

To build the latest version (v2.9), just copy my Bash script, paste it into Terminal, hit the Enter key and BOOM — in about one minute, you'll have the very latest in wpa_supplicant technology! Just make sure that the first and last character that you copy is a blue curly brace — no more, no less.

CRITICAL NOTE: My building script downloads the raw source code of wpa_supplicant v2.9 from the official developer website at "w1.fi" — and then it compiles it into working software and installs it. If that website or the RPF's online package repository is temporarily down — or if your internet connection isn't working — my script will generate multiple error messages. If that happens, it's no big deal — just run my undo script that appears at the very end of my tutorial — and then re-run my building script when those online resources become available!

{
sudo mv /sbin/wpa_supplicant /sbin/wpa_supplicant_ORIGINAL-FILE

sudo mv /sbin/wpa_cli /sbin/wpa_cli_ORIGINAL-FILE

sudo mv /usr/bin/wpa_passphrase /usr/bin/wpa_passphrase_ORIGINAL-FILE


sudo mv /usr/share/man/man5/wpa_supplicant.conf.5.gz /usr/share/man/man5/wpa_supplicant.conf.5.gz_ORIGINAL-FILE

sudo mv /usr/share/man/man8/wpa_cli.8.gz /usr/share/man/man8/wpa_cli.8.gz_ORIGINAL-FILE

sudo mv /usr/share/man/man8/wpa_passphrase.8.gz /usr/share/man/man8/wpa_passphrase.8.gz_ORIGINAL-FILE

sudo mv /usr/share/man/man8/wpa_supplicant.8.gz /usr/share/man/man8/wpa_supplicant.8.gz_ORIGINAL-FILE


sudo apt install -y libnl-3-dev libssl-dev libnl-genl-3-dev libreadline-dev

cd /home/pi

wget https://w1.fi/releases/wpa_supplicant-2.9.tar.gz

tar xzf wpa_supplicant-2.9.tar.gz

cd wpa_supplicant-2.9/wpa_supplicant


echo "CONFIG_AP=y
CONFIG_P2P=y
CONFIG_SAE=y
CONFIG_IEEE80211W=y
CONFIG_LIBNL20=y
CONFIG_BACKEND=file
CONFIG_CTRL_IFACE=y
CONFIG_DEBUG_FILE=y
CONFIG_DEBUG_SYSLOG=y
CONFIG_DEBUG_SYSLOG_FACILITY=LOG_DAEMON
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_WEXT=y
CONFIG_DRIVER_WIRED=y
CONFIG_EAP_GTC=y
CONFIG_EAP_LEAP=y
CONFIG_EAP_MD5=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_OTP=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TLS=y
CONFIG_EAP_TTLS=y
CONFIG_IEEE8021X_EAPOL=y
CONFIG_IPV6=y
CONFIG_LIBNL32=y
CONFIG_PEERKEY=y
CONFIG_PKCS12=y
CONFIG_READLINE=y
CONFIG_SMARTCARD=y
CFLAGS += -I/usr/include/libnl3" > .config


make -j4 BINDIR=/sbin LIBDIR=/lib

sudo install -v -m755 wpa_{cli,passphrase,supplicant} /sbin/

sudo install -v -m644 doc/docbook/wpa_supplicant.conf.5 /usr/share/man/man5/

sudo install -v -m644 doc/docbook/wpa_{cli,passphrase,supplicant}.8 /usr/share/man/man8/

sudo mv /sbin/wpa_passphrase /usr/bin

cd /home/pi

rm wpa_supplicant-2.9.tar.gz

rm -r wpa_supplicant-2.9

echo; echo "VERSION STATUS:"

wpa_supplicant -version
}





STEP 3: INSTALLATION SCRIPT — WIFI-TO-WIFI ROUTER — ON/OFF TOGGLE SWITCH:
This is the final step and it's very simple!

Based on my detailed guidance above, copy my script and carefully edit the few items marked in red in the Text Editor (available under Accessories in the Raspberry menu). Don't use a word processor, because it might inappropriately "auto-correct" my code — by converting straight quotes into curly quotes, for example.

Once you've made the edits, simply activate your mobile hotspot, make sure your USB WiFi dongle is plugged in — and paste the edited code into Terminal and hit the Enter key.

And BOOM — you'll have a WiFi-to-WiFi router!

When you're done using it, just unplug your dongle and double-click the toggle switch on your desktop.

And BOOM — back to normal WiFi mode!

{
echo "
########## CONVERT THE RASPBERRY INTO A WIFI-TO-WIFI ROUTER, BY RPi_Mike

########## THIS PORTION OF THE SCRIPT CREATES THE 'router-on' COMMAND AT /usr/local/bin




sudo mv /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf_ORIGINAL-FILE 2> /dev/null

sudo mv /etc/network/interfaces /etc/network/interfaces_ORIGINAL-FILE 2> /dev/null

sudo cp -pn /etc/resolv.conf /etc/resolv.conf_ORIGINAL-FILE

sudo cp -pn /etc/resolvconf.conf /etc/resolvconf.conf_ORIGINAL-FILE




echo 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid=\"Mobile Hotspot via Raspberry\"
psk=\"AccessPointPassword\"
key_mgmt=WPA-PSK
proto=RSN
pairwise=CCMP
group=CCMP
mode=2
frequency=5180
######### 2412 <---FOR COMPATIBILITY WITH OLDER DEVICES AND THE RASPBERRY 3B, USE A 2.4 GHz FREQUENCY LIKE 2412 INSTEAD OF A 5 GHz FREQUENCY LIKE 5180
}' | sudo tee /etc/wpa_supplicant/wpa_supplicant-OBwlan0.conf > /dev/null

sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant-OBwlan0.conf




echo 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
ssid=\"Mobile Hotspot\"
psk=\"MobileHotspotPassword\"
key_mgmt=WPA-PSK
}' | sudo tee /etc/wpa_supplicant/wpa_supplicant-DGwlan1.conf > /dev/null

sudo chmod 600 /etc/wpa_supplicant/wpa_supplicant-DGwlan1.conf




echo '[Match]
MACAddress=xx:xx:xx:xx:xx:xx
[Link]
Description=On-board WiFi chip provides the Access Point (OBwlan0)
Name=OBwlan0' | sudo tee /etc/systemd/network/04-OBwlan0.link > /dev/null


echo '[Match]
MACAddress=yy:yy:yy:yy:yy:yy
[Link]
Description=USB WiFi dongle connects to an internet hotspot (DGwlan1)
Name=DGwlan1' | sudo tee /etc/systemd/network/06-DGwlan1.link > /dev/null




echo '[Match]
Name=OBwlan0
[Network]
Address=192.168.4.1/24
IPMasquerade=yes
IPForward=yes
DHCPServer=yes
[DHCPServer]
DNS=84.200.69.80 1.1.1.1' | sudo tee /etc/systemd/network/08-OBwlan0.network > /dev/null




echo '[Match]
Name=DGwlan1
[Network]
DHCP=yes' | sudo tee /etc/systemd/network/10-DGwlan1.network > /dev/null




sudo mkdir /etc/systemd/system/wpa_supplicant@DGwlan1.service.d 2> /dev/null

echo '[Service]
ExecStartPre=/sbin/iptables -t nat -A POSTROUTING -o DGwlan1 -j MASQUERADE
ExecStartPost=/sbin/iptables -t mangle -A POSTROUTING -j TTL --ttl-set 64
ExecStopPost=-/sbin/iptables -t nat -D POSTROUTING -o DGwlan1 -j MASQUERADE' | sudo tee /etc/systemd/system/wpa_supplicant@DGwlan1.service.d/override.conf > /dev/null




sudo sed -i '/resolvconf=NO/d' /etc/resolvconf.conf

sudo sed -i '1i resolvconf=NO' /etc/resolvconf.conf

sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf




sudo systemctl mask networking.service dhcpcd.service

sudo systemctl enable systemd-networkd.service systemd-resolved.service

sudo systemctl disable wpa_supplicant.service

sudo systemctl enable wpa_supplicant@OBwlan0.service

sudo systemctl enable wpa_supplicant@DGwlan1.service




rm /home/pi/Desktop/router-off.desktop 2> /dev/null

sudo mkdir /usr/local/share/router-icons 2> /dev/null

sudo cp /usr/share/icons/HighContrast/scalable/devices/network-wireless.svg /usr/local/share/router-icons/router-on.svg

sudo sed -i 's|opacity:1|opacity:0|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '164s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '173s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '179s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '200s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '205s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '226s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i 's|#000000|#ff0000|g' /usr/local/share/router-icons/router-on.svg

sudo sed -i '173s|#ff0000|#000000|g' /usr/local/share/router-icons/router-on.svg

echo '[Desktop Entry]
Name=Router is On
Exec=router-off
Icon=/usr/local/share/router-icons/router-on.svg
Type=Application' > /home/pi/Desktop/router-on.desktop




reboot" | sudo tee /usr/local/bin/router-on > /dev/null

sudo sed -i '1i #!/bin/bash' /usr/local/bin/router-on

sudo sed -i "57i ############# USE THIS COMMAND LINE TO DISPLAY ALL WIRELESS MAC ADDRESSES:\\n" /usr/local/bin/router-on

sudo sed -i "59i ############# ip -o link | grep wlan | awk '{ print \"\\\033[38;2;255;0;0;1m\\\n\"\$2\"\\\033[0m\\\n\"\$17\"\\\n\" }'\\n" /usr/local/bin/router-on

sudo chmod 755 /usr/local/bin/router-on

sudo cp -p /usr/local/bin/router-on /usr/local/bin/router-on_BACKUP




echo "
########## RETURN THE RASPBERRY TO NORMAL WIFI MODE, BY RPi_Mike

########## THIS PORTION OF THE SCRIPT CREATES THE 'router-off' COMMAND AT /usr/local/bin




sudo mv /etc/wpa_supplicant/wpa_supplicant.conf_ORIGINAL-FILE /etc/wpa_supplicant/wpa_supplicant.conf

sudo mv /etc/network/interfaces_ORIGINAL-FILE /etc/network/interfaces




sudo systemctl unmask networking.service dhcpcd.service

sudo systemctl disable systemd-networkd.service systemd-resolved.service

sudo systemctl disable wpa_supplicant@OBwlan0.service

sudo systemctl disable wpa_supplicant@DGwlan1.service

sudo systemctl enable wpa_supplicant.service




sudo rm /etc/resolv.conf
sudo rm /etc/resolvconf.conf

sudo mv /etc/resolv.conf_ORIGINAL-FILE /etc/resolv.conf
sudo mv /etc/resolvconf.conf_ORIGINAL-FILE /etc/resolvconf.conf

sudo rm /etc/wpa_supplicant/wpa_supplicant-OBwlan0.conf
sudo rm /etc/wpa_supplicant/wpa_supplicant-DGwlan1.conf

sudo rm /etc/systemd/network/04-OBwlan0.link
sudo rm /etc/systemd/network/06-DGwlan1.link

sudo rm /etc/systemd/network/08-OBwlan0.network
sudo rm /etc/systemd/network/10-DGwlan1.network

sudo rm /etc/systemd/system/wpa_supplicant@DGwlan1.service.d/override.conf
sudo rm -d /etc/systemd/system/wpa_supplicant@DGwlan1.service.d




rm /home/pi/Desktop/router-on.desktop

sudo mkdir /usr/local/share/router-icons

sudo cp /usr/share/icons/HighContrast/scalable/devices/network-wireless.svg /usr/local/share/router-icons/router-off.svg

sudo sed -i 's|opacity:1|opacity:0|g' /usr/local/share/router-icons/router-off.svg

sudo sed -i '164s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-off.svg

sudo sed -i '173s|opacity:0|opacity:1|g' /usr/local/share/router-icons/router-off.svg

sudo sed -i '179s|opacity:1|opacity:0|g' /usr/local/share/router-icons/router-off.svg

sudo sed -i '200s|opacity:1|opacity:0|g' /usr/local/share/router-icons/router-off.svg

sudo sed -i '205s|opacity:1|opacity:0|g' /usr/local/share/router-icons/router-off.svg

sudo sed -i '226s|opacity:1|opacity:0|g' /usr/local/share/router-icons/router-off.svg

echo '[Desktop Entry]
Name=Router is Off
Exec=router-on
Icon=/usr/local/share/router-icons/router-off.svg
Type=Application' > /home/pi/Desktop/router-off.desktop




reboot" | sudo tee /usr/local/bin/router-off > /dev/null

sudo sed -i '1i #!/bin/bash' /usr/local/bin/router-off

sudo chmod 755 /usr/local/bin/router-off

router-on
}





YOU PROBABLY DON'T NEED THIS UNDO SCRIPT!
BUT IF YOU WISH, YOU CAN COMPLETELY UNDO THE WPA_SUPPLICANT UPGRADE AND REVERT BACK TO v2.8:

Unless you're troubleshooting the build of v2.9, I can't think of any good reason to revert back to the older, original version of wpa_supplicant that comes with the Raspberry's current operating system. It has a significant WPA2-related bug, after all. The new version works great on my system — and I don't just mean in WiFi-to-WiFi mode. It also works great in normal WiFi mode.

But if for some reason you wish to completely get rid of it and go back to v2.8, I took the time to write the following undo script. I also tested this with the advanced find command technique and a binary compare — so I can guarantee that it does a perfect undo job.

And of course, as described in detail above, if you revert back to the old version of wpa_supplicant (v2.8), your WiFi-to-WiFi router will only support WPA "weak security" at its Access Point — and you'll have to disable "proto=RSN" inside my router-on command for it to work.

{
cd /home/pi

rm wpa_supplicant-2.9.tar.gz 2> /dev/null

rm -r wpa_supplicant-2.9 2> /dev/null

sudo rm /sbin/wpa_supplicant

sudo rm /sbin/wpa_cli

sudo rm /usr/bin/wpa_passphrase

sudo rm /usr/share/man/man5/wpa_supplicant.conf.5

sudo rm /usr/share/man/man8/wpa_cli.8

sudo rm /usr/share/man/man8/wpa_passphrase.8

sudo rm /usr/share/man/man8/wpa_supplicant.8



sudo mv /sbin/wpa_supplicant_ORIGINAL-FILE /sbin/wpa_supplicant

sudo mv /sbin/wpa_cli_ORIGINAL-FILE /sbin/wpa_cli

sudo mv /usr/bin/wpa_passphrase_ORIGINAL-FILE /usr/bin/wpa_passphrase

sudo mv /usr/share/man/man5/wpa_supplicant.conf.5.gz_ORIGINAL-FILE /usr/share/man/man5/wpa_supplicant.conf.5.gz

sudo mv /usr/share/man/man8/wpa_cli.8.gz_ORIGINAL-FILE /usr/share/man/man8/wpa_cli.8.gz

sudo mv /usr/share/man/man8/wpa_passphrase.8.gz_ORIGINAL-FILE /usr/share/man/man8/wpa_passphrase.8.gz

sudo mv /usr/share/man/man8/wpa_supplicant.8.gz_ORIGINAL-FILE /usr/share/man/man8/wpa_supplicant.8.gz

echo; echo "VERSION STATUS:"

wpa_supplicant -version
}
Last edited by RPi_Mike on Sat Nov 21, 2020 11:59 pm, edited 35 times in total.

pidd
Posts: 2075
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Mon Oct 05, 2020 11:51 pm

Shouldn't the two letter country code for the UK be "GB"?

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 12:15 am

pidd wrote:
Mon Oct 05, 2020 11:51 pm
Shouldn't the two letter country code for the UK be "GB"?

Yes! Thanks for pointing that out. Fortunately, as you probably noticed, my tutorial includes a command line that automatically generates the correct country code, directly from the user’s system no matter where they live. However, I have now updated the wording of the "UK example” that I briefly mentioned. It now says GB, not UK.

User avatar
DougieLawson
Posts: 41309
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 7:35 am

Can you add some [code][/code] tags round your script and your HTML so that the forum doesn't make a mush of it..
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 8:37 am

DougieLawson wrote:
Tue Oct 06, 2020 7:35 am
Can you add some [code][/code] tags round your script and your HTML so that the forum doesn't make a mush of it..

If it would please you and others aesthetically, I have no objection to "hiding" the large block of code at the end of my post inside a tiny box. It's just a stock svg image, after all. And as long as that image continues to be included with the operating system, it's not needed anyway. In fact, I just made the edit!

But when it comes to the rest of my code, having it completely exposed and "out in the open" is important to me as an author — otherwise, all my hard work is concealed and hidden away inside a tiny scroll box that only displays a small number of lines at a time.

User avatar
DougieLawson
Posts: 41309
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 8:48 am

RPi_Mike wrote:
Tue Oct 06, 2020 8:37 am
DougieLawson wrote:
Tue Oct 06, 2020 7:35 am
Can you add some [code][/code] tags round your script and your HTML so that the forum doesn't make a mush of it..

If it would please you and others aesthetically, I have no objection to "hiding" the large block of code at the end of my post inside a tiny box. It's just a stock svg image, after all. And as long as that image continues to be included with the operating system, it's not needed anyway. In fact, I just made the edit!

But when it comes to the rest of my code, having it completely exposed and "out in the open" is important to me as an author — otherwise, all my hard work is concealed and hidden away inside a tiny scroll box that only displays a small number of lines at a time.
Just take a look at the page on a mobile phone and you'll understand the extreme level of ugliness.

The code box has two big advantages
1. it keeps the formatting.
2. it lets me select the stuff in the code box for a copy'n'paste to my Raspberry.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 9:48 am

DougieLawson wrote:
Tue Oct 06, 2020 8:48 am
Just take a look at the page on a mobile phone and you'll understand the extreme level of ugliness.

I thought I handled your aesthetic request quite reasonably by compromising with you. But I guess some want it all!

Ugliness and beauty, of course, are in the eye of the beholder — and to me, my hard-earned code looks beautiful.

I'd like it to be seen, not concealed — and my iPhone 11 Pro Max agrees!

If you check out my sticky at the top of the Graphics room, you'll see that I've already discussed this topic with a moderator. If my stylistic approach is good enough for them, it should be good enough for you.

PS: You're extremely knowledgeable — and your typically brief but insightful posts are voluminous. Perhaps one day you could shift your balance a bit and devote just 10% of your time to writing comprehensive tutorials on practical topics like I do. I'm sure the Linux community would benefit greatly from your effort.

pidd
Posts: 2075
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 1:33 pm

The current version of wpasupplicant on standard RpiOS-Buster and Debian Buster appears to be 2.7 not 2.8

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 3:11 pm

pidd wrote:
Tue Oct 06, 2020 1:33 pm
The current version of wpasupplicant on standard RpiOS-Buster and Debian Buster appears to be 2.7 not 2.8

You're making two separate statements, but only one of them is true.

Debian Buster is indeed using v2.7 of the wpa_supplicant command / wpasupplicant package.

But Raspberry Pi OS is of course only based on Debian Buster.

I just captured the following screenshot from a brand-new, freshly-burned, unmodified copy of the 2020-08-20 release of Raspberry Pi OS (32-bit) with desktop.

As you can see, the current pre-installed version of wpa_supplicant is exactly what I said it was in my tutorial — v2.8.

The newest version of wpa_supplicant is of course v2.9. My tutorial lets you build it automatically in only one minute to avoid the WPA2-related bug in v2.8, which I explained in great detail.

RPiOS_pre-installed_wpa_supplicant_version_RPi_Mike.png
RPiOS_pre-installed_wpa_supplicant_version_RPi_Mike.png (54.55 KiB) Viewed 6453 times

pidd
Posts: 2075
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK
Contact: Website

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 3:44 pm

That is strange, I keep my Pis updated and have ...

Code: Select all

wpasupplicant/stable,now 2:2.7+git20190128+0c1e29f-6+deb10u2 armhf [installed]
  client support for WPA and WPA2 (IEEE 802.11i)
but as you correctly point out

Code: Select all

wpa_supplicant -version
wpa_supplicant v2.8-devel
Copyright (c) 2003-2019, Jouni Malinen <j@w1.fi> and contributors

User avatar
neilgl
Posts: 3249
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 3:49 pm

Looks good but do I have to buy another WiFi dongle?

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 4:05 pm

pidd wrote:
Tue Oct 06, 2020 3:44 pm
as you correctly point out..... wpa_supplicant v2.8

The bottom line is simple:

If you want WPA2 security with your WiFi-to-WiFi router, simply follow the instructions in my tutorial.

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 06, 2020 4:31 pm

neilgl wrote:
Tue Oct 06, 2020 3:49 pm
Looks good but do I have to buy another WiFi dongle?

Please see my section on Linux kernel support for USB WiFi dongles.

In general, if you already have a dongle that works right out of the box for conventional WiFi on a standard Raspberry system, the chance that it will work with my tutorial is very high.

Of course, "very high" does not mean "certain". I'm obviously not purchasing and testing dozens of dongles.

There's really no downside, though. If you only have one dongle and it doesn't work, just switch off the router and delete the desktop icon — your system will be back to its normal behavior as if nothing had ever happened.

Buch
Posts: 2
Joined: Thu Oct 08, 2020 5:28 pm

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Thu Oct 08, 2020 5:38 pm

Sound an amazing work!

I'm looking for replacing my internet box as the performance aren't good with my provider and my internet usage is quite low. Sharing my mobile 4G is one of my solution.
Do you think, I can achieve this with your script ? Any idea about the performances in comparison to a "real" router?
Also, is there some limitations/conflicts/things to know if I want to combine your solution with others projects as Adguard Home or UFW ?

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Mon Oct 12, 2020 11:59 pm

Buch wrote:
Thu Oct 08, 2020 5:38 pm
I'm looking for replacing my internet box as the performance aren't good with my provider and my internet usage is quite low. Sharing my mobile 4G is one of my solution. Do you think, I can achieve this with your script ?

My script is fully tested and proven to work, so it will definitely allow you to share your mobile 4G connection as a traditional WiFi hotspot — in your home or anywhere else.

However, mobile hotspots were never intended for continuous use that goes on for days — a "limitation" that has nothing to do with my solution.

The typical "use case" for a mobile hotspot would be someone sharing their internet connection with a friend or family member on a car trip for a few hours. Most cellular-data companies — if their sophisticated systems detect "prolonged" use — will simply drop or reset the connection.

So a mobile hotspot should not be thought of as a replacement for your home’s internet service — nor can you count on it for long-term use.

My solution, therefore, is intended in the same spirit that telecom companies intended for mobile hotspots — a reliable but short-term method to provide WiFi access for a few hours or even just a few minutes. My toggle switch makes it very quick and convenient to flip back and forth.

Of course, my WiFi-to-WiFi router is a general solution that's broadly applicable to other sources of WiFi that have nothing to do with a mobile hotspot. For example, as I mentioned in my tutorial, it can also be used as a "WiFi extender".



Buch wrote:
Thu Oct 08, 2020 5:38 pm
Any idea about the performances in comparison to a "real" router?

When used as a mobile hotspot "normalizer", the performance of my WiFi-to-WiFi router is primarily limited by three key factors: (1) the maximum speed of the USB WiFi dongle; (2) the speed of the mobile hotspot's 4G or 5G cellular-data connection; and (3) the speed of the mobile hotspot itself. For example, even in their latest devices, Apple appears to limit their hotspot broadcast to the 2.4 GHz spectrum — even though it would probably be trivial for them to also make it available in the 5 GHz spectrum. Some Android phones, for example, actually do have a 5 GHz setting.

In real-world use, 4G connections will generally not go above the 50 and 60 Mbps level — and when they do go higher, it tends to occur sporadically. Keep in mind, I'm not talking about "first generation" 4G that came out around 2012. For example, I currently have the most advanced iPhone and the fastest 4G service in America. If you take into account the continuous refinements that have been made over the last several years, what I really have is more accurately thought of as "4.5G".

I've included a screenshot from my iPhone 11 Pro Max, which appears below. It shows the typical results I get from Google's built-in "internet speed test". The following connection chain was used during my test:

iPhone ---> Raspberry Pi 4 in RPi_Mike’s WiFi-to-WiFi router mode ---> iPad with 4G mobile hotspot ---> Test server 200 miles away

At the time of this writing, Google's speed-testing service defines any connection above 50 Mbps as "very fast" — whether it's a wireless or hard-wired connection. For another point of reference, Netflix recommends 25 Mbps for ultra-high-resolution 4K video.

So the fact I'm obtaining 43 Mbps — more than 5 full megabytes per second — from a 4G cellular-data connection — relayed through a Raspberry as a WiFi network — is really quite impressive. To put it in Google's terms, my speed of 43 Mbps is almost "very fast"! I'm sure my router could handle even greater speeds — but keep in mind that the underlying connection is 4G, not 5G.
Internet_Speed_Test_4G_Mobile_Hotspot_via_Raspberry_RPi_Mike.png
Internet_Speed_Test_4G_Mobile_Hotspot_via_Raspberry_RPi_Mike.png (81.18 KiB) Viewed 6149 times



Buch wrote:
Thu Oct 08, 2020 5:38 pm
Also, is there some limitations/conflicts/things to know if I want to combine your solution with others projects as Adguard Home or UFW ?

I've never used the software you mention, so I can't really say. I only use my toggle switch, every now and then, when the need for traditional WiFi arises.

Buch
Posts: 2
Joined: Thu Oct 08, 2020 5:28 pm

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Sun Oct 18, 2020 10:14 am

Thanks for this very detailed answer! Performance looks very great.

I take note of your advice. I will keep my standard internet box, the time to perform some tests to check if it is reliable for my case.

lewisandclark
Posts: 4
Joined: Sun Oct 18, 2020 10:18 pm

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Sun Oct 18, 2020 10:32 pm

Is the WiFi Direct feature fully functional in your build? Can it work as an offline subnet when no internet is available? Is there a functional limit on how many Android phones could communicate while offline? Impressive work you have done. Thanks.

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Mon Oct 19, 2020 5:02 am

Buch wrote:
Sun Oct 18, 2020 10:14 am
Thanks for this very detailed answer! Performance looks very great.

You're very welcome. Glad I could help!

User avatar
HermannSW
Posts: 4128
Joined: Fri Jul 22, 2016 9:09 pm
Location: Eberbach, Germany
Contact: Website Twitter YouTube

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Mon Oct 19, 2020 7:14 am

I bought this item last year, to enlarge the Wifi reach of our cable modem to pavillon at end of our garden
(it connects wirelessly to our cable modem, and provides Wifi network for the whole garden):
https://www.amazon.de/-/en/gp/product/B07BZ1XDSH

It is called a repeater, isn't that what your solution is as well?
https://stamm-wilbrandt.de/2wheel_balancing_robot
https://stamm-wilbrandt.de/en#raspcatbot
https://github.com/Hermann-SW/Raspberry_v1_camera_global_external_shutter
https://github.com/Hermann-SW/raspiraw
https://stamm-wilbrandt.de/en/Raspberry_camera.html

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 20, 2020 7:57 am

HermannSW wrote:
Mon Oct 19, 2020 7:14 am
I bought this item last year, to enlarge the Wifi reach of our cable modem to pavillon at end of our garden
(it connects wirelessly to our cable modem, and provides Wifi network for the whole garden):
https://www.amazon.de/-/en/gp/product/B07BZ1XDSH

It is called a repeater, isn't that what your solution is as well?

Since there isn't an internationally-recognized "official" list of terms, the description of these devices is effectively left to the marketing departments of various companies.

Different companies call it different things. They choose whatever description they think people will understand — and whatever description they think will sell the most product.

But yes, you could certainly describe my solution as a "WiFi repeater". It will "repeat" a pre-existing WiFi signal under a different SSID.

As I explained in my tutorial's Executive Summary, my solution can also be described as a "WiFi extender".

It also acts as a "mobile hotspot normalizer" that changes the appearance of a mobile hotspot to a traditional hotspot — and for me personally, that has been the most useful application.

Some might even call my creation a "pure WiFi router", because no other form of connectivity is involved — Ethernet or otherwise.

But conceptually, I prefer to call my solution a "WiFi-to-WiFi router" — because that description reflects the underlying function the Raspberry is actually performing.

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 20, 2020 7:58 am

lewisandclark wrote:
Sun Oct 18, 2020 10:32 pm
Is the WiFi Direct feature fully functional in your build?

WiFi Direct is of course unrelated to the scope of my tutorial — since my WiFi-to-WiFi router uses AP mode, not P2P mode.

Note to other readers: P2P, or Peer-to-Peer, is another name for WiFi Direct.

However, when I wrote my Bash script to automatically build the latest version of wpa_supplicant — version 2.9 — I was careful to include "CONFIG_P2P=y" in the configuration stanza — along with several other optional items.

As a result, my build of wpa_supplicant supports a wide range of features — including features that are not needed by my WiFi-to-WiFi router.

So although I have not recently experimented with WiFi Direct, my build of wpa_supplicant should fully support it.




lewisandclark wrote:
Sun Oct 18, 2020 10:32 pm
Can it work as an offline subnet when no internet is available?

TERMIUS — SSH VIA MY WIFI-TO-WIFI ROUTER:
Yes, networking with multiple devices works perfectly with my WiFi-to-WiFi router — offline and online.

In fact, I took screenshots of my iPhone 11 Pro Max simultaneously connected to two different Raspberries — via my WiFi-to-WiFi router.

NOTE: I combined my screenshots into giant images as large as 14 megapixels — so be sure to right-click and select "open image in new tab" for full-size viewing. Or on phones and tablets, "tap and hold" and save it to your pictures.

The following image shows multiple screenshots from my iPhone's Termius app — in both portrait and landscape mode. Termius facilitates terminal sessions via SSH.

As you can see, I colorized the most interesting items in red.

In the left-most vertical panel, you'll see that my iPhone is simultaneously connected to two different addresses.

In the top-right horizontal panel, you can see that my iPhone is logged into a Raspberry 4B running the 64-bit beta OS — with an address of 192.168.4.1. That Raspberry is the router itself — my WiFi-to-WiFi router. The connection chain is therefore:

iPhone ---> Raspberry 4B (WiFi-to-WiFi router)

In the bottom-right horizontal panel, you'll see that my iPhone is simultaneously logged into a different Raspberry — a Raspberry 3B+ running the 32-bit RPiOS — with an address of 192.168.4.9. The connection chain in this case reveals that my iPhone is connected to my Raspberry 3B+ through my Raspberry 4B:

iPhone ---> Raspberry 4B (WiFi-to-WiFi router) ---> Raspberry 3B+
Multiple_Computer_Access_from_iPhone_via_Termius_RPi_Mike.png
Multiple_Computer_Access_from_iPhone_via_Termius_RPi_Mike.png (215.7 KiB) Viewed 5718 times





SECURE SHELLFISH — SSH VIA MY WIFI-TO-WIFI ROUTER:
This next image is also from my iPhone. It shows a screenshot of the Secure ShellFish app — along with three other screenshots of the Files app that comes pre-installed with iOS.

The secure ShellFish technology is fully integrated into the Files app — so it allows me to use my iPhone to manipulate and transfer files and folders on any external system that supports SSH — all from within the iPhone's native Files app!

As you can see, it has no problem accessing all the files and folders on both my Raspberry 3B+ and the 4B.

The fact it's able to access the file system on the 3B+ is especially impressive when you consider that my iPhone is connecting to the 3B+ through my 4B — thanks of course to the full networking provided by my WiFi-to-WiFi router!
Multiple_Computer_Access_from_iPhone_via_Secure_ShellFish_RPi_Mike.png
Multiple_Computer_Access_from_iPhone_via_Secure_ShellFish_RPi_Mike.png (164.36 KiB) Viewed 5718 times





TERMIUS — LOGO ASSIGNMENT:
Finally, I'm including this cropped image from my first screenshot — just to bring it to everyone's attention. I was very impressed that the Termius app on my iPhone automatically recognized the 64-bit beta OS on my Raspberry 4B as a rather strong Debian flavor (it was, after all, built against the Debian ARM64 port). As a result, it shows the official Debian swirl logo — whereas the official Raspberry logo was automatically assigned to the 32-bit RPiOS on my Raspberry 3B+. Well done, Termius!
Termius_Icons_for_64-bit_Debian_vs_32-bit_RPiOS_RPi_Mike.png
Termius_Icons_for_64-bit_Debian_vs_32-bit_RPiOS_RPi_Mike.png (23.63 KiB) Viewed 5718 times




lewisandclark wrote:
Sun Oct 18, 2020 10:32 pm
Is there a functional limit on how many Android phones could communicate while offline? Impressive work you have done. Thanks.

As you probably guessed from all my screenshots, I'm an iPhone guy. And even if I were an Android guy, it would be very unlikely that I would have more than one phone laying around to test how many of them can simultaneously communicate through my WiFi-to-WiFi router.

But I will say this:

In a test, I successfully connected three separate devices — simultaneously — to the Access Point on my WiFi-to-WiFi router:

An iPhone, an iPad and a Raspberry 3B+.

All three devices were wirelessly connected to my Raspberry 4B, which acted as the platform for my router.

That means four devices in total were networked together.

Everything worked perfectly — all four devices were able to communicate with each other through my router.

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Fri Oct 23, 2020 8:28 am

.
UPDATE — 64-BIT SUPPORT NOW AVAILABLE:
I have now expanded the scope of my tutorial to include full support for the 64-bit beta version of Raspberry Pi OS.

That means my WiFi-to-WiFi router now works on six different platforms — two operating systems on each of three different models: The Raspberry Pi 3B, 3B+ and 4.

I have also made a variety of subtle refinements to my tutorial from top to bottom.

Enjoy!

lewisandclark
Posts: 4
Joined: Sun Oct 18, 2020 10:18 pm

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Tue Oct 27, 2020 6:35 pm

Thank you for the very thorough and detailed explanation of my questions. Is there a preferred location/link for your (WTW Router) setup?

User avatar
RPi_Mike
Posts: 232
Joined: Sat Dec 09, 2017 12:57 am
Location: United States

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Wed Oct 28, 2020 8:30 am

lewisandclark wrote:
Tue Oct 27, 2020 6:35 pm
Thank you for the very thorough and detailed explanation of my questions. Is there a preferred location/link for your (WTW Router) setup?

You're welcome!

As for a "preferred location/link" for my router's setup, I'm not entirely sure what the question is.

If you're asking about the location of my router's setup / configuration file — the file that lets you change the settings of the router at any time — that's fully explained in my tutorial under the all-caps headline in bold:

QUICKLY CHANGE THE SETTINGS OF THE WIFI-TO-WIFI ROUTER

Or perhaps you're asking if there's an even faster way to access the router's settings — other than simply using the command line I presented in my tutorial.

While writing my code, I actually considered adding a few extra lines to my installation script that would have automatically created a separate "Router Settings" button on the desktop — but I concluded that some people might feel I was cluttering their desktop with an unnecessary icon. I also figured that most people will change the router settings very infrequently.

However, if you or anyone else would like to have a dedicated, super-convenient "Router Settings" button on the desktop, just run the following stanza in Terminal. At the moment, the button’s icon comes pre-installed with both the 32-bit and 64-bit operating systems:

echo '[Desktop Entry]
Name=Router Settings
Exec=bash -c "sudo mousepad /usr/local/bin/router-on; router-on"
Icon=/usr/share/icons/gnome/48x48/categories/preferences-system.png
Type=Application' > /home/pi/Desktop/router-settings.desktop


When you double-click the button, it will instantly open the router settings file inside the Mousepad text editor. As soon as you change the router's settings and close the Mousepad window — and click "Save" — my "router-on" command will automatically activate the new settings and reboot your system.

Note: Your USB WiFi dongle should be plugged in before you change the settings — because the system will automatically reboot into "Router On" mode and it will expect to see that device.
Router_Settings.png
Router_Settings.png (46.44 KiB) Viewed 5410 times

lewisandclark
Posts: 4
Joined: Sun Oct 18, 2020 10:18 pm

Re: TUTORIAL: Mobile Hotspot via Raspberry Pi (WiFi-to-WiFi Router)

Wed Oct 28, 2020 4:51 pm

Sorry for a poorly worded question. I was actually asking if you had a dedicated link/web page to the instructions as you outlined on the forum. I would normally print out but am on the road without access to a printer. I like to have a printed hardcopy to make notes as I am still old school. (LOL) Planning to set it up on a RSPi 3 B+ to test. Thanks.

Return to “Networking and servers”