Turn your old wireless router into an LTE router with OpenWRT

Today’s article has nothing to do with the NUC. Instead, I’m going to show you how you can turn your old wireless router into an LTE router if you just have an QMI-compatible LTE dongle. I recently got an LTE 4G mobile broadband connection that came with a Huawei E392 USB dongle. I found that the dongle was quite tedious to use on a laptop as it did not allow me to use the connection with multiple devices easily. A proper LTE router would have cost around €200 where as this project turned my old wireless router and the dongle that came with my subscription into an LTE router for no additional cost!

So I had a Western Digital N750 router and a Huawei E392 dongle.

OpenWRT is an open operating system that is meant to replace the OS that is running on many off-the-shelf wireless routers. It provides additional features compared to the manufacturers original firmware.

Is my router supported?

To make this happen, you will need a router that has a USB 2.0 port and that is supported by OpenWRT. The guys over at OpenWRT maintain a list of devices that are supported. Western Digital has discontinued their line of routers, so they’re being sold currently for a fraction of the money I paid for mine! There are many others as well and this article will pretty much apply for any supported router.

My 3G/LTE Dongle – is it supported?

This is a more tricky question. Basically if your dongle runs Qualcomm’s QMI protocol and it is supported by the qmi_wwan Linux module it should be fine. Huawei E392, E398, Vodafone K5005 and many others belong to this category. Do note that there are other drivers for other types of dongles, but this article only covers QMI dongles!

Installing the OpenWRT on the Router

It’s good idea to go to the OpenWRT website where they maintain a page for each supported device. For example for WD MyNet N750 the page is here and for N600 here.

Basically the process is following:

  • Locate the OpenWRT image for your router (there’s one you need for flashing over a factory image and another one you use for upgrades – choose the factory image if your flashing OpenWRT for the first time)
  • Download the image
  • Load the image into your router via the management web interface that your router has. Typically available at http://192.168.0.1 or http://192.168.1.1 Check the manual of your router or the OpenWRT installation page. If you’ve changed the settings on your router, there’s usually a reset button to clear the settings, but if you can access the web interface it’s not typically necessary to clear them.
  • Configure your router

These steps depend on the model of the router and are typically well-described on the OpenWRT page. After the software is flashed, the router will reboot and it will be running OpenWRT. Time to start the actual configuration!

Change the root password

Now that you have your router up, connect your computer to it with a cable and let it retrieve the IP address automatically using DHCP (this is usually what you do if you don’t have a static IP address configured for the computer). Then open a browser and point it to http://192.168.1.1 address. You will see page saying that there is no root password configured and that you should change it. Do that.

When you’ve changed the root password you should be able to see the status of the router in the web interface.

Installing QMI Drivers

The QMI drivers are not installed in OpenWRT by default. So you will need to install them manually. There are 2 ways to handle this installation. Either you have wired Internet connectivity to your router, which makes things very easy for you. However, I did not have, so I had to download the packages beforehand and then transfer them to my router and install them. This article describes what I had to do. If you have connectivity to your router, skip here.

Prerequisite Software

Download and install the following software on your laptop. If you use other OS than Windows, you can use other similar software.

OpenWRT Packages

Download the following packages. You can find all the packages here: downloads.openwrt.org/barrier_breaker/14.07/. At the time of writing 14.07 is the latest stable release. In case you’re installing a later release, download the packages for the corresponding release. Under that link you will find a folders for each type of architecture. You will need to determine the type of architecture that applies to your router (the factory image download link contains the architecture, so if unsure look at that link). For WD N600 and N750 it’s ar71xx. Under the architecture folder you will need to go into generic/packages/base folder and download the following packages:

  • libpthread
  • kmod-mii
  • kmod-usb-net
  • kmod-usb-wdm
  • kmod-usb-net-qmi-wwan
  • librt
  • libusb-1.0
  • usb-modeswitch
  • uqmi

Installing the Packages

Now open up WinSCP and create a new connection to your router. Select SCP as the protocol, enter 192.168.1.1 as the IP, root as the username and the password you set earlier.

Drag and drop the download packages to the right side which represent the files in your router.

Good, now you can close WinSCP and open the other software you downloaded, PuTTY. Define 192.168.1.1 as the IP address and hit connect.

After a confirmation you will see a terminal screen and a command line prompt.

Now enter the command to install all the packages that you had downloaded.

opkg install *.ipk

If you are missing some package, it will complain about missing dependencies. If that happens, go back, download the missing packages, transfer them to your router and try again. Successful output should look like this:


root@OpenWrt:~# opkg install *.ipk
Installing kmod-mii (3.10.49-1) to root...
Installing kmod-usb-net-qmi-wwan (3.10.49-1) to root...
Installing kmod-usb-net (3.10.49-1) to root...
Installing kmod-usb-wdm (3.10.49-1) to root...
Package kmod-usb-net (3.10.49-1) installed in root is up to date.
Package kmod-usb-wdm (3.10.49-1) installed in root is up to date.
Installing libpthread (0.9.33.2-1) to root...
Installing librt (0.9.33.2-1) to root...
Installing libusb-1.0 (1.0.9-1) to root...
Installing uqmi (2014-05-27-d7a56cad6d6ef3c2a5602fc604ee78fa) to root...
Installing usb-modeswitch (2014-07-18-01ecc3b97648f9adb0cd33) to root...
Configuring libpthread.
Configuring kmod-mii.
Configuring kmod-usb-net.
Configuring kmod-usb-wdm.
Configuring kmod-usb-net-qmi-wwan.
Configuring librt.
Configuring libusb-1.0.
Configuring usb-modeswitch.
Configuring uqmi.

That’s it, the packages are there. Now reboot the system by issuing a command reboot and proceed from chapter Configuring QMI just a little bit below. Note that you will lose connectivity when the system is rebooted.


reboot

Installing the Packages with Internet Connectivity

If you had wired connectivity on your routers WAN port, there would be no need to transfer the files with WinSCP or PuTTY. Instead you could go to web interface with your browser and open System -> Software. Click Update lists then type uqmi in the box that says Download and install package and click OK. Repeat for packages usb-modeswitch and kmod-usb-net-qmi-wwan. Then reboot the system via System -> Reboot.

Configuring QMI

At this point, you may want to log in to the router and confirm that you have a /dev/cdc-wdm0 device present. This represents your USB dongle.


root@OpenWrt:~# ls -l /dev/cdc-wdm0
crw-r--r-- 1 root root 180, 176 Oct 1 12:03 /dev/cdc-wdm0

If you do not have it, try to run the following, wait a short while and check again:


usbmode -l
usbmode -s

If you still don’t have /dev/cdc-wdm0 present, run logread and try to see if you can find any clues in the logs.

Now that you have your /dev/cdc-wdm0 device present, you can check that device is responding correctly.


root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"disconnected"
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-signal-info
{
"type": "lte",
"rssi": -61,
"rsrq": -6,
"rsrp": -88,
"snr": 290
}

The commands show that mine is disconnected currently and has LTE coverage at the moment. Now I need to issue a start-network command. For that I need to know which APN my dongle needs to use (typically internet, but check from your operator) and if authentication is used. In my case there’s no authentication.


root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect
38750672
root@OpenWrt:~# uqmi -d /dev/cdc-wdm0 --get-data-status
"connected"

The autoconnect parameter is important. It makes sure that device automatically reconnects when you restart your router or if you lose the connection for a while. In case you need to define authentication, add the parameters username and password plus possibly the auth-type to the start-network command line:


--start-network : Start network connection (use with options below)
--auth-type pap|chap|both|none: Use network authentication type
--username : Use network username
--password : Use network password
--autoconnect: Enable automatic connect/reconnect

Now the last thing to do is to add the following lines into /etc/config/network file:


config interface 'wwan'
option ifname 'wwan0'
option proto 'dhcp'

You can do this using the vi text editor, but if you’re not comfortable with that, point your browser to 192.168.1.1 again, choose Network -> Interfaces and click Add new interface.

Write wwan as the name of the interface and make it cover the wwan0 interface. Choose DHCP client as the protocol.

If you go back to the list of network interfaces, you should soon see the IP address that your dongle has received from your operator.

We’re almost there! Now you need to make sure that wwan interface belongs to your firewall’s WAN zone. To do that, go to Network -> Firewall, scroll down to wan and click the Edit button.

Now add a checkmark to the wwan box under Covered networks heading, click Save & Apply and you’re done.

That’s it! You’ve configured OpenWRT to be your LTE router. Now you can add other kind of functionality like wireless networks, tweak the firewall rules, install further software into the box – possibilities are almost endless. Or then you can just use it to share your USB dongle to your network. Finally, a speedtest.net result of 70+ Mbps downlink and 35+ Mbps uplink – not too bad.

5 Responses

  1. puppet91 says:

    hi..
    i’m trying to install the uqmi package using the web interface but it said that “Unknown package ‘uqmi'”.
    is it because im using different version of openwrt.
    my version is 12.09-rc1.

  2. mardyansyah says:

    I have HG553 router and E3372 LTE modem dongle. Can you tell me how to configuring them?thanks

  3. Garfield rosemary says:

    network error: connection to 192.168.1.1 refused any help?

  4. Ivan says:

    Thank you very much! Very useful! Working on 19.07.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.