How does SOCK 5 proxy-ing of DNS work in browsers?

dsign picture dsign · Oct 13, 2015 · Viewed 14.5k times · Source

Browsers can proxy DNS requests through SOCKS 5. What I don't understand is how the process works.

Correct me if I'm wrong. In normal DNS operation, a program does DNS resolution through its operating system, which in turn is configured to access a specific DNS server(s) and make queries there. So, in normal operation a browser should not do DNS queries over the network by himself.

Now, with a SOCKS proxy, the browser needs to do his own queries. How that the browser knows which DNS server will exist at the other end of the proxy tunnel?

Answer

dsign picture dsign · Dec 5, 2015

The browser doesn't do his own DNS lookups then. I don't know if there are actual situations in which a browser will speak DNS to a DNS server. But with SOCKS5 proxy configured the browser simply asks to the SOCKS5 to connect to hosts using the host name of the host instead of its IP address. It's up to the SOCKS5 proxy then to do the lookup.

I know this because I maintain a SOCKS5 implementation.