When I send DNS request, I will get some response. At this time, I had some question if this answer come from cached information or not. Someone think like me.
When the DNS server can recurse (RA is set)
1. Even if the query is recursive or not, the DNS which recived refer to local cache to find out the A record.
2. If the DNS is not authoritative, it will be return cached.
Please Look at these Packets.
There are 2 answers. One is CNAME which has 300 TTL time, other is A which 30 TTL time. I try again. And then
Now, I can see CNAME which has 300 TTL time and A which 29 TTL time.
In my test environment, I have DNS and GSLB. It has the role each like below. I dig to Authoritative DNS.
Thus,
1. Authoritative DNS return the TTL time for CNAME. This is the configuration value.
- In the response packet, Authoritative flag is set.
2. Authoritative DNS recurse to GSLB and cache the answer and return to client. So this TTL time will be counted down.
- In the response packet, Recursion Available is set. (The DNS can recurse)
The best way to find out the answer come from cached is watching "TTL time will be counted down or not".
This is the other case, I will try dig to "8.8.8.8" which is google DNS server. Even if there are lots of DNS server behind 8.8.8.8.
In this result above, Recursion Available is set, so the DNS is expected to cache answer. However, this is not Authoritative. Therefore, the CNAME and A should be counted down.
So far, I send recursive query. However, I want to see the same result with iterative query. In this post, I explained how to generate iterative query. I will use "dig +norecurse". Please note below
1. "dig with norecurse" show the result by DNS properies.
- Some DNS show the next query information, even if it has cached record.
- Some DNS show the cached answer.
- Some DNS show "server failed" result
Because of this, I did not recommend to use "dig with norecurse". Anyway, I will show when it works. I used same DNS server target.
When dig with no-recurse works, It show CNAME with counted TTL time down and A with counted TTL time down. With result, this DNS server has cached record value.
I have already told that different type of result can be shown with "norecurse" option. I will send query "www.google.com" to different DNS servers.
At first, Cached A record information is returned from DNS server. At this time, I can expect this DNS server has the cache. Please look at the next case,
There is no Answer field. There are next DNS server information to query. This is the reason why I do not recommend this norecursion option. Sometime, I can see the server fail like below.
This is my result. It is OK to use "norecurse" option for checking the cached return. However, it can can show different result what I do not expect.
1. See the response packet field : RA is set
2. See the TTL time count down.
This is the prove to cached.
Reference
[ 1 ] superuser.com/questions/523917/dns-queries-returning-no-answer-section
[ 2 ] superuser.com/questions/681680/dns-making-iterative-requests/681710
[ 3 ] www.slashroot.in/difference-between-iterative-and-recursive-dns-query
[ 4 ] www.ateamsystems.com/tech-blog/using-dig-to-find-domain-dns-ttl/
'System Basic Engineering > OpenSource' 카테고리의 다른 글
Simple Packet analysis about "DIG trace"command. (0) | 2020.09.23 |
---|---|
What is difference recursion and iterative request in DNS packet? (1) | 2020.09.23 |
How to upgrade DNSSEC for bind9? (0) | 2019.09.16 |
How to configure DNS bind9 configuration in Ubuntu (0) | 2019.09.12 |
How to install self-signed certification on Windows 2012 R2 for RDP? (0) | 2018.12.14 |