I recently signed up for mobile service with a MVNO that uses Sprint's network. A free phone and unlimited data is included with the plan, along with unlimited tethering.
For my home internet setup, I already have a dual-WAN setup using Sophos UTM 9 running in a VirtualBox as the IDS/IPS load-balancing gateway. But still, given the unlimited data and tethering ability with the new cell phone plan, I wanted to add cellular broadband as a fall-back internet connection, mostly as an experiment but also as a useful backup internet uplink.
So I attached a USB wifi adapter to the Dell blade that hosts the Sophos UTM 9 gateway, looking to tether it to the cell phone hotspot only as far as wifi association takes place with no IP address, and connect the wifi-associated wireless lan adapter to the Sophos UTM 9 virtual machine which would then configure it with a DHCP address as another WAN uplink.
The alternative would have been to configure VirtualBox settings to connect the USB wifi adapter directly to the UTM 9 virtual machine. On researching this option, however, it appeared to be a daunting task to get Sophos UTM 9 to configure a wireless network adapter as an internet uplink.
Therefore I created the following bash shell script for the wifi USB dongle to associate with the mobile network. This script runs on the host blade. The UTM VM now has a new additional virtual adapter bridged to the wifi dongle. Everything works great.
#!/bin/bash
### wifi-wireless-usb-setup.sh
### REF: https://www.linux.com/training-tutorials/how-configure-wireless-any-linux-desktop/
DEVICE="wlx000f00bf03d7"
dhclient -r ${DEVICE}
ifconfig ${DEVICE} down
killall wpa_supplicant
rm -f /run/wpa_supplicant/${DEVICE}
ifconfig ${DEVICE} up
sleep 5
# wpa_supplicant.conf should have the output generated by "wpa_passphrase WIFI-SSID WIFI-PASSWORD"
wpa_supplicant -B -i ${DEVICE} -Dwext -s -c /etc/wpa_supplicant/wpa_supplicant.conf
iwlist ${DEVICE} scan
echo
echo "Connecting, please wait"
sleep 10
iwconfig ${DEVICE} rate 32M
iwconfig ${DEVICE}
echo "Check association with \"iwconfig ${DEVICE}\""
echo "Get IP address if needed with \"dhclient ${DEVICE}\""
sync;sync;sync
exit 0
"SIOCSIFFLAGS: Operation not possible due to RF-kill"
If you get the above error when you try to bring the wifi adapter up, the kernel has "soft blocked" your wireless adapter. To unblock it, do the following as root:
# rfkill list
1: phy1: Wireless LAN
Soft blocked: yes
Hard blocked: no
# rfkill unblock all
# rfkill list
1: phy1: Wireless LAN
Soft blocked: no
Hard blocked: no