# how to use netmasq and samba4 at the same time?

## bluephoenix

Hi,

In my scenario, I need to install both netmasq and samba4 at the same time and on the same machine.

I investigate this issue for a while but I fail at last.

Does samba4 support listening dns request from a customized port rather than 53? How to make it?

Do I need to configure a dedicated loopback interface, such as lo2 to receive the query from the opposite dns software? Or I don't need to do so since "lo" interface can receive both 127.0.0.1 and 127.0.0.2 IP address? If the answer is needing, how to accomplish this in Gentoo?

----------

## Syl20

 *bluephoenix wrote:*   

> In my scenario, I need to install both netmasq and samba4 at the same time and on the same machine.

 

You mean dnsmasq, I presume ?

 *Quote:*   

> Does samba4 support listening dns request from a customized port rather than 53? How to make it?

 

If you want to install an AD server, forget that. Even if you make it working, the clients won't use another port than 53. You should consider replacing dnsmasq with Bind.

If not, why bother ? In this case, Samba doesn't need to be a DNS server.

 *Quote:*   

> Do I need to configure a dedicated loopback interface, such as lo2 to receive the query from the opposite dns software? Or I don't need to do so since "lo" interface can receive both 127.0.0.1 and 127.0.0.2 IP address? If the answer is needing, how to accomplish this in Gentoo?

 

As you're talking about local addresses only, I suppose you really don't need AD capabilities. Or I didn't understand what you want to do.

----------

## bluephoenix

Thanks Syl20!

Your explanation is quite clear!

My problem is really relative with dnsmasq, but not netmasq. Somehow I cannot use bind because I don't know how to let bind manage those domain names out of local zone(domain). My operator's public DNS is polluted since the political or some other reasons. And this impacts dozens of different website's domain name, including google. I cannot suffer this as a technical guy. The only lucky thing is I can get some clear resolved domainname-IP pair from somewhere in the Internet with a "hosts" file format. At the beginning I just download this hosts file and replace my local one. But later, I have more (4) computers now. Updating those hosts file every time is boring. Thus, I decided to use a local DNS to centralize the domain name updating. In my condition, I choose dnsmasq naturally for the "hosts" file format reason. This works good. But these days I want to setup AD by samba. If I have more than 1 server, there would be no problem. But it is a pity that I have only one server without VM support. 

So is there some new advice from you? I find from Internet someone has accomplished this by using a firewall on the same machine. Because the firewall can support port translation for UDP and TCP packages. Thus the 53/5353 problem could be solved. But I also don't want to install a firewall just for this purpose. This solution is too dirty to me.

----------

## Syl20

 *bluephoenix wrote:*   

> Somehow I cannot use bind because I don't know how to let bind manage those domain names out of local zone(domain).

 

So you'll have to learn that.  :Wink: 

I suppose you need to serve DNS requests from your local network only. The typical setup is one (in fact, two : one "forward" zone, and one "reverse" one) "local" zone (type master), and a "forwarders" option for all the rest. You can restrict bind to serve only your intranet by setting the  "listen-on" and "allow-query" options.

There are plenty of how-tos on the web.

Once done, you just have to include the Samba interface.

----------

