Let's say you have a Raspberry Pi 4G/LTE Cellular Modem Kit and an available cellular connection. If you need to create a second Wi-Fi network in addition to your primary LTE network, the easiest solution is to create a called hotspot, an access point where the other devices you can control can connect to access the internet.
Letβs start with setting up the LTE hotspot.
π Note
This method applies to Raspberry Pi OS versions prior to Debian Bookworm. For the latest Raspberry Pi OS, it's recommended to use nmcli. Raspberry Pi official hotspot documentations
Hardware
All the hardware needed to create our LTE hotspot is already included in the Raspberry Pi 4G/LTE Cellular Modem Kit. To set up the hardware please follow: Raspberry Pi 4G/LTE Cellular Modem Kit > Getting Started > Hardware Setup.
Preparation
Update / Upgrade Raspberry Pi OS packages.
sudo apt update && sudo apt upgrade -y
Reboot the system.
sudo reboot
Install requirements.
sudo apt install hostapd dnsmasq -y
Stop services to configure them.
sudo systemctl stop hostapd dnsmasq
Cellular Internet
Set up cellular internet connection. Please follow the instructions below to establish the cellular internet connection using ECM mode.
Configuration
βοΈ Attention
Please note the cellular interface name. In this tutorial, the cellular interface is usb0. If your cellular interface is different, change all usb0 interface names.
Configure a static IP for the wlan0 interface.
sudo nano /etc/dhcpcd.conf
Add the following lines at the end open file.
Configure the DHCP server (dnsmasq). Save the old configuration file and start configuring the clean configuration file.
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
sudo nano /etc/dnsmasq.conf
Add these lines to file and save.
Configure Access Point
We can now configure the access point details. We will set up a password-protected network so that only people with the password can connect.
Create a new file with the following command
sudo nano /etc/hostapd/hostapd.conf
Add these lines to the file and save. Change "NETWORK" and "PASSWORD" with yours.
Make sure each line has no extra spaces or tabs at the end or beginning.
Now we will tell the Pi where to find this configuration file.
sudo nano /etc/default/hostapd
Find #DAEMON_CONF="" line and change as below. Then save.
Forward internet connection by using bridge. First, install bridge-utils.
sudo apt-get install bridge-utils -y
Create bridge and forward.
sudo brctl addbr br0
sudo brctl addif br0 usb0
Configure bridge.
sudo nano /etc/network/interfaces
Add following line at the end of the file and save.
Check the hostapd service is masked. If service is masked, unmask the service.
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
and then reboot.
sudo reboot
Finishing up!
Restart the Raspberry Pi and everything should now work as it should!