Sending DNS notify messages (update notifications) using Ruby
Submitted by Hannes Schmidt on Sun, 01/20/2008 - 15:49.
… is actually easy thanks to Dnsruby. The following code illustrates that:
require "dnsruby"
def notify( zone, server )
resolver = Dnsruby::Resolver.new( :nameserver => server )
msg = Dnsruby::Message.new
msg.header.rd = 1
msg.header.aa = 1
msg.header.opcode = Dnsruby::OpCode.Notify;
msg.add_question( zone, Dnsruby::Types.SOA )
begin
resolver.send_message( msg )
rescue ResolvError
… # handle exception appropriately
rescue ResolvTimeout
… # handle exception appropriately
end
end