M
milney_boy
Hello,
I'm trying to write a script to update records on my BIND server. To
start with I am writing a simple script to add and delete A records.
I want to be able to have multiple A records with the same hostname/
alias but with different IP addresses. When it comes to deleting
them, I want to use the yxrrset to make sure the exact record exists
first (so that i know if for some reason it does not exist).
The problem is that whilst the value-dependant yxrrset seems to work
correctly when there is only a single A record with the same hostname/
alias, it always reports nxrrset when there is more than one.
I have cut my code right down to try and get to the bottom of it, but
it is still not working:
----------------------------------------------
#!/usr/bin/perl -w
user Net:NS;
my $update = Net:NS::Update->new("mydomain.com");
$update->push("pre", yxrrset("two.mydomain.com A 212.212.31.212"));
my $res = Net:NS::Resolver->new;
$res->nameserver("ns1.mydnshost.com");
my $reply = $res->send($update);
print $reply->header->string . "\n";
----------------------------------------------
When nslookup shows:
Name: two.mydomain.com
Address: 212.212.31.212
Output is:
;; id = 45744
;; qr = 1 opcode = UPDATE rcode = NOERROR
;; zocount = 0 prcount = 0 upcount = 0 adcount = 0
When nslookup shows:
Name: two.mydomain.com
Address: 212.212.31.212
Name: two.mydomain.com
Address: 212.212.31.213
Output is:
;; id = 28698
;; qr = 1 opcode = UPDATE rcode = NXRRSET
;; zocount = 0 prcount = 0 upcount = 0 adcount = 0
Any ideas on why this might be? It seems that the second you add
multiple records the value-dependany yxrrset does not match any of the
records.
I've tried adding the TTL into the yxrrset statement but still no luck.
I'm trying to write a script to update records on my BIND server. To
start with I am writing a simple script to add and delete A records.
I want to be able to have multiple A records with the same hostname/
alias but with different IP addresses. When it comes to deleting
them, I want to use the yxrrset to make sure the exact record exists
first (so that i know if for some reason it does not exist).
The problem is that whilst the value-dependant yxrrset seems to work
correctly when there is only a single A record with the same hostname/
alias, it always reports nxrrset when there is more than one.
I have cut my code right down to try and get to the bottom of it, but
it is still not working:
----------------------------------------------
#!/usr/bin/perl -w
user Net:NS;
my $update = Net:NS::Update->new("mydomain.com");
$update->push("pre", yxrrset("two.mydomain.com A 212.212.31.212"));
my $res = Net:NS::Resolver->new;
$res->nameserver("ns1.mydnshost.com");
my $reply = $res->send($update);
print $reply->header->string . "\n";
----------------------------------------------
When nslookup shows:
Name: two.mydomain.com
Address: 212.212.31.212
Output is:
;; id = 45744
;; qr = 1 opcode = UPDATE rcode = NOERROR
;; zocount = 0 prcount = 0 upcount = 0 adcount = 0
When nslookup shows:
Name: two.mydomain.com
Address: 212.212.31.212
Name: two.mydomain.com
Address: 212.212.31.213
Output is:
;; id = 28698
;; qr = 1 opcode = UPDATE rcode = NXRRSET
;; zocount = 0 prcount = 0 upcount = 0 adcount = 0
Any ideas on why this might be? It seems that the second you add
multiple records the value-dependany yxrrset does not match any of the
records.
I've tried adding the TTL into the yxrrset statement but still no luck.