LinuxQuestions.org
Visit Jeremy's Blog.
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 06-08-2011, 05:42 AM   #1
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 22

Rep: Reputation: 0
Host Command only works for FQDN


Hi,

I've set up a dns server (bind 9) on Oracle Linux 5 Update 5. After setting it up, when I run the host command on this dns server, it replys with an ip address only if I use a FQDN. If I just run ...

#host server1
#

... it returns a blank answer. If I run ...

#host server1.domain1.com
#server1.domain1.com has address 10.5.20.54

We have 2 domains in our environment and I'm trying to get forward and reverse lookups to work across both domains using this dns server.

The pertinent parts of named.conf is as follows:

listen-on port 53 { 127.0.0.1; 10.5.20.0/24; };
acl "server-subnet" { 10.5.20.0/24; };
view "internal"
match-clients { localnets; localhost; server-subnet; };
match-destinations { localnets; localhost; server-subnet; };
include "/etc/named.root.hints";
include "/etc/named.rfc1912.zones";
include "/etc/internal_zones.conf";

The internal_zones.conf is as follows:

zone "domain1.com" IN {
type master;
notify no;
allow-query { 127.0.0.1; 10.5.20.0/24; };
allow-update { none; };
file "/var/named/domain1.zone";
};

zone "domain2.com" IN {
type master;
notify no;
allow-query { 127.0.0.1; 10.5.20.0/24; };
allow-update { none; };
file "/var/named/domain2.zone";
};

zone "20.5.10.domain1.in-addr.arpa" IN {
type master;
notify no;
allow-query { 127.0.0.1; 10.5.20.0/24; };
allow-update { none; };
file "/var/named/10-5-20.zone";
};


And here are the zone files.

domain1.zone:

$TTL 3D
@ IN SOA domain1.com. root.localhost. (
2011060801 ; serial number
1H ; refresh
1H ; retry
3D ; expiry
1D ) ; minimum
IN NS localhost
server1 A 10.5.20.54
server2 A 10.5.20.25

domain2.zone:

$TTL 3D
@ IN SOA domain2.com. root.localhost (
2011060801 ; serial number
1H ; refresh
1H ; retry
3D ; expiry
1D ) ; minimum
IN NS localhost
server3 A 10.5.20.215

10-5-20.zone:

$TTL 3D
@ IN SOA domain1.com. root.localhost. (
2011060801 ; serial number
1H ; refresh
1H ; retry
3D ; expiry
1D ) ; minimum
IN NS localhost
54 PTR server1.domain1.com.
25 PTR server2.domain1.com.
215 PTR server3.domain2.com.

So forward lookups only work for FQDN. Reverse lookups works fine for both domains. Just not sure why forward lookups don't work for short names. This dns server's resolv.conf file has only nameserver 127.0.0.1 in it. service named restart has been run each time I make any changes.

First time setting up dns server in linux so any tips would be greatly appreciated. Thanks.
 
Old 06-08-2011, 05:47 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
the dns server should always have an FQDN requested of it. Add a "domain" or "search" entry to the clients resolv.conf
 
Old 06-08-2011, 08:21 PM   #3
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 22

Original Poster
Rep: Reputation: 0
Thanks for that tip. I added ...

search domain1.com domain2.com

... to resolv.conf and short name lookups now work. Could I trouble you to explain how it works under the hood?

As in what's the difference between the 2 entries in my resolv.conf file:

search domain1.com domain2.com
nameserver 127.0.0.1

Thanks again.
 
Old 06-08-2011, 10:27 PM   #4
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 22

Original Poster
Rep: Reputation: 0
OK, dns queries from within the dns server works fine for both domains (forward and reverse). But now I can't query from the clients.

For example, from server3 (10.5.20.215) its resolv.conf has been updated to:

search domain1.com domain2.com
nameserver 10.5.1.78 #this is the dns server I just set up

When I run ...

# host server1
;; connection timed out; no servers could be reached

# telnet 10.5.1.78 53
Trying 10.5.1.78...
telnet: connect to address 10.5.1.78: Connection refused
telnet: Unable to connect to remote host: Connection refused

Iptables is stopped on the dns server and on the clients as well. I can ping the dns server from the client using ip address.

allow-query is configured for { 127.0.0.1; 10.5.20.0/24; };

Where else should I be looking to get the clients to resolve lookups using the dns server I've set up?

Thanks.
 
Old 06-08-2011, 10:46 PM   #5
terencewklau
LQ Newbie
 
Registered: May 2011
Posts: 22

Original Poster
Rep: Reputation: 0
OK, ignore last query. I had to include my dns servers interface address in the listen-on option to get clients to talk to it.

Learning linux by the minute! Thanks again.
 
  


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
rsyslog sometimes logs fqdn, sometimes just host name whysyn Linux - Software 3 06-03-2008 11:31 AM
can't ping any host with .local at the end of FQDN shaab Linux - Networking 7 11-29-2007 11:03 AM
error unknown host given when trying to ping FQDN cnts-student Linux - Newbie 2 03-18-2007 02:17 PM
Moved Subnets: Now cannot resolve short name, but FQDN works fine? hevnsnt Linux - Networking 5 12-29-2006 02:34 PM
Resolving Local Non-FQDN Host Names fortezza Linux - Networking 2 02-14-2004 05:17 AM

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

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