If you need DNS resolution to follow Wi-Fi or cellular network changes, or need to reach domains that rely on internal DNS, start with system as your baseline. To choose a specific resolver, enter its server IP; to encrypt queries sent to a resolver, enter a DoH endpoint. This guide walks through the steps in the iPhone and iPad Config and Home screens, and distinguishes resolution failures from changed rule matches and connection failures.
The three dns-server formats and when to use them
dns-server goes in the [General] section of a configuration file and specifies which resolver Shadowrocket uses for relevant DNS queries. It is not a [Rule] entry, does not decide whether a site uses DIRECT or PROXY, and does not change DNS settings for every app on your device.
| Type | Configuration line | Use cases and limitations |
|---|---|---|
| System DNS | dns-server = system | Uses the system-provided DNS settings. Start here when switching networks or checking internal domains; results may vary by network. |
| Custom DNS | dns-server = 1.1.1.1 | Specify a resolver by server IP to keep the test target consistent. This standard DNS format does not encrypt queries with HTTPS. |
| DNS over HTTPS | dns-server = https://cloudflare-dns.com/dns-query | Enter the resolver's full HTTPS endpoint. Your network must be able to reach the endpoint and validate its TLS certificate. |
The addresses in this table illustrate the format; they are not required settings. Before choosing a resolver, make sure it can resolve the domains you need. A public resolver returning public records does not mean it can resolve private domains on an office or home network. To reach an internal service, compare system DNS with settings provided by your network administrator rather than switching straight to public DoH.
Keep the network constant; change only the resolver
On the same Wi-Fi network, use system to check one public domain and one internal domain you actually need. Then change only dns-server and try again. If only the internal domain fails, first check whether the new resolver can return its internal record; don't change FINAL yet.
Change DNS in Config and verify the configuration is active
- In
Config, check which configuration file is currently in use. Keep a copy of the original, then edit a local copy. If the original file is updated remotely, a local copy prevents your test changes from being overwritten the next time it updates. - In the copy, find
[General]and replace the existingdns-servervalue. If the section is already present, don't add another one with the same name. Keep just onedns-serverentry for each test, and leave the other settings and rule order unchanged. - Save the file and select the modified configuration in
Config. Return toHomeand make sureGlobal Routingis set toConfig. Don't test rule order inProxyorDirectmode. If you're usingScene, don't assume the current scene is equivalent toConfig. - Reconnect, then start a new connection to the domain you tested before. An open page may still be reusing its connection, and the app or system may cache DNS results. Refreshing once is not enough to prove the new resolver received a query.
Check DoH endpoints and fallback settings
DoH endpoint example
- Configuration section
[General]dns-serverhttps://cloudflare-dns.com/dns-query- Endpoint components
https://, the service hostname, and the/dns-querypath
Use the path published by the provider. Don't enter only the hostname or replace the endpoint hostname with an arbitrary IP address.
Check fallback settings in an existing configuration
- Field to check
fallback-dns-server- Configuration to compare
dns-server = system- Comparison conditions
- Keep the network, target domain, and rule order the same
If your current configuration has a fallback resolver, a page loading successfully doesn't prove that the query used DoH.
When you enter a DoH address using a hostname, the device still needs to find that hostname's IP address before it can establish an HTTPS connection. Network outages, an incorrect endpoint path, an incorrect device clock, or certificate validation failures can all interrupt the query before it gets an answer for the target domain. Opening /dns-query directly in a browser is not the same as sending a valid DoH query. An error response to a normal page request alone does not prove the endpoint is broken.
When DNS results affect rule matching
When Shadowrocket knows the requested domain, an earlier DOMAIN-SUFFIX rule can match it directly; the domain does not need to be resolved to an IP first. If no domain rule matches and a later rule needs the destination IP, the DNS result may affect routing. The flow below describes requests that require an address check, not a fixed sequence for every request.
[Rule]
DOMAIN-SUFFIX,example.com,DIRECT
IP-CIDR,192.0.2.0/24,DIRECT
FINAL,PROXY
In this standalone example, the requested domain is www.example.com and the client knows the domain, so the first matching rule is DIRECT. A different IP returned after changing DNS won't send the request to the second rule. If the domain doesn't match the first rule, check whether the destination IP available for matching is in the example subnet. Only when neither of the first two rules matches does FINAL,PROXY apply. 192.0.2.0/24 is a documentation example subnet, not for real connectivity tests.
DOMAIN-SUFFIXmatches a domain suffix. If you open a literal IP address, it cannot match a rule for a domain that wasn't provided.IP-CIDRchecks whether an IP falls within a specified subnet;GEOIPmatches based on the destination IP's geographic location. If different resolvers return addresses in different subnets or locations, IP-based rules may match differently.- The same routing policy can still lead to different connection results. If two resolvers return different server addresses, two requests that both match
DIRECTmay connect to different servers. Don't infer that the rules changed just from how quickly a page loads.
Can't connect after changing DNS? Troubleshoot by symptom
During troubleshooting, note the network, active configuration file, target domain, and what failed. Don't change Wi-Fi, reorder rules, and switch resolvers all at once; if the problem goes away, you won't know which change fixed it. If public Wi-Fi requires a sign-in, complete that first, then test the DoH endpoint and target site.
All public domains stop loading after switching to DoH?
On the same network, restore dns-server = system, select the reverted configuration, and reconnect. If the same domains work again, check the DoH endpoint's hostname and path, as well as the device clock; then confirm that the current network can reach the endpoint over HTTPS. If both settings fail, check network connectivity and the current routing policy before adding more DNS changes.
Public sites load, but why won't my company's internal domains?
Reconnect to the company network and test the same full domain with system. If system DNS resolves it but a public resolver does not, ask your network administrator whether the domain is available only through an internal resolver. Also check whether it matches DIRECT as expected: resolving to an internal IP doesn't mean the selected outbound route can reach it.
DNS returned an address, so why is the connection still timing out?
If diagnostics show an A or AAAA record was returned, check the address actually used, the matching rule, and the outbound policy next. Getting an IPv6 address doesn't mean the current network has a working IPv6 route. If multiple addresses were returned, don't use an address that wasn't selected to judge which rule should match.
Does switching to DoH encrypt DNS for every app?
You can't draw that conclusion from this configuration line alone. First confirm that Shadowrocket handles the query you want to test, then check which resolver was actually used and whether the configuration has fallback settings. DoH protects the DNS query path to that resolver; it doesn't change how the website connection itself is encrypted or show that apps with their own DNS settings use the same query path.
Get Shadowrocket and read the setup guide
The iPhone and iPad version is available on the App Store for a one-time payment of $2.99. Check the App Store listing for system requirements. The Mac (Apple silicon and Intel), Windows, Android, and Linux versions are free; choose a version from the app page on this site to download. The app does not include a routing service subscription.