How to set DNS server
This page shows you how to choose the DNS server that your Hiddify server uses, and how to check that DNS works. You need it if sites don't open through your proxy, or if a DNS leak test shows the wrong DNS servers.
DNS (Domain Name System) turns names into IP addresses. For example, when you open google.com, your device first asks a DNS server "what is the IP of google.com?". The DNS server answers with the IP address, and only then does your device connect to the site.
Your server needs a working, trusted DNS server, just like your phone or computer.
Well-known public DNS servers
Big companies run free DNS servers that work worldwide. These are good choices for your server:
| Address | Provider |
|---|---|
1.1.1.1 |
Cloudflare |
8.8.8.8 |
Symptoms of a DNS problem on the server
- Sites don't open through the proxy, or open very slowly, while the connection itself works.
- The installer or an update shows the warning
DNS is not working. - A DNS leak test shows DNS servers you didn't choose.
The fix is one or both of the methods below.
Method 1: set the DNS server in the panel
The panel's DNS Server setting is the DNS server that Hiddify's proxy service uses to look up sites for your users. The default is 1.1.1.1 (Cloudflare).
- Log in to your Hiddify admin panel.
- Open Settings.
- In the search box (Search all settings…), type
DNS Server. The setting is in the General Settings section, among the advanced settings. - Enter the DNS server you want, for example
1.1.1.1or8.8.8.8. The description under the field also suggests1.1.1.2(blocks malware) and1.1.1.3(blocks malware and adult content). - Click Save.
- When the panel asks, click Apply Configs so the change takes effect.
Method 2: set the server's own DNS over SSH
The server's operating system also uses a DNS server, for example to download updates. On Ubuntu, Hiddify uses the systemd-resolved service for this. If the server's DNS doesn't work, set it with the script that comes with Hiddify (the installer uses the same script).
- Connect to your server over SSH. If the Hiddify menu opens, press
Ctrl+Cto leave it. -
Run this command on your server. It sets the DNS servers to
8.8.8.8and1.1.1.1: -
When it finishes, the last line should say
DNS servers set to 8.8.8.8 and 1.1.1.1.
Don't delete or lock /etc/resolv.conf
Older guides told you to delete /etc/resolv.conf, write it by hand, and lock it with chattr +i. Don't do this on a current Hiddify server. On Ubuntu this file is managed by systemd-resolved, and locking it can stop Hiddify's installer from repairing DNS. If you locked it before, unlock it with sudo chattr -i /etc/resolv.conf.
Check DNS on the server
Run these commands on your server, over SSH.
-
Check which DNS servers the system uses:
Look for the line DNS Servers. It should list only the servers you chose, for example
8.8.8.8 1.1.1.1. -
Check that a name can be resolved:
If it works, you see one or more
Address:lines with Google's IP addresses. TheServer:line may show127.0.0.53. That is normal: it is the localsystemd-resolvedservice, which forwards the request to the servers from step 1. If you see an error such asconnection timed outorserver can't find, DNS doesn't work: repeat Method 2.(If
nslookupis missing, install it withsudo apt install dnsutils.)
