hiddify.st
EN

TopicDNS

Fake DNS: a ticket first, a seat later

With fake DNS on, a program looking up a domain instantly gets a fake IP from a reserved range, and when it connects, Hiddify hands the domain to the proxy. This article explains the process, the benefits, the usual side effects, and how to tell whether a problem comes from it.

Checked on

A telephone switchboard and its operators: DNS connects names to numbers
A telephone switchboard and its operators: DNS connects names to numbers Donated by Anamosa Library and Learning Center, CC BY-SA 4.0

Settings → DNS has a switch called Turn on fake DNS. The name sounds alarming, as if someone were being deceived. It does deceive: the programs on your device, so that the proxy can be faster and more accurate.

Fake DNS has a single switch, yet it touches the first step of opening every new site. Understanding how it works helps you judge whether cases like “sites will not open after the proxy is off” or “one app behaves oddly” come from it.

How normal DNS goes

Without fake DNS, when the browser visits example.com:

  1. The browser asks the system for the IP of example.com.
  2. Hiddify catches the question and looks it up through the proxy with remote DNS.
  3. It gets the real IP and tells the browser.
  4. The browser connects to that IP, and Hiddify passes the connection to the proxy.

The trouble is step 2: every new domain needs a lookup through the proxy first, one extra round trip. With a proxy server abroad, that round trip can be several hundred milliseconds.

A library card catalogue: traditional DNS goes to the cabinet for a card every time
A library card catalogue: traditional DNS goes to the cabinet for a card every time Alicia Fagerving, CC BY-SA 3.0

How fake DNS goes

With it on, step 2 changes: Hiddify does not look anything up. It immediately hands the browser a fake address from a reserved range and remembers that this address stands for example.com. When the browser connects to it, Hiddify sees the fake address, knows the destination is example.com, and passes the domain to the proxy, which resolves it abroad. sing-box commonly uses 198.18.0.0/15 for fake addresses; that range is reserved for testing and never clashes with real sites.

A lookup with fake DNS on
> nslookup example.com
Name:    example.com
Address:  198.18.0.12

An address starting with 198.18 means fake DNS is at work.

Benefits

BenefitWhy
New sites open fasterOne DNS lookup through the proxy is saved
More accurate resolutionThe proxy server resolves locally and gets the server nearest to it
Lookups not exposedThe local network cannot see which domains you look up
More accurate routingEven if a program gives only an IP, Hiddify maps it back to the domain and applies the rules

Side effects

Fake addresses only mean something while Hiddify runs. Once you disconnect, problems appear:

  • Cached fake addresses: browsers and the system cache DNS results for a while. After Hiddify stops, they still try 198.18.x.x and fail; some sites will not open after you turn the proxy off, then work again a few minutes later.
  • Programs that use IPs directly: a few programs check whether a result is a public address and fail when they see a reserved one.
  • Local discovery: casting, printers and other features that find devices by local names may be confused by fake addresses.
  • ping results: ping example.com shows an address starting with 198.18 and a delay that is not real; do not be misled.
Cloakroom tickets: fake DNS hands out a ticket first, and the real thing is collected with it
Cloakroom tickets: fake DNS hands out a ticket first, and the real thing is collected with it DAIWGOMIO 200, CC BY-SA 4.0

Should you turn it on

  1. Most of the timeKeep the default; if nothing is wrong, leave it
  2. New sites open slowly, high delay to servers abroadTry turning it on and notice how fast sites open the first time
  3. An app misbehaves after turning it onTurn it off, reconnect, and see if that fixes it
  4. Sites fail after turning the proxy offProbably the cache; wait a few minutes or flush the DNS cache
How to decide

Flushing the system DNS cache: on Windows run ipconfig /flushdns at a command prompt; on macOS run sudo dscacheutil -flushcache; on phones toggle airplane mode once.

How it relates to other options

Fake DNS affects only proxied traffic. Sites that go direct are still resolved to real IPs by the outbound server resolver. It works most completely in VPN mode, where every program's DNS goes into Hiddify; in system proxy mode browsers usually hand the domain to the proxy anyway, so it is not needed.

How to tell whether it is the cause

When something odd happens, rule it out in these steps:

  1. Look up a common domain with nslookup at a command prompt; a result starting with 198.18 means fake DNS is at work;
  2. Turn off Turn on fake DNS, then disconnect and connect again;
  3. Flush the system DNS cache once and repeat what went wrong;
  4. If the problem is gone, fake DNS and that app do not get along; if it remains, the cause is elsewhere and you can switch it back.

Once you know it is the cause, you do not have to turn it off entirely. Add a direct rule for just that app or that domain, and the rest of your traffic keeps the speed fake DNS brings.

Is fake DNS more private?

The local network cannot see the domains you look up, which is more private. What the sites themselves and your proxy provider can see does not change.

Why do some test sites say my DNS is abroad?

Because domains are resolved by the proxy server where it is, which is exactly what fake DNS does.

Does fake DNS conflict with remote DNS?

No. With fake DNS on, proxied domains are mostly resolved by the proxy server and remote DNS is used less, but it is still used in other cases.

What else should I do on a phone after turning fake DNS off?

Toggle airplane mode once or restart Wi-Fi so the system drops the fake addresses it cached, then try the misbehaving app again.