LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   DNS server issue resolving localdomain hosts (https://www.linuxquestions.org/questions/linux-server-73/dns-server-issue-resolving-localdomain-hosts-775454/)

hazza96 12-13-2009 09:54 PM

DNS server issue resolving localdomain hosts
 
I have dnsmasq setup for my network, the server it runs on is configured like this:

/etc/resolv.conf
Code:

domain localdomain
search localdomain
nameserver=127.0.0.1

/etc/hosts
Code:

127.0.0.1      localhost
127.0.1.1      server
192.168.1.1    server
192.168.1.51    host1
192.168.1.52    host2
192.168.1.53    host3
.....
192.168.2.1    modem

/etc/dnsmasq.conf (eth1 is my external interface)
Code:

domain-needed
bogus-priv
filterwin2k
except-interface=eth1
resolv-file=/etc/resolv.openDNS
log-queries
log-facility=/var/log/dnsmasq

/etc/resolv.openDNS
Code:

search localdomain
nameserver 208.67.222.222
nameserver 208.67.220.220

The server uses itself to look up addresses, dnsmasq is configured to use a different resolv file than the default.

So whether the query comes from the network or the server dnsmasq will be doing all the work and using OpenDNS to resolve it, then it will cache the result.

The problem is when the server tries to resolve hosts on the local domain. In my log file I see this:

Quote:

Dec 14 13:01:01 dnsmasq[13229]: query[AAAA] server.localdomain from 127.0.0.1
Dec 14 13:01:01 dnsmasq[13229]: forwarded server.localdomain to 208.67.222.222
From the documentation I have read about dnsmasq it should look up the cache first, then the /etc/hosts file next, then the DHCP leases file and lastly it should query the external dns server.

My question is, how do I stop dnsmasq forwarding the query's for the localdomain to the external server and resolve them itself?

hazza96 12-13-2009 10:06 PM

I found part of the solution:

/etc/dnsmasq.conf
Quote:

local=localdomain
That stops the forwarding of the query to the external dns servers but the dnsmasq server still does not resolve the internal hosts like it should.

hazza96 12-15-2009 02:21 PM

Nobody can help?

catkin 12-15-2009 02:25 PM

Quote:

Originally Posted by hazza96 (Post 3792664)
Nobody can help?

Strangely I did not see your thread in the "Quick links"->"View new posts" list and have just posted an almost identical question in this LQ thread.

hazza96 12-15-2009 02:48 PM

Alright thanks, I can't help that guy but I fixed my problem:

/etc/dnsmasq.conf
Quote:

expand-hosts
domain=localdomain
Now the hosts on the network can ping the local hosts and dnsmasq resolves them fine. The log entry looks like this:

Quote:

Dec 16 06:46:32 dnsmasq[12167]: query[A] host1.localdomain from 192.168.1.97
Dec 16 06:46:32 dnsmasq[12167]: /etc/hosts host1.localdomain is 192.168.1.51

hazza96 12-15-2009 02:54 PM

Here is my entire dnsmasq.conf that solved the problem, just in case someone wants it in the future:

/etc/dnsmasq.conf
Quote:

domain-needed
bogus-priv
filterwin2k
except-interface=eth1
resolv-file=/etc/resolv.openDNS
expand-hosts
local=localdomain
domain=localdomain
log-queries
log-facility=/var/log/dnsmasq
The last 2 lines are optional and only required if you want to log what dnsmasq is doing.


All times are GMT -5. The time now is 06:31 AM.