Add/Removing PTR records

140 views
Skip to first unread message

Joshua Piper

unread,
Sep 13, 2020, 10:10:49 PM9/13/20
to dnspython-users
Hello,

I am struggling with adding and removing PTR records.
My code snippet is as follows:

name = input('Enter the subdomain wanted ([THIS].domain.tld.): ')
ip = input('Enter the designated IP address/alias wanted: ')

zone2 = dns.update.Update("230.186.136.in-addr.arpa.", keyring=key) 
update2 = zone.add(name , 86400, dns.rdatatype.PTR, ip) #THIS IS NOT WORKING
response2 = dns.query.tcp(zone, '127.0.0.1')

I have been able to add A, MX etc. records to the normal file. However, have struggled getting it to work for the PTR.

May I please get assistance

Kind regards,

Josh

Bob Halley

unread,
Sep 14, 2020, 7:04:03 PM9/14/20
to dnspython-users
The owner name of a PTR record should in the "reverse name" for appropriate for the IP address you're trying to do the reverse lookup for; see the reverse name example.  You have "name" which seems to be the hostname associated with the IP address.  "name" should be the target of the PTR (i.e. where you have "ip" now).

Joshua Piper

unread,
Sep 14, 2020, 7:35:59 PM9/14/20
to dnspython-users
Ahhh I get you,

I got it working. For some reason I just expected the formatting to be done by dnspython automatically.

Thanks

Reply all
Reply to author
Forward
0 new messages