LinuxQuestions.org
Review your favorite Linux distribution.
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 09-29-2017, 07:20 AM   #1
luofeiyu
Member
 
Registered: Aug 2015
Posts: 237

Rep: Reputation: Disabled
To get domain name from ip in Reverse DNS Dig


Code:
dig www.ksu.edu.tw +short
120.114.100.101
We get ip address :120.114.100.101 ,whose domain name is www.ksu.edu.tw .
To get domain name from ip in Reverse DNS Dig
Code:
dig -x 120.114.100.101 +short
www.ksu.edu.tw.
We get domain name : www.ksu.edu.tw ,whose ip address is 120.114.100.101.
Code:
dig  smtp.mail.yahoo.com  +short
smtp.mail.global.gm0.yahoodns.net.
106.10.150.171
We get ip address :106.10.150.171 ,whose domain name is smtp.mail.yahoo.com.
Code:
dig  -x 106.10.150.171  +short
vcs-s-myc.mail.vip.sg3.yahoo.com.
why the result is not smtp.mail.yahoo.com as 106.10.150.171's domain name?
 
Old 09-29-2017, 10:49 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Mainly because the zone file for reverse IP look ups (ARPA reverse zone) is maintained separately than the zone file for forward lookups.

That is to say when you add a forward lookup (A record, AAAA record or CNAME for this discussion) you are specifying NAMES and telling them which IPs to go to when the name is looked up. On the other hand when you create the separate zone for reverse lookups (PTR records) it is looking up the IP specified and seeing the name in that zone file not in the original forward lookup zone file.

So I could create a forward zone file for example.com with record:
billybob IN A 10.90.70.50

But in my reverse zone file (ARPA) for 10.90.70 I could put a completely different name to resolve to:
50 IN PTR ralph.example.com.

When you did the dig for billybob.example.com it would tell you the IP is 10.90.70.50. But when you did the dig -x for 10.90.70.50 it would tell you the name is ralph.example.com.

I often see people mistakenly putting PTR records in their forward zone files even though nothing would ever look at that file for a reverse (PTR) lookup. Best practice for PTR records is to have only one for each IP even if you have multiple forward records resolving to that IP.

On top of all that is that for your specific example you did a "dig +short" so it only gave you the IP the forward ultimately resolves to. If you had done it without the "+short" it would have shown you that smtp.mail.yahoo.com is actually an alias (CNAME) of smtp.mail.global.gm0.yahoodns.net. So in this case the PTR did in fact give the "real" name associated with the IP - just not the "alias" name that goes to the same IP. But as I said above there is no requirement that it do so.

Some people will reject email from an outbound mail server that does not have a PTR record back to the same name so in cases like that you do want to have the names be the same.
 
Old 10-02-2017, 08:09 PM   #3
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,939

Rep: Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619Reputation: 3619
OK, other post flagged.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 not workign for a particular domain(eg .bt) SarahGurung Linux - Server 2 01-28-2014 07:50 PM
DIg not respond from my domain DeSouffle Linux - Networking 3 01-30-2013 01:51 AM
How to set up reverse DNS to domain SentralOrigin Linux - Networking 3 09-12-2010 02:09 PM
BIND9: dig <hostname> doesn't work, dig <hostname.domain.tld> does. jhwilliams Linux - Server 2 04-09-2010 01:01 PM
dns question (dig maybe) lenlutz Linux - Networking 2 10-03-2003 07:26 AM

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

All times are GMT -5. The time now is 07:12 PM.

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