Cloudflare DNS Enabler

ryu

Magisk
v1.0
Version
2.30 KB
Size
Jun 24, 2024
Updated

Module Info

  • Contributors ryu-ryuk
  • Source Code View Repository
  • Tags
    #Cloudflare #DNS #1.1.1.1 #iptables #resetprop #Magisk Module #ryu-ryuk

About this module

Cloudflare DNS Enabler by ryu makes your phone use Cloudflare's DNS, 1.1.1.1 and 1.0.0.1, on Wi-Fi and mobile data. It also catches apps that ask a different DNS server and sends those requests to 1.1.1.1 too.

What the boot script does

Everything happens in one post-fs-data.sh that runs at every boot:

  • Sets net.dns1 / net.dns2 and the mobile-data equivalents (net.rmnet0.dns1/2, net.rmnet1.dns1/2) to 1.1.1.1 and 1.0.0.1 with resetprop.
  • Adds two iptables NAT rules that rewrite every outgoing DNS request on port 53, UDP and TCP, to 1.1.1.1. Apps with a hard-coded DNS server end up at Cloudflare as well.
iptables -t nat -A OUTPUT -p udp --dport 53 -j DNAT --to-destination 1.1.1.1:53
iptables -t nat -A OUTPUT -p tcp --dport 53 -j DNAT --to-destination 1.1.1.1:53

Good to know

  • It's plain DNS on port 53, not encrypted. The README lists DNS over HTTPS as a future plan; v1.0 is described as "the initial & possibly the final release".
  • The redirect rules are IPv4 only (iptables, no ip6tables), so DNS requests over IPv6 aren't rewritten.
  • Android's Private DNS uses port 853, which these rules don't touch. If you have Private DNS set to a hostname, that keeps working as before.
  • The redirect always goes to 1.1.1.1; 1.0.0.1 is only set as the secondary DNS property.

Install, check, remove

  1. Install ohyescloudflareV1.zip from the Modules screen in Magisk (v20.4 or newer) and reboot.
  2. Open https://one.one.one.one/help in a browser and look for "Connected to 1.1.1.1".
  3. To undo it, remove the module and reboot. The rules and properties are only set at boot, so they're gone after the restart.

MIT licensed. Support is in the author's Telegram chat linked from the repository.