1

I have a CLI script that runs through NSUPDATE for a DDNS unix server. It accepts user input and adds/modifies/deletes records as needed. I'm not sure how to, or if you can, modify a reverse zone record when a forward zone record is being change. Say

nslookup host1.zone1 = 1.2.3.4
nslookup 1.2.3.4  = host.zone1

I want to run nsupdate as follows.

nsupdate
server info ....
update add host1.zone1 86400 IN A 5.6.7.8
send

I'm wondering if there is a way to link the reverse record to the forward record so just editing the forward zone record changes both.

nslookup host1.zone1 = 5.6.7.8
nslookup 5.6.7.8 = not found (want this to show host1.zone1)
nslookup 1.2.3.4 = host1.zone1 (want this to show not found)
Saxon
  • 13
  • 3

1 Answers1

1

from first link of googling "man nsupdate reverse":

Adding records

Here are examples of how to add A, CNAME, and PTR records. One must specify the TTL (time-to-live) of records (in seconds) when they are added.

update add www1.example.com 86400 a 172.16.1.1
update add www.example.com 600 cname www1.example.com.
send

update add 1.1.16.172.in-addr.arpa 86400 ptr www1.example.com.
send 

Note that I have taken care to use two separate "send" commands to handle the A and PTR updates of www1.example.com since the changes apply to two different zones, example.com and 1.16.172.in-addr.arpa.

Keep in mind that reverse records are PTR, not A. There's no method I'm aware of where you can link them so that one command does both as they are separate records. But, if you're scripting the forward, you already have the information for the PTR.

Rick Buford
  • 629
  • 3
  • 4
  • Ah okay, thanks you for your time, wasn't sure if there was a way of linking them. I have made a very crude bash script of a mixture of dig/grep/cut/sed to get the old ip, reverse its pattern and then delete before adding a new address. – Saxon May 26 '15 at 03:00
  • if you're taking the IP and reversing it to get the PTR record, you may want to consider either parsing out the zone statements from the config or some other method of keeping track of the actual zone so that you're not trying to add/remove to the wrong zone; i.e., if you're using 192.168/16 IP space, you wouldn't want to try to add records as a /24. One of the ways I've gotten around this in the past is to use INCLUDEs (http://www.zytrax.com/books/dns/ch7/include.html) in the config file so that the application folks could add/remove records to files in a non-priveledged file on the server. – Rick Buford May 26 '15 at 11:06