Infoblox::Grid::RootNameServer - Custom root name server object.
The custom root name server provides host name and IP address information of internal root name server. When the Infoblox appliance receives a recursive query for DNS data that it does not have, it will use the internal root name server specified, instead of using the internet root name server.
my $rootns = Infoblox::Grid::RootNameServer->new( host_name => $fqdn, #Required ipv4addr => $ipv4addr #Required if $ipv6addr is not present ipv6addr => $ipv6addr #Required if $ipv4addr is not present );
The following functions are available to be applied to a custom root name server object.
Use this function to specify custom root name servers at the grid level on Infoblox appliance. See Infoblox::Grid::DNS->rootNS() for parameters and return values.
#Construct a custom root name server object my $rootns1 = Infoblox::Grid::RootNameServer->new( host_name => "qe.infoblox.com", ipv4addr => "1.1.1.1" );
#Construct a custom root name server object my $rootns2 = Infoblox::Grid::RootNameServer->new( host_name => "doc.infoblox.com", ipv6addr => "2006::132" );
# Configure custom root name server on the grid DNS object my $response = $Grid_DNS->rootNS([$rootns1, $rootns2]);
This section describes all the methods that can be used to configure and retrieve the attribute values of a custom root name server.
Use this method to set or retrieve the host name of the custom root name server.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
Specify the host name in FQDN (Fully Qualified Domain Name) format. The FQDN consists of the host name followed by the domain name (example: abc.com). A host name can have a maximum of 256 characters.
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get host name my $host_name = $rootns->host_name(); #Modify host name $rootns->host_name("qa.infoblox.com");
Use this method to set or retrieve the IPv4 address of the custom root name server. Required only when ipv6 is not specified.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
An IPv4 address is a 32-bit number in dotted decimal notation. It consists of four 8-bit groups of decimal digits separated by decimal points (example: 192. 168.1.2).
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
#Get ipv4addr my $ipv4addr = $rootns->ipv4addr(); #Modify ipv4addr $rootns->ipv4addr("2.2.2.2");
Use this method to set or retrieve the IPv6 address of the custom root name server. Required only when ipv4 is not specified.
Include the specified parameter to set the attribute value. Omit the parameter to retrieve the attribute value.
An IPv6 address is a 128-bit number in colon hexadecimal notation. It consists of eight groups of four hexadecimal digits separated by colons (example: 12ab:0000:0000:0123:4567:89ab:0000:cdef).
If you specified a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you did not specify a parameter, the method returns the attribute value.
# Getting ipv6addr my $ipv6addr = $rootns->ipv6addr(); # Modifying ipv6addr $rootns->ipv6addr("12ab::345");
The following sample code demonstrates the different functions that can be applied to a custom root name server object such as add, modify, and remove. Also, this sample includes error handling for the operations.
#Preparation prior to a custom root name server object insertion
#PROGRAM STARTS: Include all the modules that will be used use strict; use Infoblox;
#Create a session to the Infoblox appliance my $session = Infoblox::Session->new( master => "192.168.1.2", #appliance host ip username => "admin", #appliance user login password => "infoblox" #appliance password ); unless ($session) { die("Construct session failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Session created successfully\n";
#Create a custom root name server object
my $rootns = Infoblox::Grid::RootNameServer->new( host_name => "qe.infoblox.com", ipv4addr => "1.1.1.1" ); unless($rootns) { die("Construct custom root name server object failed: ", Infoblox::status_code() . ":" . Infoblox::status_detail()); } print "Root name server object created successfully\n";
#Get the Grid DNS object and add custom root name server to it
#Get the Grid DNS object my @retrieved_objs = $session->get( object => "Infoblox::Grid::DNS", grid => "Infoblox" ); my $object = $retrieved_objs[0]; unless ($object) { die("Get Grid DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get Grid DNS object found at least 1 matching entry\n";
#Apply the changes to the Grid DNS object $object->rootNS([$rootns]);
#Apply the changes $session->modify($object) or die("Modify Grid DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Grid DNS object with custom root name server updated to Infoblox appliance successfully\n";
#Modify custom root name server
#Modify existing custom root name server object
#Modifying the host name of the custom root name server object. $rootns->host_name("eng.infoblox.com");
#Modifying the IPV4 address of the custom root name server object. $rootns->ipv4addr("3.3.3.3");
#Apply changes to the Grid DNS object. $object->rootNS([$rootns]);
#Update Grid DNS object through the Infoblox session. $session->modify($object) or die("modify Grid DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Grid DNS object with modified custom root name server updated to Infoblox appliance successfully\n";
#Remove custom root name server
#Apply changes to the Grid DNS object to use default internet root name server. $object->rootNS(undef);
#Update Grid DNS object through the Infoblox session. $session->modify($object) or die("Remove custom root name server from Grid DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Removed custom root name server from Grid DNS object successfully\n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::Grid::DNS
Copyright (c) 2017 Infoblox Inc.