You want to dynamically update a zone.
Use the nsupdate program to send updates to your zone. First, start nsupdate in interactive mode:
The basic command in nsupdate's interactive mode is update. To add a new record, use update add. To delete one or more records, use update delete. update add takes a resource record, including an explicit TTL, as an argument. For example:
> update add host.foo.example. 3600 A 192.168.0.31
You can leave out the class, though; it defaults to IN, for "Internet."
To delete a particular record, specify the record as an argument to update delete:
> update delete foo.example. MX 10 mail.foo.example.
To delete all records of a particular type attached to a domain name, specify the domain name and type as an argument to update delete:
> update delete foo.example. MX
Finally, to delete all records of any type attached to a domain name, specify just the domain name as an argument to update delete:
> update delete host.foo.example.
You can perform more than one add or delete operation at once by specifying multiple update commands, each on its own line, as long as the changes are made to a single zone. Once you're ready to send the update, type:
If you're running a BIND 8 version of nsupdate, just type a blank line:
Here's a complete nsupdate session:
$ nsupdate > update delete www.foo.example. IN A > update add www.foo.example. 3600 IN A 192.168.0.89 > send
nsupdate can communicate with (and hence update) any name server. It looks up the SOA record of the zone the domain name in the update belongs in and sends the update to the name server listed in the MNAME field. Consequently, you should make sure the MNAME field of each of your zones' SOA records contains the domain name of the real primary master name server for the zone.
Since nsupdate gives you very little feedback, you may find it helpful to run nsupdate with the -d (debug) option. That way, you can see the output from the name server that receives the update.
5.20.4 See Also
nsupdate(8); Section 3.11, for how to allow dynamic updates to a zone; Recipes Section 5.21, Section 5.22, and Section 5.23 for variations on sending dynamic updates to a name server; Section 9.10 and Section 9.11, for sending dynamic updates programmatically; and "DNS Dynamic Update" in Chapter 10 of DNS and BIND.
BIND Name Server Configuration
BIND Name Server Operations
Delegation and Registration
Interoperability and Upgrading
Resolvers and Programming
Logging and Troubleshooting