I have tried all methods in the following link except DNS+DNSCrypt (having issues in flashing files): https://forum.xda-developers.com/general/xda-university/guide-how-to-change-dns-android-device-t3273769/page1

I need something which actively locks DNS after I set it.

I have tried Override DNS & scripts in the link but that only set my specified DNS after reboot and connectivity change and do not prevent DNS servers from changing.


Instead of locking DNS records, you can try to block all DNS requests.

If the problem is that you then cannot add new DNS records to domains that are not in the hosts file, just check all incoming DNS requests and see if the domain is in the hosts file. If it already is, block the DNS packet, so it doesn't change, if it is not in the hosts file, add the domain to the hosts file.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.