LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-09-2014, 09:56 PM   #1
akeka
Member
 
Registered: May 2012
Posts: 39

Rep: Reputation: Disabled
DNS short name problem. FQDN worked


Dear Guru's

I've setup local DNS on my lab

The problem is, I need the short name to be also working . Right now, I can use FQDN without problem

Here's my conf

named.conf
Code:
options {
        directory "/var/named";
        dump-file "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        forwarders { 8.8.8.8; 4.4.4.4; };
        notify no;
};

# This is where you put in the link to the zone you
# want to serve

zone "labs.com" in {
        type master;
        file "/var/lib/named/labs.com.zone";
        allow-update { none; };
};

include "/etc/rndc.key";
zone file labs.com.zone
Code:
$TTL 86400
@   IN  SOA     ns1.labs.com. root.labs.com. (
        2013042201  ;Serial
        3600        ;Refresh
        1800        ;Retry
        604800      ;Expire
        86400       ;Minimum TTL
)
; Specify our two nameservers
                IN      NS              ns1.labs.com.
; Resolve nameserver hostnames to IP, replace with your two droplet IP addresses.
ns1             IN      A               10.0.0.15

; Define hostname -> IP pairs which you wish to resolve

labs-host1            IN      A               10.0.0.12
labs-host2             IN      A               10.0.0.14
Thanks and regards,
 
Old 07-10-2014, 12:01 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Add in /etc/resolv.conf
Code:
domain labs.com
Regards

Last edited by bathory; 07-10-2014 at 12:10 AM.
 
Old 07-10-2014, 12:25 AM   #3
akeka
Member
 
Registered: May 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Hi,

Add in /etc/resolv.conf
Code:
domain labs.com
Regards
Hi, thank you for your reply

It still doesn't worked, thanks
 
Old 07-10-2014, 12:46 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by akeka View Post
Hi, thank you for your reply

It still doesn't worked, thanks
Can you give an example of what is not working?
 
Old 07-10-2014, 12:55 AM   #5
akeka
Member
 
Registered: May 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
Can you give an example of what is not working?
Here's the result if I use FQDN

Code:
[root@client1 named]# dig labs-host1.labs.com

; <<>> DiG 9.2.4 <<>> labs-host1.labs.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46470
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;labs-host1.labs.com.                IN      A

;; ANSWER SECTION:
labs-host1.labs.com. 86400   IN      A       10.0.0.12

;; AUTHORITY SECTION:
labs.com.              86400   IN      NS      ns1.labs.com.

;; ADDITIONAL SECTION:
ns1.labs.com.          86400   IN      A       10.0.0.15

;; Query time: 0 msec
;; SERVER: 10.0.0.15#53(10.0.0.15)
;; WHEN: Thu Jul 10 12:49:45 2014
;; MSG SIZE  rcvd: 90
Here's the result if I use short name

Code:
[root@client1 named]# dig labs-host1

; <<>> DiG 9.2.4 <<>> labs-host1
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 23722
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;labs-host1.                  IN      A

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

;; Query time: 0 msec
;; SERVER: 10.0.0.15#53(10.0.0.15)
;; WHEN: Thu Jul 10 12:52:57 2014
;; MSG SIZE  rcvd: 105
Here's my /etc/resolv.conf

Code:
#search labs.com
domain labs.com
nameserver 10.0.0.15
 
Old 07-10-2014, 01:41 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You could use other network tools (like nslookup, ping etc) to do your tests.
Anyways for dig you need to add the "+search" option, e.g:
Code:
dig labs-host1 +search
 
Old 07-10-2014, 08:23 AM   #7
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 55
Why do you have search commented out in /etc/resolv.conf? If you uncomment then, it should work as you want it to.
 
Old 07-10-2014, 09:25 PM   #8
akeka
Member
 
Registered: May 2012
Posts: 39

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
You could use other network tools (like nslookup, ping etc) to do your tests.
Anyways for dig you need to add the "+search" option, e.g:
Code:
dig labs-host1 +search
Hmmm, I don't know if I've to add +search at the dig

When I use ping, it worked even if I use short name

So I guess, the configuration are working since the first time

Still wondering though, can I just type dig <short name> ?

Thanks and regards
 
Old 07-11-2014, 12:17 AM   #9
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Hmmm, I don't know if I've to add +search at the dig
You need it if you want dig to use /etc/resolv.conf to resolve the "short name". From the dig manpage:
Quote:
+[no]search
Use [do not use] the search list defined by the searchlist or domain directive in resolv.conf (if any).
The search list is not used by default.

Last edited by bathory; 07-11-2014 at 12:23 AM.
 
  


Reply



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
DNS bind locally(LAN) cant resolve my fqdn rpmacaspac Linux - Newbie 8 09-04-2013 04:04 AM
No DNS answer whitout FQDN Thimanjer Linux - Server 1 11-27-2009 10:01 AM
best pratice for hostname? FQDN vs short? zerobane Linux - Networking 1 02-03-2009 01:45 PM
Moved Subnets: Now cannot resolve short name, but FQDN works fine? hevnsnt Linux - Networking 5 12-29-2006 01:34 PM
DNS - resolving names without needing the FQDN ehorton Linux - Newbie 5 01-16-2006 08:43 PM

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

All times are GMT -5. The time now is 04:57 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