RUTC50 / RUTX50: 5G stabilization script — lock LTE anchor + n78 watchdog with auto-recovery

Hi everyone,

I wanted to share a small shell script I use to keep my mobile connection more stable on NSA 5G, specifically with band n78.

In my setup, the modem sometimes drops from n78 and moves to LTE-only cells, which results in much worse throughput. Since NSA 5G depends on an LTE anchor cell first, the idea is to lock the modem to a good LTE anchor cell and then keep checking whether n78 is still active.

The script watches the modem in the background using AT+QCAINFO. If NR5G BAND 78 is present, it does nothing. If n78 disappears several times in a row, it reconnects the mobile interface. If reconnecting repeatedly fails, it reboots the router as a last resort.

It logs everything with:

logger -t 5g-watchdog

So the behavior can be followed in the system log.

The script can be added in RutOS under:

System -> Maintenance -> Custom Scripts

After saving it, restart the router so the watchdog starts cleanly after boot.

The main values that need to be adjusted are the mobile interface and the LTE anchor cell parameters. The easiest way to find the cell parameters is in the RutOS web UI:

Status -> Network -> Mobile

I tested it on RUTC50 with a Quectel RG520N modem.

I put the script and more details on GitHub here:

GitHub

Use at your own risk and adjust it to your local network conditions.

I am sharing it in case it helps someone with a similar NSA 5G stability issue.

Hello!

Thank you so much for sharing this with us and our community!

Do feel free to use the script; however, please keep in mind that you will be doing so at your own risk, as it was not created by Teltonika Networks.

We do appreciate you sharing this script. I hope it will be beneficial to you and other community members!

Kind regards,
Laura.

I don’t understand the benefits of this script; restarting the interface or even the router causes an interruption in the connection, thats worse than dropping from n78 to LTE-only cells?

Well, in my case, it is much better to reset the interface or router, because once it drops on LTE, it will not return to 5G. More important for me is the lock on a specific cell, this is the main source of instability in my conditions. Without the lock, my LTE connection dropped about 2 times a week, with the lock for 3 months without a problem.

Its interesting to see others have this issue with nsa 5G and band n78