Is it possible to make samba4's internal dns server listen on a port other than 53?

I need to run two dns server's on this host -- my desire was to use dnsmasq on the standard port for client's and configure dnsmasq to resolve the domain owned by the samba internal dns server correctly via the non-standard port.

Looking through smb.conf -- there are options to control the port binding used by many of the services -- but I'm not finding such an option for the dns server ...

  • why is this question getting downvoted? Its a legitimate question even if the answer is 'no its not possible'
    – Ben
    Feb 26, 2015 at 22:08

2 Answers 2


The reason you're not finding the option is that OS resolver libraries cannot use ports other than 53. While it's possible to have a nameserver forwarder use ports other than 53, it is unlikely that the authors of this software support and/or anticipate your particular use case. You would need ask them why this feature is absent.

You could try something like

  • add a secondary IP address to your system.
    • configure DNSmasq to listen on that address only.
  • Configure Samba to listen on the primary IP address
  • Configure samba to forward requests it can't handle to the IP DNSmasq is listening on.

I guess you could do it the other way around too.

  • You could forward the port using iptables as well. As Iain implies, the difficult bit isn't so much getting the service to appear on another port as getting any clients to go looking for it there.
    – MadHatter
    Feb 12, 2015 at 8:28
  • 2
    @MadHatter I did think about that as a solution and decided it got too messy very quickly.
    – user9517
    Feb 12, 2015 at 8:44
  • 1
    @lain dnsmasq has the ability to forward queries to a non-standard DNS server port -- so I assume that others have found use cases for this. I have good reasons to Want to do this
    – Ben
    Feb 24, 2015 at 22:32
  • - stability -- our DNS needs not to go down, samba4 is just super complex and we dont trust it - making it the client facing DNS server is just not viable for us. If the samba DNS server misbehaves we want to isolate that effect to only the ad domain and whatever behaviors that exist within the ad ecosystem which depend on the existence of an active directory-integrated DNS. Clients should point to dnsmasq on a standard port, dnsmasq will handle resolving queries for the ad domain via the samba DNS server
    – Ben
    Feb 24, 2015 at 22:32
  • 3
    You can't do what you want to do with Samba alone. Samba is though open source so I guess you could fix it yourself that way but that brings with it a whole other world of problems.
    – user9517
    Feb 25, 2015 at 6:36

The issue was opened and can be viewed here: https://bugzilla.samba.org/show_bug.cgi?id=14599

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .