Ctrld

From DD-WRT Wiki

Revision as of 18:08, 20 June 2024 by Mile-Lile (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

ctdld

Contents

[edit] Introduction

ctrld is a highly configurable DNS forwarding proxy with support for: multiple listeners for incoming queries, multiple upstreams with fallbacks, multiple network policy driven DNS query steering, policy driven domain based "split horizon" DNS with wildcard support, LAN client discovery via DHCP, mDNS, ARP, NDP, hosts file parsing and much more. Supports various DNS protocols such as UDP53, DoH, DoT, DOH3, DoQ.

[edit] Installation

1. Enable JFFS if its not done already

   a. On the router web page click on Administration.
   b. Scroll down until you see JFFS2 Support section.
   c. Click Enable Flash Storage.
   d. Click Save.
   e. Wait couple seconds.
   f. Enable Wipe Flash Storage.
   g. Do not click Save. Click Apply instead.
   h. Wait till you get the web-GUI back

2. SSH to your DD-WRT router

3. Execute:

sh -c 'sh -c "$(curl -sL https://api.controld.com/dl)"'

you will get something like this:

         __         .__       .___
  _____/  |________|  |    __| _/
_/ ___\   __\_  __ \  |   / __ |
\  \___|  |  |  | \/  |__/ /_/ |
 \___  >__|  |__|  |____/\____ |
     \/       installer       \/ 

---------------------
|    System Info    |
---------------------
OS Type      : linux
OS Vendor    : DD-WRT
Arch         : armv7l
CPU          : ARMv7 Processor rev 0 (v7l)
Free RAM     : 154 MB / 247 MB
---------------------
|  Install Details  |
---------------------
Binary URL   : https://dl.controld.com/linux-armv5/ctrld
Install Path : /jffs/controld
---------------------
Install binary and run it? (y/n): y
 - Starting download
 - Making binary executable
 - Launching /jffs/controld/ctrld
---------------------
        __         .__       .___
  _____/  |________|  |    __| _/
_/ ___\   __\_  __ \  |   / __ |
\  \___|  |  |  | \/  |__/ /_/ |
 \___  >__|  |__|  |____/\____ |
     \/ dns forwarding proxy  \/ 

Usage:
  ctrld [command]   

Available Commands:
  run         Run the DNS proxy server
  service     Manage ctrld service
  start       Quick start service and configure DNS on interface
  stop        Quick stop service and remove DNS from interface
  restart     Restart the ctrld service
  reload      Reload the ctrld service
  status      Show status of the ctrld service
  uninstall   Stop and uninstall the ctrld service
  clients     Manage clients
  upgrade     Upgrading ctrld to latest version 

Flags:
  -h, --help            help for ctrld
  -s, --silent          do not write any log output
  -v, --verbose count   verbose log output, "-v" basic logging, "-vv" debug level logging
      --version         version for ctrld  

Use "ctrld [command] --help" for more information about a command.

[edit] ctrld with Control D servers

The binary is installed, but currently not doing anything. In order for it to do stuff, you must use the start command with the --cd flag, while supplying your ID. You will get your ID when you do registartion and after aplying it you'll get something like this:

root@r8000:~# /jffs/controld/ctrld start --cd yu007df299
Jun 20 17:51:37.000 NTC Reading config: /jffs/controld/ctrld.toml
Jun 20 17:51:37.523 NTC Starting service
Jun 20 17:51:41.046 NTC Generating controld config: /jffs/controld/ctrld.toml
Jun 20 17:51:42.460 NTC Service started
root@r8000:~#

To check if you are using Control D servers go to ctrld status page

[edit] ctrld with NextDNS

The binary is installed, but currently not doing anything. In order for it to do stuff, you must use the start command with the --nextdns flag, while supplying your ID. Something like this:

root@r8000:~# /jffs/controld/ctrld start --nextdns XXXXX
Jun 19 06:53:28.497 NTC Starting service
Jun 19 06:53:28.500 NTC Generating nextdns config: /jffs/controld/ctrld.toml
Jun 19 06:53:29.349 NTC Service started

where XXXXX is your NextDNS ID. To check if DOH3 is working go to NextDNS testpage:

[edit] Tips&Tricks

For proper work ctrld edits dnsmasq.conf file with message `# GENERATED BY ctrld - DO NOT MODIFY` so yours dnsmasq Additional Options will be erased every time router reboots. This is bad if you use dnsmasq for dhcp for example and have static entries or RA on ipv6. To mitigate such behaviour you can create your own dnsmasq.conf file and copy it to the /jffs/etc/dnsmasq.conf location which will be automatically executed by ddwrt on bootup. DO NOT forget to add lines ctrld added during conf generation and and lines for dhcp and dhcpv6. On Windows such file can be easily copied from Desktop with cmd using directive:

scp C:\Users\38165\Desktop\dnsmasq.conf root@192.168.1.1:/jffs/etc/dnsmasq.conf

where 38165 is name of the user on that win machine.

C:\Users\38165>scp C:\Users\38165\Desktop\dnsmasq.conf root@192.168.1.1:/jffs/etc/dnsmasq.conf
DD-WRT v3.0-r56932 std (c) 2024 NewMedia-NET GmbH
Release: 06/18/24
Board: Netgear R8000
root@192.168.1.1's password:
dnsmasq.conf                                                                          100%  236    14.7KB/s   00:00 

C:\Users\38165> 

[edit] Troubleshooting

please refer to Control D troubleshooting guide

ctrld.toml config file is located at:

/jffs/controld/ctrld.toml

you can view it with:

cat /jffs/controld/ctrld.toml

you can check pops at network page Finally, feel free to chat with support bot, Barry, located at the bottom right corner of the your dashboard, he's aware of everything related to ctrld

[edit] Reference

Git Repository
Control D webpage