[Project] Huawei B525s-23a DNS Fixer – Because My Router Keeps Forgetting Its Own Settings

So my Huawei B525s-23a decided it doesn’t believe in “persistence.”
You change DNS… it nods politely… and then on the next reboot it wakes up like:

“DNS? Never heard of it.”

Especially with ISP-flavored firmware, the router either hides the DNS fields entirely or pretends to save them and then wipes everything as soon as it restarts.

Since I got tired of my router gaslighting me, I wrote a small tool that logs in, pushes the correct DHCP/DNS config, and re-applies it automatically if the router resets it again.

Repo here:
https://github.com/illegal-instruction-co/huawei-dhcp-dns-tool


What this thing actually does

  • Logs into the WebUI using the real HiLink auth flow

  • Sends the DHCP/DNS XML the UI refuses to show

  • Detects when the router has “amnesia” after reboot

  • Re-applies everything every few minutes

  • Runs as a background systemd service on Umbrel/Raspberry Pi/Linux

  • No rooting, no telnet, no firmware hacks, no dark magic

If the router keeps wiping DNS, the script politely puts it back… forever.


Why I built it

I’m running Pi-hole and wanted the router to point to it.
The router wanted me to suffer.
That’s the whole story.


How it works (short version)

The tool:

  1. Grabs CSRF token + session cookie

  2. Encodes the password with Huawei’s weird login hash format

  3. Calls /api/user/login

  4. Sends a complete DHCP/DNS config to /api/dhcp/settings

  5. Repeats this every 5 minutes in case the router reboots and “forgets” again

No exploits, no trickery — just using the backend API the UI already uses but conveniently hides.


Tested on

  • Huawei B525s-23a — fully working

  • Should work on most HiLink devices with the same API (B315/B310/B535 etc.)
    but I haven’t tested them yet.

If you try it on another model, feel free to report back so I can add compatibility notes.


Installation

The repo includes a script that:

  • Installs the project

  • Builds it

  • Creates a systemd service

  • Starts it automatically on boot

After that, the router can reboot all it wants — the DNS settings won’t stay wrong for long.


Looking for testers

If you have any other Huawei HiLink model lying around and want to make it slightly less annoying, give this a try and share what happens. Worst case, nothing breaks. Best case, your router finally behaves.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.