Reply

Clear DNS cache

Member
Posts: 2
161     0

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

Re: Clear DNS cache

Community Manager
Community Manager
Posts: 209
162     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

Member
Posts: 2
162     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

Community Manager
Community Manager
Posts: 209
162     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"

 

 

Showing results for 
Search instead for 
Did you mean: 

Recommended for You