Reply

Clear DNS cache

New Member
Posts: 2
4627     0

can you share the API command to clear the DNS cache on Grid Member.

Re: Clear DNS cache

Moderator
Moderator
Posts: 315
4627     0

First get the grid member's reference:

 

curl -k1 -u admin:infoblox -X GET 'https://192.168.1.2/wapi/v2.10/member:dns'

returns:

 

[
    {
        "_ref": "member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.orgk", 
        "host_name": "ddi01.example.org", 
        "ipv4addr": "192.168.1.6", 
        "ipv6addr": "2603:3007:1a01:1001::6"
    }, 
    {
        "_ref": "member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQ2:ddi01.example.org", 
        "host_name": "ddi02.example.org", 
        "ipv4addr": "192.168.2.6", 
        "ipv6addr": "2603:3007::1a01:1002::6"
    }, 
    {
        "_ref": "member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQ3:ddi01.example.org", 
        "host_name": "ddi03.example.org", 
        "ipv4addr": "192.168.3.6", 
        "ipv6addr": "2603:3007::1a01:1003::6"
    }
]

then run the "clear cache" function against the member's dns service.  For example with ddi01 from above:

 

curl -k1 -u admin:infoblox -X POST "https://192.168.1.2/wapi/v2.10/member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.org?_function=clear_dns_cache"

 

Or use a multi-body request like this, giving the appliance name and storing the refernce in the variable "member_ref":

 

curl -k1 -u admin:infoblox -X POST 'https://192.168.1.2/wapi/v2.10/request' -H "Content-Type: application/json" -d \
'[
  {
    "method":"GET",
    "object":"member:dns",
    "data": {"host_name": "ddi01.example.org"},
    "assign_state": {"member_ref": "_ref" },
    "enable_substitution": true,
    "discard": true
  },
  {
    "method":"POST",
    "object": "##STATE:member_ref:##",
    "enable_substitution": true,
    "args":{"_function":"clear_dns_cache"}
  }
]'

 

 

Re: Clear DNS cache

New Member
Posts: 2
4627     0

Hi Richard,

thanks for the reply.

what will be the output of  

curl -k1 -u admin:infoblox -X POST "https://192.168.1.2/wapi/v2.10/member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.org?_function=clear_dns_cache"

what will the above command return? so that we know that the cache is cleared. 

Re: Clear DNS cache

Moderator
Moderator
Posts: 315
4628     0

Using Curl with JSON, the respose is an empty set of curly brackets:

 

 

{}

 

 

Also note that it is possible to clear a specific FQDN (and optioanlly all records under it) from cache:

 

 

curl -k1 -u admin:infoblox -X POST "https://192.168.1.2/wapi/v2.10/member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.org?_function=clear_dns_cache&domain=google.com&clear_full_tree=true"

 

Or  clear the cache just for a specific view:  (%20 is an encoded space)

 

curl -k1 -u admin:infoblox -X POST "https://192.168.1.2/wapi/v2.10/member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.org?_function=clear_dns_cache&&view=Internal%20DNS

 

 

 

 

Re: Clear DNS cache

Moderator
Moderator
Posts: 315
4628     0

The response will be an empty pair of curly brackets:

 

{}

Note that it is also possible to clear the cache only for a specific DNS view on that appliance;

 

curl -k1 -u admin:infoblox -X POST "https://192.168.1.2/wapi/v2.10/member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.org?_function=clear_dns_cache&view=Internal%20DNS"

Or to just clear a specific FQDN (and optionally all the records in the same domain):

 

curl -k1 -u admin:infoblox -X POST "https://192.168.1.2/wapi/v2.10/member:dns/ZG5zdflgkjflfghfghfhgkjJvcGVydGllcyQw:ddi01.example.org?_function=clear_dns_cache&domain=google.com&clear_full_tree=true"

 

 

Re: Clear DNS cache

New Member
Posts: 1
4628     0

It's important to flush a DNS cache for a few reasons. The first is the cache may contain outdated information. ... Even if you clear your browser history, https://screamreality.com/gunblood-cheat-codes/ the DNS cache will still have the old information, and the server needs to be flushed to get the updated results. Another reason to clear the cache is privacy.

The TTL was defined in SOA record of specific zone in DNS server. If you need clear DNS cache from client side for every 15 minutes, it is OK. After these caches were cleared, if needed, the client will re-query these records from DNS server. TTL times are always represented in seconds It's possible that flushing DNS can have some improvement, but it won't be much. If anything, it'll clear out obsolete entries if it hasn't been done in a while and caching is interfering with something, but clearing the cache can actually lower overall speeds (slightly) by requiring new DNS lookups for every resource.

Re: Clear DNS cache

Authority
Posts: 33
4628     0

Question on stale cache: if the TTL expires, doesn't the recursive server ask one of the authoritative servers again? Is there a way to override that behavior?

Re: Clear DNS cache

Moderator
Moderator
Posts: 315
4628     0

When the TTL expires, the cached record is purged from cache.  If the record is requested again, by a client, the server will ask for it again.  It's a normal function of DNS.

 

What behavior did you want to override?

Showing results for 
Search instead for 
Did you mean: 

Recommended for You