LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 01-08-2013, 01:34 PM   #1
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Rep: Reputation: 83
dnsmasq - so what is my dns server?


So, kubuntu 12.04 is using dnsmasq and I need to know what its DNSs are (configured through dhcp). Is there an easy way to know what they are without using a sniffer to see where DNS requests are being sent?

Thanks in advance.
 
Old 01-09-2013, 02:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
what do you mean by configured? as a dhcp client, nameservers are placed in /etc/resolv.conf, as a server, dnsmasq will relay to the servers in it's own resolv.conf file unless others are explicitly stated in dnsmasq.conf
 
Old 01-09-2013, 07:29 AM   #3
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Look at this:

Code:
$ cat /etc/resolv.conf 
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search MBO.CPS.LOCAL
$ sudo netstat -lunp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
udp        0      0 127.0.0.1:11211         0.0.0.0:*                           1541/memcached  
udp        0      0 0.0.0.0:538             0.0.0.0:*                           1533/gdomap     
udp        0      0 127.0.0.1:53            0.0.0.0:*                           10363/dnsmasq   
udp        0      0 0.0.0.0:68              0.0.0.0:*                           10359/dhclient  
udp        0      0 0.0.0.0:68              0.0.0.0:*                           1569/dhclient
 
Old 01-09-2013, 07:33 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Yep. I've looked.... sooooo....?

As above, look at dnsmasq.conf.
 
Old 01-09-2013, 07:37 AM   #5
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Dude, thanks for your help but dnsmasq.conf doesn't look promising:

Code:
$ locate dnsmasq.conf
/home/antoranz/Documentos/arm/dreamplug/dreamplug_debian/etc/dnsmasq.conf
/home/antoranz/Documentos/arm/dreamplug/dreamplug_debian/etc/dbus-1/system.d/dnsmasq.conf
/home/antoranz/Documentos/arm/dreamplug/dreamplug_debian/usr/share/doc/dnsmasq-base/examples/dnsmasq.conf.example
/home/antoranz/Documentos/arm/dreamplug/dreamplug_debian/var/lib/dpkg/info/dnsmasq.conffiles
/usr/share/doc/dnsmasq-base/examples/dnsmasq.conf.example
What do you think?
 
Old 01-09-2013, 07:51 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
i'm really unclear where dnsmasq is fitting into this and what you want to find out. in what way is kubuntu "using" dnsmasq? If you're starting and stopping dnsmasq then you can start it in debug mode and see what it finds to use.

As an alternative approach, just do a request and see if anything shows in netstat -panu
 
Old 01-09-2013, 07:56 AM   #7
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Oh, that was the key question. I _can_ find out by using a sniffer (and I do). What I want to be able to do is find out what dns servers dnsmasq is using so that I can skip this step which requires admin privileges (which I do have on this host but anyway). It should be written somewhere, right? One file in /var, perhaps?

I'm running a find /var -exec grep to try to find out if there's a file which is holding the dns servers somewhere but it's still looking (some rather big postgres dbs on my host).
 
Old 01-09-2013, 07:58 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
dnsmasq will pick up the local servers in resolv.conf if there are any. otherwise they'll be in dnsmasq.conf, but I'd also imagine that it's going to revert to root name servers if none are actually defined?
 
Old 01-09-2013, 08:04 AM   #9
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
But this host gets its dnsservers from dhcp not from static files.... and it's working, otherwise I'd be stuck with no name resolution so somewhere dnsmasq is getting fed with the dns servers coming from dhclient, somehow... which, by the way, I don't care about (the mechanics, that is) at the moment. I would just like to do a cat on a file (if there's any) where I could see what dns servers dnsmasq is using at the moment given that it's kept from /etc/resolv.conf.

By the way, in var, there are some lease files from dhclient holding the dnsservers plus some mentions in syslog.

---------- Post added 01-09-13 at 11:05 AM ----------

And that's about it.
 
Old 01-09-2013, 08:11 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
so dnsmasq is NOT the dhcp server... so why does dnsmasq have anything to do with the question in the first place?
 
Old 01-09-2013, 08:15 AM   #11
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
What? Didn't you see my resolv.conf? It _is_ my dns server (ant it's working as a caching proxy [which, by the way, is how the box is set up after I installed kubuntu 12.4 on it and it's been like that ever since]).

Code:
$ dig www.yahoo.com

; <<>> DiG 9.8.1-P1 <<>> www.yahoo.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21969
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.yahoo.com.                 IN      A

;; ANSWER SECTION:
www.yahoo.com.          0       IN      CNAME   fd-fp3.wg1.b.yahoo.com.
fd-fp3.wg1.b.yahoo.com. 0       IN      CNAME   ds-fp3.wg1.b.yahoo.com.
ds-fp3.wg1.b.yahoo.com. 0       IN      CNAME   ds-any-fp3-lfb.wa1.b.yahoo.com.
ds-any-fp3-lfb.wa1.b.yahoo.com. 0 IN    CNAME   ds-any-fp3-real.wa1.b.yahoo.com.
ds-any-fp3-real.wa1.b.yahoo.com. 9 IN   A       98.139.183.24

;; Query time: 132 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jan  9 09:44:10 2013
;; MSG SIZE  rcvd: 158
See the server serving the query?

Last edited by eantoranz; 01-09-2013 at 08:16 AM. Reason: typo
 
Old 01-09-2013, 08:22 AM   #12
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
I see where you are going. You think I'm using dnsmasq as dhcp/dns server for hosts being served on a network through dhcp. Oh, no... it's set up (as I said, by the kubuntu installation) to do caching of dns requests on my own host (as far as I can tell... I didn't set it up) and it's working cause it's using the dns servers that were received from my host's dhcp client when I connected to the network.
 
Old 01-09-2013, 08:29 AM   #13
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Well, it's hackish but I finally found a file where the dns servers are held.

dnsmasq is started by the dhcp client (using NetworkManager) like this:

Code:
/usr/sbin/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=/var/run/sendsigs.omit.d/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf-file=/var/run/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec
So the dhcp client has created a file where the dns servers are fed into dnsmasq:

Code:
$ cat /var/run/nm-dns-dnsmasq.conf
server=10.240.133.27
server=10.240.133.20
server=10.240.133.27
server=10.240.133.20
 
Old 01-09-2013, 08:35 AM   #14
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,378

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
Right, so NetworkManager manages dnsmasq in a config-less scenario, so it should be passing DNS IP's as commandline optiosn to dnsmasq..?

---------- Post added 09-01-13 at 02:35 PM ----------

damnit, too late!
 
Old 01-09-2013, 08:37 AM   #15
eantoranz
Senior Member
 
Registered: Apr 2003
Location: Colombia
Distribution: Kubuntu, Debian, Knoppix
Posts: 1,982
Blog Entries: 1

Original Poster
Rep: Reputation: 83
Sure, look at the parameters in the dnsmasq call.

Code:
--conf-file=/var/run/nm-dns-dnsmasq.conf


---------- Post added 01-09-13 at 11:38 AM ----------

LOL
 
  


Reply

Tags
dns, dnsmasq


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Managed DNS server lists and dnsmasq DNS cache nitrousoxide82 Linux - Networking 1 02-21-2014 10:34 PM
simple DNS server (dnsmasq) with Windows hosts? Umanga Linux - Server 3 07-29-2011 08:17 AM
dnsmasq dhcp+dns resolv unless for server eztaitt Linux - Server 2 05-18-2010 09:25 AM
How to set dns timeout on dnsmasq zelda32 Linux - Server 10 09-21-2009 02:03 AM
DNS cache without dnsmasq linuxbird Linux - Networking 8 10-29-2008 08:50 PM


All times are GMT -5. The time now is 09:18 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration