Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Sep 2013 23:03:59 +0100
From:      Frank Leonhardt <frank2@fjl.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   Re: How to ask a DNS resolver listening on a different port than the tcp/udp 53
Message-ID:  <524600CF.3040609@fjl.co.uk>
In-Reply-To: <5245CC59.5060204@laposte.net>
References:  <5245CC59.5060204@laposte.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On 27/09/2013 19:20, Laurent SALIN wrote:
> Hello,
> I wondering how i can send queries to a dns resolver listening on a
> different port than the normaly 53 tcp/udp ?
>
> The situation:
> I've got a vps who running NSD as a autoritative nameserver, listening
> on tcp/udp 53 and unbound as personnal resolver, listening on a
> different tcp/udp port. It work very well on his own or with my OpenBSD
> gateway at home as DNS cache.
>
> Recently i've got a new FreeBSD VPS and I want to use the first VPS as
> DNS nameserver for the second VPS but FreeBSD is unable to send queries
> to nameserver on a different port as the normal one (tcp/udp 53).
>
> I've got a "bad" solution, use unbound on the second VPS and maybe tell
> him to ask the 1rst VPS on the unusual tcp/udp port, but I wonder myself
> if is it possible with Packet Filter to change the destination port of
> the queries forwarded to my 1rst VPS from tcp/udp 53 to tcp/udp 5353 for
> exemple ?
>
> Or maybe anybody got a other solution ?
>
> I hope you'll understand me :-/
>
> Laurent SALIN
>

If I understand the way it works correctly, the resolver pulls a list of 
the NS and hard-sets the port number for each to 53 (via a manifest 
constant) . See libc/resolv/res_init.c. All you need to do(!) is change 
this to a value of your choice and recompile libc (and anything that 
links to it statically) and it should be sorted. Or find an easier 
work-around.  I don't see any reason why the resolver library can't be 
modified to pick up a range of port numbers from the config (as other 
systems have), but AFAIK it can't.

The resolver isn't part of the kernel - it's the application doing the 
lookup, not FreeBSD (except in libc being part of the base system). Oh 
you know what I mean! Each application makes its own lookup.

I could be spectacularly out-of-date with this.

Regards, Frank.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?524600CF.3040609>