DNS over SOCKS5: where the domain name is resolved
A domain name must be converted into an IP address before reaching a site. With SOCKS5, either the client application or the SOCKS server can perform that lookup. Both modes are valid, but they create different DNS paths and may return different addresses. The resolution location should therefore be an explicit choice.
Key points in one minute
- Local DNS happens before the SOCKS command is sent.
- Proxy-side DNS sends a domain name as the SOCKS destination.
- curl uses socks5 and socks5h for different resolution modes.
- A working proxy does not automatically prove the intended DNS path.
Local resolution
The client queries its configured resolver, receives an IPv4 or IPv6 address, and sends that numeric address to the SOCKS server. This mode depends on the device's DNS environment. The SOCKS destination field no longer carries the original domain name.
Resolution by the SOCKS server
SOCKS5 can carry a fully qualified domain name using the DOMAINNAME address type. The server then selects an address in its own DNS environment. In curl, this behavior is requested with socks5h or the socks5-hostname option.
Why answers may differ
DNS results depend on the resolver, cache, IPv4 and IPv6 availability, and the domain owner's configuration. Different addresses do not automatically indicate a fault. Compare timing, resolver context, A and AAAA results, and the actual connection outcome.
A controlled validation method
Use a domain you control with known records and logging. Run local and proxy-side modes, then compare addresses and connection success. Do not use a single third-party public site as the sole source of truth for production diagnostics.
Practical checklist
- 1Choose local or proxy-side DNS intentionally.
- 2Confirm how the application represents socks5h.
- 3Record A and AAAA answers for the control domain.
- 4Account for DNS cache and TTL before repeating a test.
- 5Keep real proxy credentials out of examples.
Sources and documentation
This material is based on primary, official, and technical sources. The article is an original summary written for this knowledge base.