[squid-users] dns_nameservers with port?

Alex Rousskov rousskov at measurement-factory.com
Mon Feb 16 00:35:35 UTC 2026


On 2026-02-15 10:42, listy wrote:

> Can _dns_nameservers_ take port number?

Currently, dns_nameservers rejects name server addresses with port numbers:

      WARNING: rejecting '127.0.0.1:5353' as a name server, because
          it is not a numeric IP address


> with:
> _dns_nameservers 10.9.4.7:5350_
> Squid starts but when I try to use it, Squid logs:
> 
> ...
> WARNING: idnsSendQuery: Can't send query, no DNS nameservers known!
>      current master transaction: master56
> ...
> 
> What is (not)happening here?

After all dns_nameservers addresses were rejected (see above), Squid may 
start but will fail to send any DNS queries, logging the above error 
message. I hope that future Squid versions will refuse to start instead 
(i.e. the "rejecting ..." behavior described above will become a fatal 
configuration error).


FWIW, you can use a non-default port number, one for all custom name 
servers, by building Squid sources with NS_DEFAULTPORT macro defined and 
set to the desired port value. IMO, this hack is not an officially 
supported feature and may disappear without warning or diagnostics.


HTH,

Alex.




More information about the squid-users mailing list