Problem
How to create a reverse DNS (PTR) record for a Rackspace cloud server using API.
Solution
This little script create a PTR records using Openstack Cloud API: dns-ptr-record.py.
Example
Example snippets from ipython console:
In [57]: rec = {'data': '162.13.2.xyz', 'name': 'yourservername.mydomain.com', 'type': 'PTR'} In [62]: dns.add_ptr_records(a0,rec) Out[62]: [{u'created': u'2013-08-18T18:15:33.000+0000', u'data': u'162.13.2.xyz', u'id': u'PTR-579695', u'name': u'yourservername.mydomain.com', u'ttl': 3600, u'type': u'PTR', u'updated': u'2013-08-18T18:15:33.000+0000'}] In [67]: dns.list_ptr_records(a0) Out[67]: [<CloudDNSPTRRecord id=PTR-579695, data=162.13.2.xyz, name=yourservername.mydomain.com, ttl=3600>]
root@manage2:~# dig -x 162.13.2.xyz @dns1.stabletransit.com ; <<>> DiG 9.8.1-P1 <<>> -x 162.13.2.xyz @dns1.stabletransit.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12333 ;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0 ;; WARNING: recursion requested but not available ;; QUESTION SECTION: ;xyz.2.13.162.in-addr.arpa. IN PTR ;; ANSWER SECTION: xyz.2.13.162.in-addr.arpa. 3600 IN PTR yourservername.mydomain.com. ;; AUTHORITY SECTION: 2.13.162.in-addr.arpa. 300 IN NS ns.rackspace.com. 2.13.162.in-addr.arpa. 300 IN NS ns2.rackspace.com. ;; Query time: 109 msec ;; SERVER: 69.20.95.4#53(69.20.95.4) ;; WHEN: Sun Aug 18 18:18:49 2013 ;; MSG SIZE rcvd: 130
References
- https://github.com/rackspace/pyrax/issues/79
- http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/ReverseDNS-123457003.html
- http://www.rackspace.com/knowledge_center/article/rackspace-cloud-essentials-6-creating-a-reverse-dns-record
- http://www.rackspace.com/knowledge_center/comment/155017
Get best cloud hosting services at CloudOye and get good deals on cloud hosting services. You can also check their reviews online.
ReplyDelete