LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-13-2009, 09:54 PM   #1
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Rep: Reputation: 15
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?
 
Old 12-13-2009, 10:06 PM   #2
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
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.
 
Old 12-15-2009, 02:21 PM   #3
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
Nobody can help?
 
Old 12-15-2009, 02:25 PM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by hazza96 View Post
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.
 
Old 12-15-2009, 02:48 PM   #5
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
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
 
Old 12-15-2009, 02:54 PM   #6
hazza96
Member
 
Registered: Apr 2001
Location: Brisbane, Australia
Distribution: Ubuntu
Posts: 146

Original Poster
Rep: Reputation: 15
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.
 
  


Reply

Tags
dnsmasq



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp.tma.com name not resolving on second dns server.? cwc Fedora 0 03-22-2008 09:54 AM
resolving LAN hosts as DNS Harry2o Linux - Networking 7 09-01-2006 10:31 PM
Caching DNS server error (lame server resolving) Iggyboo Linux - Networking 1 02-24-2005 03:43 AM
Resolving DNS Queries, HTTP Server Configuration ASP Mandriva 2 12-23-2003 08:14 AM
/etc/hosts resolving before DNS resolving ? markraem Linux - Networking 4 11-02-2003 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration