OPNSense 4G WAN configuration
Article updated on 2022-12-09
This step-by-step tutorial will show you how to configure a 4G mPCIe cellular modem and use it as the primary internet connection in OPNSense.
Please note this article assumes that you have OPNSense already installed. This tutorial uses OPNsense 22.7, but newer and older versions should look similar.
4G hardware compatible with OPNSense
The first thing you need to do is to have compatible hardware. There are many 3G and 4G modems on the market, but not all of them work well with OPNSense. In addition, some modems aren't compatible with some motherboards.
In this tutorial, we are using a Simcom SIM7600G-H modem with APU4D4 motherboard. This hardware combination works very well in our experience.
Step 1: Install the modem in the device
If you are also using PC Engines APU3 or APU4, please make sure to connect the SIM card to the SIM1 slot and your modem to the middle mPCIe slot. If your operating system is installed on an SD card or USB thumb drive, you can also use the first mPCIe slot that is usually occupied by the mSATA SSD drive. In that case, you should connect the SIM card to the SIM2 slot.
If you are using APU2 or APU6, there's only one SIM slot, so it's harder to make a mistake.
Step 2: Create the PPP Interface.
Navigate to Interfaces => Point-to-Point => Devices and add a new device.
Note, if your modem is detected, the "Link interface" dropdown will contain multiple /dev/cuaU0.X devices. Depending on the modem you have, you will have to make a correct selection.
For SIMCOM modem, it's /dev/cuaU0.2, for Huawei ME909u-521 it was /dev/cuaU0.3.
OPNSense provides a very neat helper for discovering the correct APN setting for your provider. You can select the country, then the provider, and the APN setting will be filled automatically. If your provider is not on the list, you will have to enter the APN manually. Google "provider name APN" to find out what it should be.
Save and go to the next step.
Step 3: Interface assignment
We are assuming here that you want the mobile connection to be your primary WAN gateway. If that's the case, head to Interfaces => Assignment and pick the newly created PPP interface as your WAN.
Step 4: Verify the connection
If everything goes well, you should be able to see a public IP assigned to your WAN interface on the dashboard.
Expected 4G/LTE speed on OPNSense (and pfSense)
Neither pfSense nor OPNsense support modern LTE protocols such as QMI or NDIS to communicate between the modem and the operating system. Only the slow, serial PPP protocol is supported; therefore, the speed is greatly limited. In our tests on OPNSense 22.7, the maximum speed we have achieved is 21Mbps download and 12Mbps upload. The same hardware on OpenWRT in QMI mode achieves about 80-100Mbps download.
Here's a screenshot of a "good" result of the speed test on OPNSense with Simcom SIM7600G-H LTE kit.
Besides the protocol used, the actual speed depends on various factors such as distance to the nearest base station, capabilities of the base station, antennas used, time of day, or even weather conditions.
If you run into problems, refer to the LTE troubleshooting on pfSense and OPNsense article.