Net DNS Update problem

Discussion in 'Perl Misc' started by milney_boy, Mar 21, 2007.

  1. milney_boy

    milney_boy Guest

    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.
    milney_boy, Mar 21, 2007
    #1
    1. Advertising

  2. On Mar 21, 1:58 pm, "milney_boy" <> wrote:

    > 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.
    Brian McCauley, Mar 22, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Whiteley

    Using Python to send a DNS update packet

    Matt Whiteley, Dec 24, 2003, in forum: Python
    Replies:
    3
    Views:
    2,012
    John P. Speno
    Dec 28, 2003
  2. Gabriel Genellina

    Re: Using Python to send a DNS update packet

    Gabriel Genellina, Dec 24, 2003, in forum: Python
    Replies:
    0
    Views:
    386
    Gabriel Genellina
    Dec 24, 2003
  3. Andi Clemens

    How to update DNS record

    Andi Clemens, Mar 1, 2007, in forum: Python
    Replies:
    8
    Views:
    388
    Martin P. Hellwig
    Mar 2, 2007
  4. Sam Roberts
    Replies:
    0
    Views:
    206
    Sam Roberts
    Mar 20, 2005
  5. gavino
    Replies:
    2
    Views:
    164
    Ted Zlatanov
    Jul 27, 2006
Loading...

Share This Page