LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-27-2023, 07:46 AM   #1
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Rep: Reputation: Disabled
Question Bind9 DNS "partially" working


Hi,

I have an strange issue with bind9 which I can't solve.

I have defined my own and local domain, domain.local.
In the forward resolution file I have the following entries:

Code:
domain.local. IN A 172.17.70.1
www IN CNAME domain.local.
nslookup resolves domain.local and www.domain.local as 172.17.70.1 (as expected).

However, http or ping commands only reply to www.domain.local, and not to domain.local.

¿What am I doing wrong?

Thanks!

Last edited by banderas20; 11-27-2023 at 12:11 PM. Reason: typo
 
Old 11-27-2023, 11:25 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
Originally Posted by banderas20 View Post
Hi,

I have an strange issue with bind9 which I can't solve.

I have defined my own and local domain, domain.local.
In the forward resolution file I have the following entries:

Code:
domain.local. IN A 172.17.70.1
www IN CNAME domain.local.
nslookup resolves domain.local and www.domain.local as 172.17.70.1 (as expected).

However, http or ping commands only reply to www.domain.com, and not to domain.local.

¿What am I doing wrong?

Thanks!
I guess you mean www.domain.local and not www.domain.com above

Anyway, nslookup uses a nameserver in order to resolve a domain/hostname

Other protocols like ping, http etc are looking in the hosts file (/etc/hosts) before asking a nameserver.
If they find an entry about that hostname they are using that in order to connect.

So check /etc/hosts and remove any entry about (www.)domain.local
Then you need to make sure that you nameserver is used as a resolver by your box. You should read your distro's documentation about /etc/resolv.conf, Network Manager or other means your distro is using to define a resolver.

Regards
 
Old 11-27-2023, 12:14 PM   #3
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
I guess you mean www.domain.local and not www.domain.com above

Anyway, nslookup uses a nameserver in order to resolve a domain/hostname

Other protocols like ping, http etc are looking in the hosts file (/etc/hosts) before asking a nameserver.
If they find an entry about that hostname they are using that in order to connect.

So check /etc/hosts and remove any entry about (www.)domain.local
Then you need to make sure that you nameserver is used as a resolver by your box. You should read your distro's documentation about /etc/resolv.conf, Network Manager or other means your distro is using to define a resolver.

Regards
Yes. I meant www.domain.local. It was a typo.

I didn't know about the different checks done by ping and nslookup. Thanks for the guidance. I'll take a closer look at my config and post the results.

BTW, I have 2 different NICs. Each one with a different DNS attached to it. Can this be the issue?

Thank you very much!
 
Old 11-27-2023, 12:47 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
I didn't know about the different checks done by ping and nslookup. Thanks for the guidance. I'll take a closer look at my config and post the results.

BTW, I have 2 different NICs. Each one with a different DNS attached to it. Can this be the issue?
No I don't think this has something to do with your issue, but you can try ping and dig with your hostname in order to see how it's resolved by the 2 utilities:
Code:
dig www.domain.local
ping www.domain.local
 
Old 11-27-2023, 05:13 PM   #5
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
No I don't think this has something to do with your issue, but you can try ping and dig with your hostname in order to see how it's resolved by the 2 utilities:
Code:
dig www.domain.local
ping www.domain.local
dig www.domain.local

;; ANSWER SECTION:
www.domain.local. 604800 IN CNAME domain.local.
domain.local. 604800 IN A 172.17.70.1


dig domain.local


;; ANSWER SECTION:
domain.local. 604800 IN A 172.17.70.1

ping www.domain.local -> sucess
ping domain.local -> fail!


Last edited by banderas20; 11-27-2023 at 05:15 PM.
 
Old 11-28-2023, 01:09 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
ping www.domain.local -> sucess
ping domain.local -> fail!
That says nothing about the name resolution. You should see the IP address that ping uses, e.g:
Code:
ping google.com
PING google.com (216.58.212.46) 56(84) bytes of data.

ping www.google.com
PING www.google.com (142.251.140.68) 56(84) bytes of data.
 
Old 11-28-2023, 05:32 AM   #7
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Right. Here it goes:

Code:
ping www.domain.local

PING domain.local (172.17.70.1) 56(84) bytes of data.
64 bytes from MASTER (172.17.70.1): icmp_seq=1 ttl=64 time=0.055 ms
64 bytes from MASTER (172.17.70.1): icmp_seq=2 ttl=64 time=0.111 ms
64 bytes from MASTER (172.17.70.1): icmp_seq=3 ttl=64 time=0.079 ms
64 bytes from MASTER (172.17.70.1): icmp_seq=4 ttl=64 time=0.079 ms

ping domain.local

ping: domain.local: Name or service not known
 
Old 11-28-2023, 10:59 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
ping www.domain.local

PING domain.local (172.17.70.1) 56(84) bytes of data.
64 bytes from MASTER (172.17.70.1): icmp_seq=1 ttl=64 time=0.055 ms
64 bytes from MASTER (172.17.70.1): icmp_seq=2 ttl=64 time=0.111 ms
64 bytes from MASTER (172.17.70.1): icmp_seq=3 ttl=64 time=0.079 ms
64 bytes from MASTER (172.17.70.1): icmp_seq=4 ttl=64 time=0.079 ms

ping domain.local

ping: domain.local: Name or service not known
You didn't say your distro, so we cannot know if you're using Network Manager or other network tool.

What's in /etc/hosts and /etc/resolv.conf (or whatever file your resolver is using!)
 
Old 11-29-2023, 10:25 AM   #9
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Mi box is Ubuntu 20.04.6 LTS.


Code:
cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	MASTER
172.17.70.1	MASTER

Code:
cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 172.17.70.1
search domain.local
Hope this helps.

Thanks!
 
Old 11-29-2023, 12:01 PM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,168
Blog Entries: 1

Rep: Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038Reputation: 2038
Quote:
Originally Posted by banderas20 View Post
Mi box is Ubuntu 20.04.6 LTS.


Code:
cat /etc/hosts
127.0.0.1	localhost
127.0.1.1	MASTER
172.17.70.1	MASTER

Code:
cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 172.17.70.1
search domain.local
Hope this helps.

Thanks!
AFAIK ubuntu uses avahi with a .local domain, so maybe that's the reason of this mess in dns name resolution!
I don't use ubuntu, but I've this post why using a .local domain is a bad idea.

Also re. your network config you should put your nameserver first and google second in /etc/resolv.conf, so your box uses the local dns resolver to resolve a fake domain (like .local or whatever) that your nameserver is authoritative for.
 
Old 12-01-2023, 05:35 AM   #11
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
AFAIK ubuntu uses avahi with a .local domain, so maybe that's the reason of this mess in dns name resolution!
I don't use ubuntu, but I've this post why using a .local domain is a bad idea.

Also re. your network config you should put your nameserver first and google second in /etc/resolv.conf, so your box uses the local dns resolver to resolve a fake domain (like .local or whatever) that your nameserver is authoritative for.
Indeed commenting out the 8.8.8.8 server solved some issues.
Now I'll try to change my domain to another different from .local.

Thanks for the links. I'll post the results.
 
Old 12-01-2023, 07:55 AM   #12
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,811

Rep: Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210
dig and nslookup do a direct dns lookup.

Generic host lookups are done according to the hosts: line in /etc/nsswitch.conf
"files" means /etc/hosts.
"myhostname" is explained in
Code:
man nss-myhostname
Testing just the generic host lookup
Code:
getent hosts domain.local
 
Old 12-03-2023, 04:59 PM   #13
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
AFAIK ubuntu uses avahi with a .local domain, so maybe that's the reason of this mess in dns name resolution!
I don't use ubuntu, but I've this post why using a .local domain is a bad idea.

Also re. your network config you should put your nameserver first and google second in /etc/resolv.conf, so your box uses the local dns resolver to resolve a fake domain (like .local or whatever) that your nameserver is authoritative for.
Hi!

I put my nameserver fix and that seemed to solve some issues. Also, after changing .local to .here domain, everything seemed to work as expected.

Quote:
Originally Posted by MadeInGermany
Generic host lookups are done according to the hosts: line in /etc/nsswitch.conf
"files" means /etc/hosts.
I don't have
Code:
nss-myhostname
command installed in by box.

I don't know the purpose of
Code:
getent hosts domain.local
either. ¿Can you shed some light?

Thanks a lot to both of you!
 
Old 12-04-2023, 02:31 AM   #14
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,811

Rep: Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210Reputation: 1210
I suggested
Code:
man nss-myhostname
and you'll see it is a binary plugin for the hostname resolution, corresponding to a "myhostname" in /etc/nsswitch.conf
The man page is just a description what it does.
Likewise, a description of /etc/nsswitch.conf is in
Code:
man nsswitch.conf
Code:
getent hosts myhostname
getent hosts myipaddress
shows what the hostname resolution yields.
Knowing how it works is the first step in finding a solution.

Last edited by MadeInGermany; 12-04-2023 at 02:35 AM.
 
Old 12-06-2023, 03:38 PM   #15
banderas20
Member
 
Registered: Aug 2018
Posts: 138

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MadeInGermany View Post
I suggested
Code:
man nss-myhostname
and you'll see it is a binary plugin for the hostname resolution, corresponding to a "myhostname" in /etc/nsswitch.conf
The man page is just a description what it does.
Likewise, a description of /etc/nsswitch.conf is in
Code:
man nsswitch.conf
Code:
getent hosts myhostname
getent hosts myipaddress
shows what the hostname resolution yields.
Knowing how it works is the first step in finding a solution.
Thanks!

Closing thread, as it's already solved!
 
  


Reply

Tags
bind9, dns



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
Reverse DNS on LAN using bind9 not working bennetfox Linux - Networking 5 02-02-2013 03:49 PM
DNS server (bind9) working but not pinging linx win Debian 1 03-31-2009 04:01 PM
Help With Java Problem Please"""""""""""" suemcholan Linux - Newbie 1 04-02-2008 06:02 PM
DNS (bind9) on Ubuntu not working right Avatar Linux - Networking 9 01-07-2008 04:01 PM
"dig mx" or "ping" not working because of bind9? alexxxis Debian 4 01-06-2007 11:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:30 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration