LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dig localhost doesn't give the answer section (https://www.linuxquestions.org/questions/linux-networking-3/dig-localhost-doesnt-give-the-answer-section-4175503179/)

minlinux 04-27-2014 09:10 PM

dig localhost doesn't give the answer section
 
I'am trying to setup a DNS server on centos. My problem is that when I try to do dig google.com it works... but when i hit dig localhost it doesn't give the answer section also nslookup doesn't give the output.

[root@3i etc]# dig localhost

; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.23.rc1.el6_5.1 <<>> localhost ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 3763 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION: ;localhost. IN A

;; AUTHORITY SECTION: . 10510 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2014042701 1800 900 604800 86400

;; Query time: 18 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Sun Feb 9 13:39:47 2014 ;; MSG SIZE rcvd: 102

[root@3i etc]#

[root@3i etc]# nslookup localhost Server: 127.0.0.1 Address: 127.0.0.1#53

** server can't find localhost: NXDOMAIN

[root@3i etc]#

Any help would be appreciated...!!!

psycroptic 04-27-2014 10:02 PM

please post the contents of /etc/named.conf and all of your zone files

kirukan 04-27-2014 10:16 PM

dig a specific name which you have configured in your local DNS server

Doug G 04-28-2014 12:52 AM

fwiw, on my centos 6.5 server that's successfully running bind, dig localhost doesn't return an answer either. I think localhost is normally defined in your /etc/hosts file not in the dns server.

psycroptic 04-28-2014 01:17 AM

Quote:

Originally Posted by Doug G (Post 5160355)
fwiw, on my centos 6.5 server that's successfully running bind, dig localhost doesn't return an answer either. I think localhost is normally defined in your /etc/hosts file not in the dns server.

not necessarily, can be either in /etc/hosts or in a zone file, with forward zone A record of hostname "localhost" mapped to 127.0.0.1

rgistered 05-01-2014 01:17 PM

I had the same problem when I first tried to set it up on a CentOS box. Comes out that the culprit was SELinux. Turn off the SELinux temporarily and then try to 'dig' localhost to see if that works.

minlinux 05-18-2014 10:02 AM

Hello folks,


Sorry for the late reply..... :( :( was out of town for some days...
I checked and found out that i forgot to configure iptables. port 53 is not allowed by iptables by default, we have to change the configuration of iptables for it.
did the necessary changes and bam...!!! everything was working smoothly.... :) :)

Thanks for the replies... :) :)


All times are GMT -5. The time now is 03:49 PM.