Infoblox::DNS::RootNameServer - Custom root name server object.
The custom root name server provides host name and IP address information of the internal root name server. When the Infoblox appliance receives a recursive query for DNS data that it does not have, it uses the internal root name server specified instead of using the Internet root name server.
my $rootns = Infoblox::DNS::RootNameServer->new( host_name => $fqdn, #Required ipv4addr => $ipv4addr #Required if $ipv6addr is not present ipv6addr => $ipv4addr #Required if $ipv4addr is not present );
You can apply the following functions to a custom root name server object:
Use this function to specify custom root name servers at the view level on the Infoblox appliance. See Infoblox::DNS::View->custom_root_name_servers() for parameters and return values.
#Construct a custom root name server object my $rootns1 = Infoblox::DNS::RootNameServer->new( host_name => "rns1.test.com", ipv4addr => "4.4.4.4" );
#Construct a custom root name server object my $rootns2 = Infoblox::DNS::RootNameServer->new( host_name => "rns3.test.com", ipv6addr => "6666::" );
# Configure custom root name server on the View object my $response = $View->custom_root_name_servers([$rootns1, $rootns2]);
Use this function to specify custom root name servers at the member level on the Infoblox appliance. See Infoblox::Grid::Member::DNS->custom_root_name_servers() for parameters and return values.
#Construct a custom root name server object my $rootns1 = Infoblox::DNS::RootNameServer->new( host_name => "rns1.test.com", ipv4addr => "4.4.4.4" );
#Construct a custom root name server object my $rootns2 = Infoblox::DNS::RootNameServer->new( host_name => "rns3.test.com", ipv6addr => "6666::" );
# Configure custom root name server on the member DNS object my $response = $Member_DNS->custom_root_name_servers([$rootns1, $rootns2]);
This section describes all the methods you can use 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 the 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 specify a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you do 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. It is 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 specify a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you do 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. It is 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 specify a parameter, the method returns true when the modification succeeds, and returns false when the operation fails.
If you do 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::DNS::RootNameServer->new( host_name => "rns1.test.com", ipv4addr => "4.4.4.4" ); 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 Member DNS object and add custom root name server to it
#Get the Member DNS object my @retrieved_objs = $session->get( object => "Infoblox::Grid::Member::DNS", name => "infoblox.localdomain" ); my $object = $retrieved_objs[0]; unless ($object) { die("Get Member DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); } print "Get Member DNS object found at least 1 matching entry\n";
#Apply the changes to the Grid DNS object $object->custom_root_name_servers([$rootns]);
#Apply the changes $session->modify($object) or die("Modify Member DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Member 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 Member DNS object. $object->custom_root_name_servers([$rootns]);
#Update Member DNS object through the Infoblox session. $session->modify($object) or die("modify Member DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Member DNS object with modified custom root name server updated to Infoblox appliance successfully\n";
#Remove custom root name server
#Apply changes to the Member DNS object to use default internet root name server. $object->custom_root_name_servers(undef);
#Update Member DNS object through the Infoblox session. $session->modify($object) or die("Remove custom root name server from Member DNS object failed: ", $session->status_code() . ":" . $session->status_detail()); print "Removed custom root name server from Member DNS object successfully\n";
####PROGRAM ENDS####
Infoblox Inc. http://www.infoblox.com/
Infoblox::Session, Infoblox::Grid::Member::DNS, Infoblox::DNS::View
Copyright (c) 2017 Infoblox Inc.