LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dnsmasq - so what is my dns server? (https://www.linuxquestions.org/questions/linux-networking-3/dnsmasq-so-what-is-my-dns-server-4175444701/)

eantoranz 01-08-2013 01:34 PM

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.

acid_kewpie 01-09-2013 02:15 AM

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

eantoranz 01-09-2013 07:29 AM

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


acid_kewpie 01-09-2013 07:33 AM

Yep. I've looked.... sooooo....?

As above, look at dnsmasq.conf.

eantoranz 01-09-2013 07:37 AM

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?

acid_kewpie 01-09-2013 07:51 AM

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

eantoranz 01-09-2013 07:56 AM

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).

acid_kewpie 01-09-2013 07:58 AM

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?

eantoranz 01-09-2013 08:04 AM

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.

acid_kewpie 01-09-2013 08:11 AM

so dnsmasq is NOT the dhcp server... so why does dnsmasq have anything to do with the question in the first place?

eantoranz 01-09-2013 08:15 AM

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?

eantoranz 01-09-2013 08:22 AM

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.

eantoranz 01-09-2013 08:29 AM

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


acid_kewpie 01-09-2013 08:35 AM

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!

eantoranz 01-09-2013 08:37 AM

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


All times are GMT -5. The time now is 02:19 PM.