|
| 1 | +--- |
| 2 | +title: DD-WRT Installation |
| 3 | +impact: HIGH |
| 4 | +impactDescription: Without proper JFFS setup and installation procedures, NextDNS CLI will fail to persist on DD-WRT routers, causing DNS configuration loss after reboots and potential certificate errors due to time sync issues. |
| 5 | +type: capability |
| 6 | +tags: DD-WRT, JFFS, router, NTP, time sync, dnsmasq, SSH, router installation |
| 7 | +--- |
| 8 | + |
| 9 | +# DD-WRT Installation |
| 10 | + |
| 11 | +**Impact: HIGH** - Essential setup for NextDNS CLI on DD-WRT routers with persistent configuration |
| 12 | + |
| 13 | +NextDNS CLI has no native GUI support on DD-WRT and must be installed on JFFS storage to ensure persistence across reboots. Proper setup requires enabling JFFS, configuring time synchronization, and protecting custom DNS settings. |
| 14 | + |
| 15 | +## Pre-requisites |
| 16 | + |
| 17 | +- NextDNS CLI has no native GUI support on DD-WRT |
| 18 | +- Must be installed on JFFS (JFFS2 filesystem) for persistence |
| 19 | +- Requires SSH access to the router |
| 20 | +- Router must have sufficient JFFS storage space |
| 21 | + |
| 22 | +## JFFS Enablement |
| 23 | + |
| 24 | +JFFS must be enabled and properly wiped before installing NextDNS CLI: |
| 25 | + |
| 26 | +1. Navigate to **Administration** > **Management** in the DD-WRT web GUI |
| 27 | +2. Locate the **JFFS2 Support** section |
| 28 | +3. Enable the following options: |
| 29 | + - **Enable JFFS2**: Set to **Enable** |
| 30 | + - **Clean JFFS2**: Set to **Enable** (only for initial setup or when wiping data) |
| 31 | +4. Click **Apply Settings** |
| 32 | +5. Wait for the router to process the changes |
| 33 | +6. After the flash storage is wiped, disable **Clean JFFS2** and click **Apply Settings** again |
| 34 | +7. Reboot the router to ensure JFFS is mounted properly |
| 35 | + |
| 36 | +**Important**: The "Clean JFFS2" option should only be enabled once during initial setup. Leaving it enabled will erase JFFS contents on every reboot. |
| 37 | + |
| 38 | +## Installation and Upgrade |
| 39 | + |
| 40 | +Connect to your DD-WRT router via SSH and run the universal installer: |
| 41 | + |
| 42 | +```bash |
| 43 | +sh -c "$(curl -sL https://nextdns.io/install)" |
| 44 | +``` |
| 45 | + |
| 46 | +The installer will: |
| 47 | +- Detect DD-WRT as the platform |
| 48 | +- Install NextDNS CLI to `/jffs/nextdns/` |
| 49 | +- Configure the service to start automatically |
| 50 | +- Set up integration with dnsmasq |
| 51 | + |
| 52 | +### Upgrading |
| 53 | + |
| 54 | +To upgrade an existing NextDNS CLI installation, re-run the same installer command: |
| 55 | + |
| 56 | +```bash |
| 57 | +sh -c "$(curl -sL https://nextdns.io/install)" |
| 58 | +``` |
| 59 | + |
| 60 | +The installer automatically detects existing installations and performs an upgrade. |
| 61 | + |
| 62 | +## Time Sync Workaround |
| 63 | + |
| 64 | +DD-WRT may experience x509 certificate errors during boot due to incorrect system time. To prevent this, configure an NTP forwarder: |
| 65 | + |
| 66 | +```bash |
| 67 | +/jffs/nextdns/nextdns config set forwarder 2.pool.ntp.org |
| 68 | +``` |
| 69 | + |
| 70 | +This ensures that NTP queries for `2.pool.ntp.org` are forwarded to your upstream DNS, preventing certificate validation failures during the boot sequence when the system clock hasn't synchronized yet. |
| 71 | + |
| 72 | +## dnsmasq Persistence |
| 73 | + |
| 74 | +NextDNS CLI modifies the default dnsmasq configuration. To protect custom dnsmasq settings and ensure they persist across NextDNS updates: |
| 75 | + |
| 76 | +1. Create a persistent dnsmasq configuration file: |
| 77 | + |
| 78 | + ```bash |
| 79 | + mkdir -p /jffs/etc |
| 80 | + touch /jffs/etc/dnsmasq.conf |
| 81 | + ``` |
| 82 | + |
| 83 | +2. Add your custom dnsmasq settings to `/jffs/etc/dnsmasq.conf`: |
| 84 | + |
| 85 | + ```conf |
| 86 | + # Example custom settings |
| 87 | + dhcp-option=option:router,192.168.1.1 |
| 88 | + dhcp-option=option:dns-server,127.0.0.1 |
| 89 | + ``` |
| 90 | + |
| 91 | +3. This file will be preserved when NextDNS CLI updates or modifies the main dnsmasq configuration |
| 92 | + |
| 93 | +**Why this matters**: NextDNS CLI edits the default dnsmasq configuration during installation and updates. Using a separate persistent file ensures your custom settings are not overwritten. |
| 94 | + |
| 95 | +## Troubleshooting |
| 96 | + |
| 97 | +If you encounter issues during installation, run the installer in debug mode to get detailed diagnostic output: |
| 98 | + |
| 99 | +```bash |
| 100 | +DEBUG=1 sh -c "$(curl -sL https://nextdns.io/install)" |
| 101 | +``` |
| 102 | + |
| 103 | +Common issues and solutions: |
| 104 | + |
| 105 | +- **JFFS not mounted**: Verify JFFS is enabled in Administration > Management and reboot the router |
| 106 | +- **Installation fails**: Ensure you have sufficient JFFS storage space using `df -h /jffs` |
| 107 | +- **Certificate errors**: Apply the NTP forwarder workaround described above |
| 108 | +- **dnsmasq conflicts**: Check `/tmp/dnsmasq.conf` for conflicts with existing rules |
| 109 | + |
| 110 | +## Reference |
| 111 | + |
| 112 | +- [NextDNS CLI GitHub](https://github.com/nextdns/nextdns) |
| 113 | +- [NextDNS CLI Wiki](https://github.com/nextdns/nextdns/wiki) |
| 114 | +- [DD-WRT Documentation](https://wiki.dd-wrt.com/) |
0 commit comments