#!/usr/bin/perl -w use strict; use Net::DNS; # Create the update packet. my $update = Net::DNS::Update->new('evil.zz'); # Prerequisite is that no A records exist for the name. $update->push(prerequisite => nxrrset('hacker11.evil.zz. A')); # Add two A records for the name. $update->push(update => rr_add('hacker11.evil.zz. 86400 A 127.0.0.1')); # $update->push(update => rr_add('foo.example.com. 86400 A 172.16.3.4')); # Send the update to the zone's primary master. my $res = Net::DNS::Resolver->new; $res->nameservers('192.168.200.113'); my $reply = $res->send($update); # Did it work? if ($reply) { my $rcode = $reply->header->rcode; print 'Update ', $rcode eq 'NOERROR' ? "succeeded\n" : "failed: $rcode\n"; } else { print 'Update failed: ', $res->errorstring, "\n"; }