Operating System - HP-UX
1834461 Members
2714 Online
110067 Solutions
New Discussion

DNS local caching is not working

 
SOLVED
Go to solution
Arun Vijay V C
Frequent Advisor

DNS local caching is not working

The local DNS caheing in my HP Unix 11.23 is not working. I had configured it, by the below procedure. My master DNS server is windows server.
#sam
- "Networking and Communications"
- "DNS (BIND)"
- "DNS Local Name Server"
- "Actions"
- "Configure Caching-Only Server"

and added 'nameserver 127.0.0.1' in /etc/resolv.conf as first line. Started named deomon.

Now the issue is, If i try a nslookup to a server it will fail as shown below.
orcldrk:/# nslookup orcldrq
Name Server: localhost
Address: 127.0.0.1

Trying DNS
looking up FILES
*** No address information is available for "orcldrq"
======

And when I remove localcost from resolv.conf the name getting resolved from the DNS server.

1. Why local DNS caching is not working even after sevaral days?
2. Eventhough the server is not able to get the name resolved from local DNS cache, why its not trying the next DNS server?

Could anyone help me on this?

thanks,
Arun Vijay
14 REPLIES 14
Steven E. Protter
Exalted Contributor

Re: DNS local caching is not working

Shalom Arun,

To provide additional help:

/etc/nsswitch.conf

It appears to be looking at DNS first. That can work, but the server is not answering your request. You are asking for short name of the server, not FDQN fully qualified domain name.

Windows DNS servers by default do not provide that information. They provide short name by netbios/wins

/etc/resolv.conf

Make sure these servers are available and answer requests. Try a FDQN lookup and see what you get.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

If I try with FQDN also same..

its not resolving from the localhost or DNS.


my nsswicth.conf is ,

================
passwd: files ldap
group: files ldap
hosts: dns files
networks: files ldap
protocols: files ldap
rpc: files ldap
publickey: ldap [NOTFOUND=return] files
netgroup: files ldap
automount: files ldap
aliases: files
services: files ldap
Matti_Kurkela
Honored Contributor
Solution

Re: DNS local caching is not working

Named never uses /etc/resolv.conf.

When configuring as a caching-only server, SAM assumes your named has access to all public DNS servers of the world. In your situation, maybe this is not true?

When named looks up DNS data, it first examines its local data (cache and any authoritative data it may have). If the answer is not available locally, named takes the top level domain of the requested name (e.g. .com) and finds the list of .com domain servers by asking the root nameservers of the world. Then it contacts one of the .com nameservers and finds the nameservers of the second level (e.g. example.com) in the same way. Named keeps working like this until it reaches the nameserver that actually has the data requested by its client.

If your named's access to the world's nameservers is blocked, this process fails at its first step, so named can never start to build up its cache. In this case, you must configure your named to forward all requests it cannot answer on its own to another DNS server (=your windows server). It will still act as a cache, so the total number of requests passed to the windows server will be smaller.

Add the options "forward only" and "forwarders" to the options section of your /etc/named.conf file:

options {
forward only;
forwarders { 11.22.33.44; };
[...any other options...]

Replace "11.22.33.44" with the actual IP address of your master DNS server.
Then restart named.

When setting up a new DNS server, always test it with commands like "nslookup orcldrq 127.0.0.1" *before* adding "nameserver 127.0.0.1" to /etc/resolv.conf.

-----------

Answering your second question would require seeing your /etc/nsswitch.conf, /etc/resolv.conf and /etc/named.conf.

A common cause for problems like this is thinking that the response "the name you requested does not exist" is an error: it is not. In DNS terminology, this is called a "negative response" and it is a valid and useful piece of data.
Only "I cannot find the answer", or "I am not allowed to tell" are errors.

The OS assumes all DNS servers listed in /etc/resolv.conf have equal data: if one says "the name you requested does not exist", there is no reason to get a second opinion from another DNS server.
The second and third nameserver listed in /etc/resolv.conf are used only if a query to the first nameserver times out.

MK
MK
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

THANKS A LOT Matti for your help.
Its worked out...I updated /etc/named.conf with 'forwarders' and now its resolving names from the local cache itself.
Really Appreciated !!!!!!
I am very glad to give a good point for your help :)..
Any way, can you answer the following also,

1. How often the local DNS cache data in the server will get updated from the master server? Is it like, whenver the system has to resolv a new name, it will get resolved from the master DNS server first time and second time onwards it defenitly get resolved from the local cache??

thanks,
Arun Vijay
Matti_Kurkela
Honored Contributor

Re: DNS local caching is not working

(This is beginning to feel like a general lecture on DNS fundamentals, but here goes...)

The authoritative DNS server for the domain gives a Time-To-Live (TTL) value for each answer it gives out. It works like an expiration date.

When a DNS server gives out an authoritative answer (i.e. the server is either a master or a slave for the requested domain), the TTL timestamp of the answer is always equal to (the current timestamp + TTL). As long as the TTL timestamp attached to the answer is still in the future, any server/cache that receives the answer can use it and even pass it on: there may be multiple tiers of caching DNS servers.

When the TTL timestamp of the answer expires, the answer must no longer be relied upon: whoever needs the information must make another request to the "upstream" DNS servers to get a fresh copy (which may or may not be changed otherwise, but it will have a new expiration date).

With public DNS servers, the TTL value of the DNS records is an important parameter: a long TTL means the zone data can be cached efficiently, so the traffic to the authoritative servers of that zone will be minimized. The downside is that any changes to the zone will take a longer time to propagate through the cache hierarchy.

MK
MK
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

Thanks Matti,
1. Untill the TTL of the answer expires, the answer in cache is valuable and the system will use that. DO you know what is the default value of "TTL" time??
If an IP address of a server is changed and got updated in DNS server. But the system will still get the old address if the TTL still remains with the address in the cache.
So untill the TTL expires the system wont get the new correct address.... :)

2. After enabling local DNS cache, I see all the names getting resolved from the local cache. As you said when the TTL of an answer expires it should take the new data from DNS amaster server again. How will conform after each TTL the system get new answer from master server? Now, I can whatver nslookup I tried its getting resolved from local cache itself every time...

thanks,
Arun Vijay
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

Hi Matti,
Any reply for my last questions...

Even not also I am glad with your previous answer and ready close this thread after giving u a good points..

Pls let me know shal i close this?

Or should I wait for your next reply?

Thanks,
Arun Vijay
Matti_Kurkela
Honored Contributor

Re: DNS local caching is not working

Sorry, I was travelling and could not answer in a timely fashion...

1.)
> what is the default value of "TTL" time??

This is set by the administrator of each DNS zone. Even each DNS record can have a customized TTL value if necessary, but usually the entire zone has similar TTL values.
Some DNS servers may have "factory default" TTL values, others do not. It is impossible to give a complete answer. But "common" TTL values for static DNS data might be in the range of 10 min - 2 hours.

If a DNS record is allocated dynamically (DDNS), then a long TTL value may be inappropriate.

> So until the TTL expires the system wont get the new correct address

I would say "is not guaranteed to get the new address". Maybe the last time the cache had to get fresh data just happens to be so far in the past that the old data expires soon enough anyway. But that is just luck. The worst case happens if the cache must refresh the old data at the last possible moment before the change.

If a DNS zone has long TTL values and an important IP address change is planned, the DNS admin must understand the effect of the TTL.

If the IP address change must happen fast, it may be necessary to prepare by shortening the TTL of the records effected by the planned change.

Example:
The IP address of a well-known web service is 10.11.12.13, and it has a TTL of 2 hours. At some point, the boss says it must be changed to 10.11.12.88, and the change must be completed within a window of 5 minutes. Let the planned time of the beginning of the IP change operation be called "time T".

If the change operation is well planned, the DNS admin will be notified of the upcoming change well before the time (T - 2 hours), say, at time (T - 1 day). That allows the DNS admin to change the TTL to a small value (like 30 seconds). This will increase the load of the DNS server, but because the DNS server is not an ancient 386 PC, it will handle it just fine.

If the TTL change happens at or before (T - 2 hours), the operation is possible to be executed as planned. At time T, the DNS admin can replace the old IP in the DNS record with the new one; at time (T + 30 s), the obsolete data is guaranteed to have been purged from all DNS caches. Even if the server admin reports at (T + 4 minutes) that there is a problem and the change must be rolled back, the DNS admin can still do it.

At some later date, the DNS admin can then restore the TTL value of these records to normal.


If the DNS admin is not told until (T - 1 hour) and the TTL is first changed at that point, then between time T and time (T + 1 hour) there may be caches somewhere on the Internet that still have the old data with the old TTL and consider it valid.

If we're talking about internal DNS, where the organization that owns the DNS zone also controls all the caching DNS servers that may access the problematic record, the organization boss may ask all DNS cache admins to flush their caches. This is a work-around to a problem that could be avoided entirely by proper preparations.

(This might mean that the change manager owes a beer [or other preferred beverage] to the DNS/cache admins that had to do rushed/extra work.)

If the change affects public services, this workaround is not available: the DNS caches are all over the Internet and nobody can manage them all.

2.)
If the answer comes from a cache, nslookup will prefix the answer with a text "Non-authoritative answer:".

If this text is not present, the answer was retrieved from an authoritative DNS server of that particular zone and therefore is correct by definition.

MK
MK
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

Matti,
I am in a change to configure local DNS cache in one another server.
I enabled through sam and updated /etc/named.conf. But now the problem is once I start the named process, it will be stoped in a few sec.

Please reply to this urgently..pls..
thanks,
Arun vijay
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

Hi Matti, Can you reply for above question..its urgent pls...

thanks,
arun...
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

When I do a nslookup I am getting like this,
root@racradia(sbin)> nslookup raclun01
*** Can't find server name for address 127.0.0.1: No response from server
Using /etc/hosts on: racradia

looking up FILES
Trying DNS
Non-authoritative answer:
Name: raclun01.racapj.adapps.hp.com
Address: 139.35.232.73

thanks,
Arun
Patrick Wallek
Honored Contributor

Re: DNS local caching is not working

You need to check the /var/adm/syslog/syslog.log file on the HP-UX server. If there is a problem with the DNS configuration, there should be messages logged there.

Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

Hello All,

I have fixed the issue..
The problem was with the db.cache file which got from the master DNS server. syslog shows some error when I start named which points to db.cache. Sevaral time I tried to update/recreate named.conf and named.data from the master DNS server, but it was not working. Same error in syslog.
finally I have downloaded the latest db.cache from the root server and replaced in the server.
command used to get the db.cache from root server is ,
#dig a.root-servers.net . ns > db.cache
Thanks Matti....your answers helped me a lot in DNS servers......
I am very glad to give you a good point..for others also..
Thanks for Every One...
Arun Vijay V C
Frequent Advisor

Re: DNS local caching is not working

Thanks for every One...........