Net DNS Update problem

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::DNS;

my $update = Net::DNS::Update->new("mydomain.com");

$update->push("pre", yxrrset("two.mydomain.com A 212.212.31.212"));

my $res = Net::DNS::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.
 
B

Brian McCauley

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.

The behaviour of BIND that you are describing appears to be correct
according to RFC2136 section 2.4.2 which states "For this
prerequisite, a requestor adds to the section an _entire_ RRset whose
preexistence is required.". BIND is checking for set _equality_ not
checking for set inclusion.

This, of course, has nothing to do with Perl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top