[Fixed] What DNS settings can cause lag in DNS-by-SOCKSv5-proxy (openssh tunnel) setups?

USE CASE: I have a functional Debian Stretch machine. It has WAN access through my Omnia with operational DNS resolving (I can ping www.google.com and get a response). It runs open-sshd which I use as a SOCKS5 proxy. For instance I use Putty on MS. Windows machines to tunnel their traffic through unprotected networks and/or overly protected networks (i.e. I use it as a poor-man’s VPN). Normally, this setup worked perfectly.

PROBLEM: Since I have my Omnia I run into the following issue:

Once I turn on “Proxy DNS when using SOCKS v5” in the client that uses the proxy/tunnel (Firefox in this case) the tunnel lags immensely (talking minutes here) when I try to resolve for instance www.google.com. When I use Google’s IPv4 instead ( it is loaded nearly instantly.

So I already narrowed it down to a DNS (timeout?), but here my knowledge fails me Hence my question here:

  • What are the routing settings that may be related to DNS resolving when being proxied (especially in relation to the aforementioned use-case)?

Nota bene 1) The machine running opensshd has no problems using DNS itself (it is as if it simply does not extend that functionality to the openssh tunneled client).

Nota bene 2) The issue is bigger than simply turning off the remote DNS usage in the client (possible in Firefox) as many programs always (not configurable) use the DNS from the server on the endpoint of the tunnel (mostly for privacy reasons).

Although many more settings are probably related to DNS-by-proxy, the one that was causing the lag in the described case was simply the primary DNS pointing to a non-excising one (pi-hole instance).

It seems that regular clients simply switched to the secondary one (in this case the router) as I took the the Pi-hole one down some weeks ago, but the ssh-tunneling proxy apparently did not switch so easily (but instead waited minutes or even until a time-out or something along those lines).

At any rate; removing the referral to the non-existing Pi-hole DNS server removed the lag!