# How to Manually Add DoT or DoH Servers on GL.iNet Routers

**URL:** <https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244>\
**Category:** Router\
**Tags:** KB\
**Created:** [December 24, 2025, 11:12am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244 "2025-12-24T11:12:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![will.qiu](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@will.qiu](https://forum.gl-inet.com/u/will.qiu)\
**Post date:** [December 24, 2025, 11:12am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/1 "2025-12-24T11:12:11Z")

</div>

### Background

GL.iNet routers integrate encrypted DNS functionality to protect users from privacy leaks and DNS hijacking.

This tutorial provides guidance on manually adding and configuring custom DNS over TLS (DoT) and DNS over HTTPS (DoH) servers via SSH.  
It is specifically designed for users who need to integrate paid DNS services (such as NextDNS) or self-hosted DNS solutions (such as AdGuard Home).

* * *

> **Important Note / Disclaimer:**  
> The configuration outlined in this tutorial involves manual modification of system files via SSH.
> 
> - **No Official Support:** This functionality is **not officially supported** by GL.iNet at this time. Our customer service and technical support teams are unable to assist with troubleshooting issues related to these specific modifications.
> - **Advanced Users Only:** This guide is intended for users familiar with command-line interfaces (CLI) and SSH. Incorrect changes to system files may cause network instability or require a firmware reset. We recommend creating a backup file via Luci before proceeding.
> - **Future Updates:** Firmware upgrades may overwrite these settings or change how the underlying services function.

* * *

### Verified Devices & Firmware Compatibility

This method has been specifically tested and verified on the devices listed below. However, generally speaking, **any GL.iNet router running firmware version 4.8.x** should be compatible with this method.

- **Flint 3 (GL-BE9300):** v4.8.3
- **Flint 2 (GL-MT6000):** v4.8.3
- **Slate 7 (GL-BE3600):** v4.8.1
- **Beryl AX (GL-MT3000):** v4.8.1

* * *

### Prerequisites

Before proceeding, please ensure you meet the following requirements:

1. **SSH Access:** You know how to SSH into your router (using PuTTY, Terminal, or PowerShell).
2. **CLI Familiarity:** You are comfortable with basic command-line operations and text editors in a UNIX-like environment.

* * *

### **Part 1: Manually Configure DoT (DNS over TLS)**

This method uses the `stubby` resolver. You will first clear the existing configuration and then add your custom server details.

**1. Prepare the Router UI**

- Open the GL.iNet Admin Panel.
- Navigate to **Network** -\> **DNS**.
- Change **DNS Mode** to "Encrypted DNS".
- Set **Encryption Type** to "DNS over TLS".
- Select _any_ provider from the list (this initializes the service so we can modify it).  
 ![image](https://forum-static.gl-inet.com/original/3X/1/9/1912d493cac126decac2ad39a1123a4fc2168958.png)

**2. Clear Existing Stubby Config:** SSH into your router and run the following command block to remove the current resolver settings:

```Bash
while uci -q delete stubby.@resolver[0]; do :; done
uci commit stubby

```

**3. Add Custom DoT Servers:** Run the commands below.

> _Note: The example below uses Quad9. Replace the IP addresses and `tls_auth_name` with your specific provider's details._

```Bash

# Add Primary Server (IPv4)
uci add stubby resolver
uci set stubby.@resolver[-1].address='9.9.9.9'
uci set stubby.@resolver[-1].tls_port='853'
uci set stubby.@resolver[-1].tls_auth_name='dns.quad9.net'

# Add Backup Server (IPv4)
uci add stubby resolver
uci set stubby.@resolver[-1].address='149.112.112.112'
uci set stubby.@resolver[-1].tls_port='853'
uci set stubby.@resolver[-1].tls_auth_name='dns.quad9.net'

# (Optional) Add IPv6 Server
uci add stubby resolver
uci set stubby.@resolver[-1].address='2620:fe::fe'
uci set stubby.@resolver[-1].tls_port='853'
uci set stubby.@resolver[-1].tls_auth_name='dns.quad9.net'

# Commit changes and restart services
uci commit stubby 
/etc/init.d/stubby restart
/etc/init.d/dnsmasq restart

```

**4. Verify Configuration**

Your DNS requests are now protected by DoT and transmitted securely to the Quad9 server.

 ![image](https://forum-static.gl-inet.com/original/3X/5/1/5104ba9c6793fa6ed2c716d9d36b603185cb95df.jpeg)

* * *

### **Part 2: Manually Configure DoH (DNS over HTTPS)**

This method modifies the `dnscrypt-proxy2` configuration. You will need a **DNS Stamp** for your provider.

**1. Generate Your DNS Stamp**

If your provider does not supply a pre-made stamp (a string starting with `sdns://`), you must generate one manually. This is common for self-hosted instances like AdGuard Home or Pi-hole.

**Reference Guide:** For a comprehensive walkthrough, we recommend following the [AdGuard Knowledge Base: How to create your own DNS stamp](https://adguard-dns.io/kb/miscellaneous/create-dns-stamp/).

**Quick Steps:**

1. Go to the [DNS Stamp Calculator](https://dnscrypt.info/stamps/).
2. Select **DNS-over-HTTPS (DoH)** from the protocol dropdown.
3. Fill in the required fields:

- **IP Address:** The IP address of your server (e.g., `1.2.3.4`).
- **Host Name:** The server name used for TLS verification (e.g., `dns.example.com`).
- **Hashes:** The SHA256 hash of your server's SSL certificate.
  - _Note: This is critical if you are using a self-signed certificate. If using a valid public certificate (like Let's Encrypt), this is optional but recommended for security pinning._

- **Path:** The URL path for DoH requests (usually `/dns-query`).

1. Copy the generated string starting with `sdns://`.

> **Tip:** Ensure you have the correct IP address and Hash for your provider. If these do not match the server's actual configuration, the connection will fail validation.

**2. Edit the Configuration File:** SSH into the router and open the configuration file:

```Bash
vi /etc/dnscrypt-proxy2/dnscrypt-proxy.toml

```

**3. Add Your Custom Server:** Find the section labeled `[static]`. Add your custom server entry below it.

> **Important:** TOML files are sensitive to indentation. Ensure your indentation matches the existing file structure.

```auto
[static]

# Example 1: NextDNS

  [static.'NextDNS-Paid']
  stamp = 'sdns://xxxxxxxxx'

# Example 2: Your Custom Server
  # specific_name can be anything, but must be unique

  [static.'myserver']
  stamp = 'YOUR_GENERATED_SDNS_STAMP_HERE'

```

**4. Restart Services:** Apply the changes by restarting the proxy and DNS masquerade services:

```Bash
/etc/init.d/dnscrypt-proxy restart
/etc/init.d/dnsmasq restart

```

**5. Configure:**

- Open the GL.iNet Admin Panel and navigate to **Network** -\> **DNS**.
- Change **DNS Mode** to "Encrypted DNS".
- Set **Encryption Type** to "DNS over HTTPS".
- Click **Select Servers**.  
 ![image](https://forum-static.gl-inet.com/original/3X/a/2/a2602740d4356844d24a8f49ea615bda409d599c.png)
- Select the appropriate filter based on the configured label, and choose by the configured name.  
 ![image](https://forum-static.gl-inet.com/original/3X/0/3/035e83100b88efb42ff8ab8923b901890b09e09b.png)
- Click **Apply** to save the settings.  
 ![image](https://forum-static.gl-inet.com/original/3X/2/3/23a13acefd581055709791d00e26cb16f26338f3.png)

**6. Verify Configuration**

 ![image](https://forum-static.gl-inet.com/original/3X/b/c/bc7a66d28f7888003285889d66f94bed32573a67.png)

### Part 3: Persisting Changes (Firmware Upgrades)

To ensure your custom configurations survive a firmware upgrade, follow these steps based on the method you used.

**For DoT (UCI Configuration):** Since DoT settings are managed via the standard UCI system, you only need to check **"Keep Settings"** when performing a firmware upgrade via the GL.iNet Admin Panel. No extra steps are required.

**For DoH (File-based Configuration):** Because DoH requires modifying a system file manually, you must explicitly tell the router to back up this specific file during upgrades.

**1. Add file to backup list:** Run the following command via SSH:

```Bash
echo "/etc/dnscrypt-proxy2/dnscrypt-proxy.toml" >> /etc/sysupgrade.conf

```

**2. (Optional) Remove persistence:** If you no longer want to preserve this file in future upgrades, run this command to remove it from the backup list:

```Bash
sed -i '/\/etc\/dnscrypt-proxy2\/dnscrypt-proxy.toml/d' /etc/sysupgrade.conf

```

### Part 4: How to Revert Changes

If you encounter issues or wish to return to factory defaults, follow these recovery steps.

**For DoT:** Since DoT uses the standard configuration database:

1. Go to the **GL.iNet Admin Panel** -\> **Network** -\> **DNS**.
2. Simply change the DNS settings (e.g., switch back to "Automatic" or select a different standard provider).
3. This will overwrite the manual UCI injections automatically.

**For DoH:** If you have edited the `.toml` file incorrectly and the service won't start, you can restore the original file from the router's read-only memory (ROM).

Run this command via SSH to reset the configuration:

```Bash
cp -p /rom/etc/dnscrypt-proxy2/dnscrypt-proxy.toml /etc/dnscrypt-proxy2/dnscrypt-proxy.toml

```

_After running this, you need to restart the service using_

```auto
/etc/init.d/dnscrypt-proxy restart

```

* * *

### **References**

- [GL.iNet Docs: DNS Interface Guide](https://docs.gl-inet.com/router/en/4/interface_guide/dns/)
- [AdGuard Knowledge Base: How to create your own DNS stamp](https://adguard-dns.io/kb/miscellaneous/create-dns-stamp/)

---

<div class="post-metadata">

**Author:** ![will.qiu](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@will.qiu](https://forum.gl-inet.com/u/will.qiu)\
**Post date:** [December 24, 2025, 11:12am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/2 "2025-12-24T11:12:20Z")

</div>



---

<div class="post-metadata">

**Author:** ![will.qiu](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@will.qiu](https://forum.gl-inet.com/u/will.qiu)\
**Post date:** [December 25, 2025, 10:59am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/6 "2025-12-25T10:59:31Z")

</div>



---

<div class="post-metadata">

**Author:** ![daemon-byte](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/d/d07c76/32.png) [@daemon-byte](https://forum.gl-inet.com/u/daemon-byte)\
**Post date:** [January 12, 2026, 7:33pm UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/7 "2026-01-12T19:33:20Z")

</div>

thanks for showing how to do this. Is this something that is coming to the UI? I would love to be able to add my own there but support for the different DNS4EU options at least would be nice for those of us that want to avoid the US and keep our privacy 🙂

---

<div class="post-metadata">

**Author:** ![will.qiu](https://forum-assets.gl-inet.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@will.qiu](https://forum.gl-inet.com/u/will.qiu)\
**Post date:** [January 13, 2026, 1:20am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/8 "2026-01-13T01:20:18Z")

</div>

We currently have plans to introduce a feature for manually adding encrypted DNS in a future version, but we do not have a specific timeline to share at this moment.

As for **DNS4EU** , I believe we already support it via DoH.  
You can configure it as follows:

 ![image](https://forum-static.gl-inet.com/original/3X/1/b/1bb06481bb026710f2b523c4c9b2075cf9a4189a.png)  
 ![image](https://forum-static.gl-inet.com/original/3X/1/2/12e7495cba4f078637a49eb1b570aa862223b445.png)

---

<div class="post-metadata">

**Author:** ![system](https://forum-static.gl-inet.com/original/3X/7/7/77e28f6cb342ac4bd641bd9a6254595d61b2812a.png) [@system](https://forum.gl-inet.com/u/system)\
**Post date:** [April 13, 2026, 1:21am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/9 "2026-04-13T01:21:14Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![bruce](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/bruce/32/35649_2.png) [@bruce](https://forum.gl-inet.com/u/bruce)\
**Post date:** [August 4, 2026, 6:47am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/10 "2026-08-04T06:47:04Z")

</div>



---

<div class="post-metadata">

**Author:** ![bruce](https://forum-assets.gl-inet.com/user_avatar/forum.gl-inet.com/bruce/32/35649_2.png) [@bruce](https://forum.gl-inet.com/u/bruce)\
**Post date:** [August 4, 2026, 6:47am UTC](https://forum.gl-inet.com/t/how-to-manually-add-dot-or-doh-servers-on-gl-inet-routers/66244/11 "2026-08-04T06:47:24Z")

</div>


