Maintaining home network access from the outside with a network-controllable power plug, OpenWrt/LEDE and a 4G LTE stick

Internet routers are supposed to operate in a stable fashion. Except they don’t (FritzBox *cough*) – especially when you’re away from home and need access to your home resources. Having to call someone related to go and reset the thing tends to get awkward. If you encounter this often enough, you begin looking for a remote reset solution.

Here is mine:

  • The router gets attached to a network-controllable power plug.
  • An access point running OpenWrt/LEDE with USB ports gets a 4G LTE stick attached.
  • A SIM card is required that fulfills two criteria:
    • It provides a small data plan for small cost (easy).
    • The mobile network provider offers an APN with public IP addresses, ie. no NAT (harder).

Let’s discuss each of these points.

1. The network-controllable power plug

There are power plugs that speak IP directly but I found them to be rather expensive. Also if they have Wifi connectivity only and the closest access point is the router hanging we have a problem.

For this reason and because I have some “smart home” infrastructure running already anyways I went with a radio-controlled power plug instead, the Fibaro Wall plug . It talks ZWave, a home control radio standard that uses frequencies between 850 and 950 MHz (the ISM/SRD bands) and features a large number of available devices. As the ZWave controller I use a Raspberry Pi together with the RaZberry HAT. Provided I get into my home network, I can use the web interface or access the REST API directly to power-cycle the power plug, causing the connected Internet router to reboot. So how do I get into my home network if my internet router crashed?

2. The access point and the 4G LTE stick

Obviously the Internet router crashed, so we need a second device that we can customize to add internet connectivity. Since our main Internet line (cable, DSL, fibre, avian carrier, you name it) is connected to the main Internet router and it itself may suffer from outage we’re looking for a backup solution, which in past times would have been a modem (#oldfart). These days there is basically one ubiquitous alternative to fixed media and that is 4G LTE mobile networks (ie. WWAN). (You could also use a Wifi connection if you have one available but these are likely hindered by firewalls beyond your control.)

The second device customizable enough and likely available unless you’re living in a single room flat is an access point capable of running OpenWrt/LEDE. I use a TP-Link Archer C7 v2.0 which enjoys fairly good OpenWrt/LEDE support.

As regards the LTE stick there is good news and there’s bad news. The good news is that the model I use, the Huawei E3372, is widely available (in retail stores, on eBay and also in branded variations, eg. “Telekom Speedstick V”, “Megafon M150-2”) and rather affordable. The bad news is that is exists in two variations: “Hilink” mode (E3372h), in which it runs as a mobile router appearing to the USB host as a network interface and providing NAT itself, and “stick mode” (E3372s), in which it provides an old-fashion AT command interface together with PPP/NCM modes, which is what we want because we don’t want any NAT to interfere with our goals.

You can’t determine from the outside which you get (unless you slide open the cover to the SIM slot). You can however flash a stick from one mode to the another if you’re willing to invest some time and sweat but I’ll get to that and the OpenWrt/LEDE setup in separate posts.

3. A cheap SIM card without NAT

Remember that we’re looking for a backup path into our home network that usually stays unused. Therefore we’re looking for a small data plan only, cheap is more important. If it were for these requirements only we’d have plenty of options even in Germany. For example, my cable provider provides a SIM card with a 500MB plan per month for free.

However most mobile networks do NOT, ie. assign private IP addresses only, thereby defeating the desired SSH/VPN access from the internet into our home network. In Germany this includes Vodafone and Telefonica/O2 (unless you’re willing to get talked into some business VPN tariffs), leaving only Telekom. What many Telekom SIM card owners do not know is that you can use an alternate APN instead of the default internet.telekom, namely, which assigns public IP addresses. Bingo!

Now this makes it a bit harder to find a cheap SIM card because Telekom tariffs are in general of the more expensive kind but with Telekom retailers you either don’t know for sure that the SIM card bought is really for the Telekom network or it’s likely not to be LTE-enabled. My recommendation: if you know someone who’s eligible for the “MagentaEINS Vorteil” (= using Telekom for both DSL and mobile) ask her/him to get you a MagentaMobil Family Start card. This is a prepaid card where the regular €2,95/month price gets waived if you have MagentaEINS, leaving a monthly fee of €2/month for the smallest data plan “Data Start S” (150MB) that gets deducted from the prepaid balance. Naturally you should take care that the balance doesn’t hit zero.

Et voila!

This was a high-level description of my solution. Note the difference to the “usual” scenario of attaching a 4G LTE stick to your Internet router for redundancy/load balancing purposes where you’re inside the home network and want to maintain connectivity to the outside Internet, probably even in an automated manner: we, by contrast, want to solve the problem where you’re outside the home network and want inside.

I’ll go in on more details on the OpenWrt/LEDE setup and the Huawei E3372 flashing in followup posts.