Add second DNS server to networking?


 
Thread Tools Search this Thread
Special Forums IP Networking Add second DNS server to networking?
# 1  
Old 12-06-2015
Add second DNS server to networking?

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 -

Code:
[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 -

Code:
[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-

Code:
[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)

Code:
[root@tx5xn ~]# cat /etc/resolv.conf 
# Generated by NetworkManager
domain home
search home
nameserver 192.168.1.82
nameserver 192.168.1.254

DIG:

Code:
[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

Code:
[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:

Code:
[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.

Last edited by Scrutinizer; 12-06-2015 at 11:32 AM..
# 2  
Old 12-06-2015
The standard host resolution is determined by /etc/nsswitch.conf
Add dns to the hosts line!
Example
Code:
hosts: files dns

This User Gave Thanks to MadeInGermany For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to add new Solaris client IP into Solaris 10 DNS server?

Hi, We just built a new Solaris 10 zone. And would like to add it to our DNS server. Its also Solaris 10. Please let me know how can I get the IP resolved using this DNS server. I added entry into zone config file but not working. I did restarted the DNS services. And also added nameserver name... (5 Replies)
Discussion started by: snchaudhari2
5 Replies

2. Solaris

DNS client added to DNS server but not working

Hi, We have built a new server (RHEL VM)and added that IP/hostname into dns zone configs file on DNS server (Solaris 10). Reloaded the configuration using and added nameserver into resolv.conf on client. But when I am trying nslookup, its not getting resolved. The nameserver is not able to... (8 Replies)
Discussion started by: snchaudhari2
8 Replies

3. IP Networking

Can Solaris VPN to a Server without breaking it's other networking rules !?

Hi All, Actually a very basic question this one. I've got a Solaris 10 x86 server box on a network. There are a group of other servers I need to connect to from it, but via a VPN connection. If I install a vpn client on my solaris box, can I configure the VPN connection so it only routes certain... (1 Reply)
Discussion started by: mikecouk
1 Replies

4. Linux

How to add a client to DNS server

Hi all, What is the procedure to add a client to a DNS server. what are the settings and files need to be added/changed ? thanks in advance! (6 Replies)
Discussion started by: lramsb4u
6 Replies

5. UNIX for Advanced & Expert Users

DNS server choice: Windows DNS vs Linux BIND

I'd like to get some opnions on choosing DNS server: Windows DNS vs Linux BIND comparrsion: 1) managment, easy of use 2) Security 3) features 4) peformance 5) ?? I personally prefer Windows DNS server for management, it supports GUI and command line. But I am not sure about security... (2 Replies)
Discussion started by: honglus
2 Replies

6. Solaris

Solaris DNS Client For Microsoft DNS Server

hey guys, how to add soalris box as a microsoft DNS Client ? and how to register in the microsoft DNS ?? i managed to query from the DNS server after adding /etc/resolve.conf and editing /etc/nsswitch.conf but i need to register the soalris server (dns Client) into Microsoft DNS automatically.... (3 Replies)
Discussion started by: mduweik
3 Replies

7. UNIX for Dummies Questions & Answers

setup a DNS server for my redhat server

Using Redhat Linux Enterprise AS 4 can someone teach me how to setup a dns server for my webserver? i've registered a domainname at mydomain.com but when i type in the domain i register i cannot enter to my webserver. someone told me that it is related with the DNS setting on my server. i've... (2 Replies)
Discussion started by: kaixiang88
2 Replies

8. IP Networking

networking linux to windows server

I have a linux 7 machine and i want to able to connect it to my windows 98 server.What do i do.They can ping each other but how do i make them see each other e.g be able to copy and send files to each other and surf??? how do i set up netscape to connect to my servers web server??? (2 Replies)
Discussion started by: perleo
2 Replies

9. UNIX for Dummies Questions & Answers

Networking Linux 2 windows server

How do i network my linux 7 machine to a windows 98 server.I can ping them but how do i see them in explorer and how can i surf in netscape on my linux machine? (3 Replies)
Discussion started by: perleo
3 Replies

10. UNIX for Dummies Questions & Answers

Add DNS server in Solaris

I am new to UNIX and have been trying to add DNS servers so I can access the internet under Solaris 9. I am using a static IP and have the subnet and gateway configured but cannot figure out to add DNS servers. Does anyone know how to do this? Thank you very much for any help. (1 Reply)
Discussion started by: jmy113437
1 Replies
Login or Register to Ask a Question