OpenWRT 4G WAN configuration

This step by step tutorial will show you how to configure a 4G mPCIe cellular modem, and use it as the main internet connection in OpenWRT. 

Please note this article assumes that you have OpenWRT already installed. If that's not the case, please start by installing OpenWRT on your router.

4G hardware compatible with OpenWRT

The first thing you need to do it to have compatible hardware. There are many 3G, 4G and LTE modems on the market, but not all of them work well with OpenWRT. Some modems aren't compatible with some motherboards.  

In this tutorial, we are using Quectel EC25-E LTE modem with APU4D4 motherboard. This hardware combination works very well in our experience.

If you are also using PC Engines APU3 or APU4, please make sure to connect the SIM card to 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 SIM2 slot. 

Please refer to the image below for details.


4G LTE speed

The popular mobile modems available on the market are Category 4. Category 4 modems can get a theoretical maximum of 150Mbps download speed and 50Mbps upload speed. Please note that these speeds are theoretical, and in practice, the speed of 100Mbit/s is often maximum achievable. The actual speed depends on a variety of factors such as distance to the nearest base station, capabilities of the base station, antennas used, time of day or even weather conditions.

Configuring QMI interface 

There are many different proprietary cellular communication protocols and it may be a little overwhelming to know which ones work well, which ones your modem supports and how to get the modem working properly. There are PPP, QMI, MBIM, NCM and a few others. Each one is configured slightly differently and has a different level of support in OpenWRT. That's a mess worth its own article.

In this article, we are using the Quectel modem so we will use the QMI protocol. This protocol is well supported in OpenWRT and is able to deliver a good performance.

Step 1: Install QMI software packages

Go to Software -> Update list -> search for QMI -> install the following packages.

qmi-utils luci-proto-qmi

Now you need to reboot the router. If you don't reboot, the next step won't work.

Step 2: Create the QMI interface

Go to Network => Interfaces => click "Add new interface"

You can input any name you like. In this example, I named my interface "4G". 

In the protocol field choose "QMI". If you don't see QMI on the list, you have not installed the right packages or haven't rebooted the router.

 

Click "create interface" to go to the next step. 

This is the main configuration screen for your LTE connection. The important configuration fields here are "APN" and "Modem device". 

Step 3: APN configuration

APN stands for Access Point Name and it's the name your modem will try to connect to gain access to the public internet. It's similar to SSID in WiFi networks. If you don't know what to input here, google for "APN + your provider name". 

Select "/dev/cdc-wdm0" in the "Modem device" dropdown. If you don't see this device in the dropdown, your modem is not detected. Go to the troubleshooting section.

​​​​​​​Input the other fields as you see on the screenshot. If your SIM card has a PIN number, make sure to enter that.

click save.

After a minute, your interfaces should look like on the screenshot below. 

Please note that two interfaces showed up. One called "4G" and another one "Virtual dynamic interface (DHCP client)" called "4G_4".

The "_4" means that the interface has an IPv4 IP address. This is based on the "PDP Type" selected in the previous step. If your carrier supports IPv6, you can use that as well (not recommended).  

If you see a valid IPv4 address, like on the screenshot, it means that your connection has been established successfully, and the last thing to do is to configure the 4G interface as a default WAN. 

If you see "NETWORK_REGISTRATION_FAILED", power off the router, wait a couple of seconds and power it back on. A soft reboot may not work, do a full shutdown. If this did not help, go to the troubleshooting section. 

Step 4: Set the 4G interface as default WAN

Note, on the previous screenshot there's a wired WAN interface on eth0. We will need to delete this interface and configure the 4G interface as WAN.

Click the "Delete" button next to "WAN" and confirm the deletion.

Now click "Edit" on the 4G interface => go to Firewall settings tab => Assign firewall zone => Select WAN => Save.

 

The result should look similar to the screenshot below. At this point, you should have a working 4G router.

You can verify the speed with http://www.bredbandskollen.se/ 

The speeds I have seen are highly dependent on the time of day. With this configuration, I have seen speeds between 50Mbit/s to a little over 100Mbit/s. Typically around 70-80Mbit/s. 

Good luck! 


Tip: check out many similar articles about LTE configuration in our Knowledge Base.


TekLager specializes in selling open source hardware for building routers, firewalls and other network appliances.

QUECTEL-EC25-E-KIT

Quectel EC25-E LTE kit

TekLager Quectel EC25-E-LTE kit
860 SEK 2099-01-01 860 SEK
1075.00 SEK incl. vat
APU4D4_MOTHERBOARD

PC Engines APU4D4 - 4 LAN / quad core CPU / 4 GB RAM

TekLager PC Engines APU4D4 - 4 LAN / GX-412TC quad core / 4 GB DRAM LTE modem compatible.
1,803 SEK 2099-01-01 1,803 SEK
2253.75 SEK incl. vat
APU4D4_ROUTER

APU4D4: 4x Gigabit LAN, Quad Core CPU, 16GB SSD, 4GB RAM

TekLager APU4D4 Router/Firewall. 4x Gigabit NIC, Quad-Core CPU, 16GB SSD, 4GB RAM. Compatible with pfSense, IPFire, OPNSEnse and others.
2,387 SEK 2099-01-01 2,387 SEK
2983.75 SEK incl. vat
TLSENSE-i7-6500U

TLSense i7 6500U: 6x Gigabit LAN, 6th gen i7 CPU, 128GB SSD, 16GB RAM

TekLager TLSense i7 6500U: 6x Gigabit LAN, 6th gen i7 CPU, 128GB SSD, 16GB RAM
6,618 SEK 2099-01-01 6,618 SEK
8272.50 SEK incl. vat