PTR Updates

45 views
Skip to first unread message

William Wallace

unread,
Nov 30, 2015, 3:29:53 PM11/30/15
to dnsruby
I'm investigating using dnsruby to perform A record and PTR record updates.  I have the A record update working from the example in the README, however I cannot find any example or other information about how to perform a PTR record update.  In my example, the zone 0.0.10.in-addr.arpa  exists, and functions properly with nsupdate, and a corresponding A record exists the IP 10.0.0.200. The example fails with 'Update failed: Dnsruby::TsigNotSignedResponseError'.  Here is the code I have so far . . .  Thans for your help.


#!/usr/bin/env ruby

require 'rubygems'
require 'dnsruby'


KEY_NAME="rndc.key"
KEY = "XXXXXXXXXXXXXXXXXXXXXX=="

res = Dnsruby::Resolver.new({:nameserver => 'my.dns.server'})
res.tsig=KEY_NAME, KEY


# Create the update packet.
update = Dnsruby::Update.new('0.0.10.in-addr.arpa')

update.absent('200.0.0.10.in-addr.arpa.', 'PTR')


# Add a PTR record.

update.add('200.0.0.10.in-addr.arpa.', 'PTR', 86400, 'foo200.example.com.')

# Send the update to the zone's primary master.

begin
reply = res.send_message(update)
print "Update succeeded\n"
rescue Exception => e
print "Update failed: #{e}\n"
end

William Wallace

unread,
Dec 1, 2015, 10:23:46 AM12/1/15
to dnsruby
Leaving the prerequisites section out makes this code work. In other words comment the following line:

# update.absent('200.0.0.10.in-addr.arpa.', 'PTR')

There is a doc bug on this.  I hope it gets fixed because there is absolutely zero documentation to show the solution:



On Monday, November 30, 2015 at 3:29:53 PM UTC-5, William Wallace wrote:
I'm investigating using dnsruby to perform A record and PTR record updates.  I have the A record update working from the example in the README, however I cannot find any example or other information about how to perform a PTR record update.  In my example, the zone 0.0.10.in-addr.arpa  exists, and functions properly with nsupdate, and a corresponding A record exists the IP 10.0.0.200. The example fails with 'Update failed: Dnsruby::TsigNotSignedResponseError'.  Here is the code I have so far . . .  Thans for your help.


#!/usr/bin/env ruby

require 'rubygems'
require 'dnsruby'


KEY_NAME="rndc.key"
KEY = "XXXXXXXXXXXXXXXXXXXXXX=="

res = Dnsruby::Resolver.new({:nameserver => 'my.dns.server'})
res.tsig=KEY_NAME, KEY


# Create the update packet.
update = Dnsruby::Update.new('0.0.10.in-addr.arpa')

#update.absent('200.0.0.10.in-addr.arpa.', 'PTR')
Reply all
Reply to author
Forward
0 new messages