This guide is for users who have imported their own configuration into Shadowrocket and want to adjust domain name resolution. First, distinguish DNS resolution from outbound traffic routing, then compare when to use system DNS, custom DNS, or DoH. Next, back up your Config, edit dns-server, and test one variable at a time on the same network before deciding whether to keep the change.
What DNS resolution and traffic routing rules each do
DNS looks up domain names and returns records such as IP addresses. When you open a website, DNS resolution is only one part of the connection process. After an address is returned, the device still needs to select a route, establish a transport connection, complete the TLS handshake, and load the page. If changing DNS makes a site work, that can help narrow down the cause—but a site failing to load does not automatically mean DNS is at fault.
Shadowrocket's dns-server specifies the upstream resolver; DIRECT and PROXY in rules specify how matching traffic is handled. They are separate settings. Encrypted DNS does not mean website traffic must go through a proxy, and system DNS does not mean website traffic must connect directly.
This sequence highlights distinct troubleshooting stages; it does not mean every rule must wait for DNS resolution. DOMAIN-SUFFIX can match a domain suffix directly. IP-CIDR and GEOIP match IP addresses and may require DNS resolution when only a domain is available. Rules are evaluated in order, and FINAL handles traffic that matches no earlier rule. Changing DNS does not reorder these rules.
When to use system DNS, custom DNS, or DoH
“System” and “custom” describe where the resolver comes from; DoH describes how queries are transported. These categories are not mutually exclusive: manually entering a DoH URL is also choosing a custom upstream resolver. Consider network reachability, the need to resolve internal domains, and how queries are transported—not just the names of the options.
| Setting | When to use it | Key limitations |
|---|---|---|
| System DNS | DNS works on the current Wi-Fi or cellular network, or you need to resolve internal domains provided by that network. | The resolver can change with the network. Actual behavior also depends on system settings and network management policies. |
| Custom standard DNS | You need a fixed resolver, and its IP address is reachable on the current network. | Standard DNS usually uses UDP port 53, though it can also use TCP port 53. Queries are not encrypted in transit. |
| DNS over HTTPS | You have a trusted, reachable DoH endpoint and want to encrypt queries between the client and that endpoint. | DoH depends on HTTPS connectivity, a valid certificate, and resolving the endpoint hostname. The resolver can still process query contents. |
Bottom line: establish a working baseline before choosing a fixed upstream resolver
If DNS works on your current network and you need internal domains, keep system DNS as your starting point. Test custom DNS or DoH separately only when you have a specific need for a fixed resolver or encrypted queries, and keep a copy of the original configuration so you can restore it.
Check your active configuration before editing in Config
This guide uses edits to the [General] section of a configuration file, rather than relying on buttons that may move between app versions. Home shows connection status and Global Routing; Config manages configuration files; Settings contains app settings. Editing a file that is not active usually does not change the configuration used by the current connection.
- In Home, note the current connection and Global Routing setting. To test rules, use the
Configmode and confirm which configuration is active. - Open Config and back up or duplicate the current configuration. Keep the existing DNS line and other General settings so you change only one variable at a time.
- Open the file's editing controls and find
[General]. Ifdns-serveris already present, edit that line instead of adding multiple settings with the same name to switch resolvers. - Save the file and make sure the test configuration is active. Then disconnect and reconnect so the next test uses the updated configuration.
- Note whether you are on Wi-Fi or cellular, which domain you are testing, what happens, and how to restore the original settings. Then begin the comparison.
Three ways to set dns-server in [General]
These are three mutually exclusive minimal examples. Choose one at a time to replace the corresponding setting in your current configuration. Do not use these snippets to overwrite the entire file, or you will lose existing rules and other settings. If your configuration includes specific domain mappings or other DNS options, check how those interact as well.
Use system DNS
[General]
dns-server = system
system uses the DNS provided by the system. It makes a useful baseline for comparison, especially when the current network needs to resolve internal domains. “System” does not guarantee a fixed resolver address; the resolver may change when you switch between Wi-Fi, cellular, or system network settings.
Set a custom standard DNS resolver
[General]
dns-server = 1.1.1.1
1.1.1.1 is an example of a standard DNS address, not a recommendation for every network. Use an address for a resolver you trust and know is reachable. Entering an IP address alone does not turn standard DNS into DoH, nor does it tell you whether queries travel through a proxy.
Set a DNS over HTTPS endpoint
[General]
dns-server = https://dns.example.com/dns-query
dns.example.com is a reserved example domain. The address above illustrates syntax only and cannot be used for DNS resolution. In practice, replace it with the full DoH endpoint provided by your DNS service, including https://, the hostname, and the path. /dns-query is a common path, but use the one specified by the endpoint—do not enter only the service homepage.
Standard DNS checklist
- Configuration section
- [General]
- Key
- dns-server
- Address format
- Resolver IP address
- Common ports
- UDP / TCP 53
First confirm the address is reachable on your current network, then compare resolution results.
DoH checklist
- Configuration section
- [General]
- Key
- dns-server
- Address format
- Full HTTPS endpoint
- Certificate requirement
- Valid certificate with a matching hostname
The endpoint hostname itself must also resolve to establish the connection; checking the URL spelling alone is not enough.
DoH protects DNS query transport, but does not replace outbound connection checks
DoH protects DNS queries between the client and resolver endpoint using HTTPS. It does not hide the queries the resolver must process, and it does not replace the TLS connection required by the website. The addresses returned by a resolver can vary with location, caching, and service policies; a difference alone does not prove an error or a faster result.
When a DoH endpoint uses a hostname, the client first needs to resolve that hostname to an address. This is called bootstrap resolution. If the hostname cannot be resolved, the certificate fails validation, or the HTTPS connection to the endpoint cannot be established, DNS may not work even when the configuration syntax is correct.
- Check the resolution result: Does the target domain return an address, an explicit not-found response, or only time out? These are different outcomes.
- Check the DNS transport: Is port 53 reachable for standard DNS, or can the client establish an HTTPS connection to the DoH endpoint?
- Check the destination connection: After an address is returned, does the website connection, TLS handshake, or resource request fail?
- Check rule matching: With Global Routing set to
Config, check which domain and IP rules match and which final policy applies.
Do not map Global Routing's Proxy, Direct, and Config modes one-to-one to DNS types. These modes control traffic handling; Scene switches behavior based on a scene and is not a fourth DNS protocol. For comparable results, keep the same mode, connection, and rule file while testing DNS.
Use the same test steps to avoid misleading results from caching
Browsers, the system, and apps may all retain connection or DNS caches. A page that was already open may keep loading after you change settings; that does not prove the new resolver is active. A first visit may also be slower because a new connection needs to be established. Test the same set of destinations repeatedly rather than drawing conclusions from a single page load.
- Establish a baseline: On the current network, use the original configuration to visit a familiar website and one that is currently failing. Record the specific symptoms, such as “DNS timeout,” “connection timeout,” or “some page resources failed to load.”
- Change DNS only: Keep the connection, Global Routing mode, and rules unchanged. Replace only
dns-server, save, and reconnect. - Make fresh requests: Close the existing pages and visit them again. Check connection records or logs for information that is actually available. A private browsing window does not guarantee that the system DNS cache has been cleared.
- Compare after restoring: Restore the original DNS setting and test again. If both settings fail, check the destination service, outbound connection, and rules instead of repeatedly switching resolvers.
- Test network changes separately: Only after that, repeat the test on Wi-Fi and cellular. Do not change networks in the same test round as DNS settings.
Common questions about DNS settings
Can't reach any websites after switching to DoH?
Restore dns-server from your backup, reconnect, and confirm that the original setup works again. Then check that the DoH endpoint is a complete URL, its hostname can be resolved during bootstrap, and its HTTPS certificate is valid. The example.com address in this guide is for demonstrating syntax only, not a working service.
An internal company domain only works with system DNS. What should I do?
Restore dns-server = system and test it on the company's network. Public resolvers usually do not know internal DNS zones, so do not replace an internal resolver just because a public resolver can look up public websites. If you need split DNS, first get the relevant domain scope and resolution requirements from your network administrator, then adjust the existing configuration.
DNS returns an address, but the page keeps spinning. What now?
Go back to Home and check the connection status and Global Routing. In Config mode, see whether the destination matches the expected rule, then check the outbound connection and any TLS errors. The problem may be after DNS resolution, so switching resolvers again may not help.
Why did my DNS changes disappear after a subscription update?
In Config, check which file is active and review its [General] section. Confirm whether the update changed the server list or replaced the full remote configuration. Refreshing a full configuration may overwrite local edits. Keep a personal copy, compare the changes, and then decide which file should hold your DNS settings.