@NoLight thanks for pointing to
@jacklul 's collection of scripts for Asus routers running stock firmware!
I played around with the scripts, managed to install the framework and some scripts, especially force-dns, but I did not seem to manage to have it work. The iptables rules would not implement due to the chains not existing or something...
Troubleshooting seemed overcomplicated and inaccessible to me, as the scripts looked complex and very hard to understand for me, when the goal is just to implement a few iptables rules.
After some thinking and as I am already using a Raspberry Pi to host Pihole with Unbound as my LAN DNS, and seeing that the LAN DHCP options in AsusWRT allow to specifiy a gateway for the LAN, I though it might be possible to use the Pi as the LAN gateway, with the Pi itself having the Asus router as its gateway.
Guess what? It works! The Pi does not even need to have several ETH ports, nor to be placed between the ONT and the router or between the router and the clients on the LAN, it just connects to one of the router's LAN ports as any other LAN client would.
On the Pi, you are free to implement all iptables NAT rules that you need to redirect all DNS requests to the PiHole, block DoT, etc. I used Claude AI to check the feasability and guide me through the implementation steps (all from CLI over SSH).
At the router level, it only took specifying the Pi's IP as the LAN gateway.
The router still acts as the DHCP server, as I have a dozen static DHCP devices already configured in there.
Actually you could replace the Pi with any other device, like a physical firewall, or OpenSense or pfsense in a VM or a container running on your NAS, etc.
This helped me understand the CLI network tools quite a bit better. I guess the next step would be to migrate from AsusWRT to OpenWRT. This is tempting in order to unlock all the potential of the hardware and remove all restrictions, and have the firewall rules implemented onto the actual gateway directly.
The router could also run AdGuard (no PiHole package for OpenWRT), and I could get rid of the Pi altogether, but I love its ease of use running Debian-based distros.
The only thing remaining would be to use iptables and ipset in order to implement rules blocking all traffic to a public list of DNSs, only allowing outbound requests from Unbound to the root hints servers list, which should block DoH. Tutorials are available.
Thanks again for pointing to the scripts, they are still quite interesting and certainly useful to extend the featureset and useability of an Asus router on stock firmware!
Regards!
[Edit] DoH blocking was achieved (can never be 100%) by following this article and adapting it (intended for pfsense):
Your Smart TV is probably ignoring your PiHole - LabZilla
Claude AI suggested adding 2 more sources of DoH-specific DNS lists on top of the public DNS list mentionned in the article.