Hi
Am fooling around at home with installing dnsmasq on a raspberry pi and trying to use it for DNS resolution.
On the PI, I can add a machine on my network to my /etc/hosts and resolve it. But I can't seem to get any machines to resolve the same name using the PI as a DNS server.
My resolv.conf on the PI -
[root@pidora1 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
domain home
search home
nameserver 127.0.0.1
server 192.168.1.254
server 8.8.8.8
server 8.8.4.4
My /etc/host on the PI -
[root@pidora1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain pidora.local
192.168.1.77 wibble
So I added a laptop of mine using a unique name - wibble and seem to be able to resolv it locally from the PI-
[root@pidora1 ~]# dig wibble
; <<>> DiG 9.9.4-P2-RedHat-9.9.4-12.P2.fc20 <<>> wibble
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 52250
;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;wibble. IN A
;; ANSWER SECTION:
wibble. 0 IN A 192.168.1.77
;; Query time: 8 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Dec 06 13:57:37 GMT 2015
;; MSG SIZE rcvd: 40
And I also seem to be able to resolv it from the laptop after adding a second DNS server to my resolv.conf. (The dnsmasq server is 192.168.1.82)
[root@tx5xn ~]# cat /etc/resolv.conf
# Generated by NetworkManager
domain home
search home
nameserver 192.168.1.82
nameserver 192.168.1.254
DIG:
[root@tx5xn ~]# dig wibble
; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> wibble
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16531
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;wibble. IN A
;; ANSWER SECTION:
wibble. 0 IN A 192.168.1.77
;; Query time: 5 msec
;; SERVER: 192.168.1.82#53(192.168.1.82)
;; WHEN: Sun Dec 6 14:09:03 2015
;; MSG SIZE rcvd: 40
and
[root@tx5xn ~]# nslookup wibble
Server: 192.168.1.82
Address: 192.168.1.82#53
Name: wibble
Address: 192.168.1.77
but if I try and use the name:
[root@tx5xn ~]# ping wibble
ping: unknown host wibble
So Question 1
Why I can't I ping it when I seem to be able to resolve it? I can ping it form the PI, but not the laptop set to use the PI for DNS resolution.
Question 2
The laptop is a Centos 6 machine, should I be editing /etc/resolv.conf directly? Won't it be overwritten if I reboot?
If so, how should I permanently add the PI as a secondary DNS server?
Thanks for any help in advance
Brad
---------- Post updated at 05:49 PM ---------- Previous update was at 02:17 PM ----------
Well it seems I had to add these lines:
expand-hosts
domain=home
to my /etc/dnsmasq.conf file and then clear my dns cache on the clients I was using.
Discovered that although I couldn't ping the wibble host, I could if I appended a dot to the name. This led me to discover some posts saying the same thing and talking about domain resolution.