1

I am trying to create/edit a DNS record, of type A, with no success. The documentation is terrible, and I could not find any further examples.

I wish to create new A record in my DNS server OR editing an existing record(like change its ip address or hostname)

What I found till now(not working for me) is:

for creating:

record = dns.update.Update(ZONE_NAME)
record.add(name, ttl, rdtype, rdata) \\name=fqdn of server, rdata=ip address of server
dns.query.tcp(record, DNS_SERVER_ADDRESS)

for editing record: same just replace the update.add with update.replace

I would appreciate any help

yAm
  • 11
  • 3
  • What you are doing above is a DNS update. Is your server supporting DNS updates? What happens when you run your code? Other than that you can find examples of the toolkit at https://github.com/rthalley/dnspython/tree/master/examples – Patrick Mevzek Aug 16 '21 at 14:29
  • I assume my server supports DNS updates since dns.update.Update.delete does work. If so, I do manage to delete records, I just cannot create them for some reason. Thanks for the reference I am looking into it right now. – yAm Aug 16 '21 at 15:16
  • `since dns.update.Update.delete does work.` . that specific line does not do anything remotely, it creates just a DNS packet on your side. Until you send it to a nameserver, nothing happens :-) – Patrick Mevzek Aug 16 '21 at 15:30
  • `I just cannot create them for some reason. ` What errors do you have in your program? In your nameserver logs? – Patrick Mevzek Aug 16 '21 at 15:30
  • Well, I meant that `delete` does remove a given hostname from DNS records and `replace/ add` does not. Off course I use the `dns.query.tcp(action, MY_DNS_SERVER)` on both sides. I do not have any errors in my program, but I am absolutely gonna check my dns server logs. Thank you – yAm Aug 17 '21 at 07:06
  • I found the wrong line! It was the `dns.update.Update.replace(ZONE_NAME)` The zone name has to end with '.' – yAm Aug 17 '21 at 07:47

0 Answers0