The dashboard for Rackspace's next generation of servers doesn't have an option to set the reverse DNS for a cloud server. You have to use the Rackspace Cloud API. How do I use the API to set up the reverse DNS for my server?
migrated from stackoverflow.com Nov 22 '12 at 16:40
This question came from our site for professional and enthusiast programmers.
locked by Mark Henderson♦ Nov 23 '12 at 5:14
This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.
I've written this up largely so that I've got a future reference for it, but also because I imagine there'll be other people looking for the info and I couldn't find it online. There may also be a better way of doing this, so any suggestions are very welcome.
Here's the method used to set the reverse DNS for a next generation cloud server - this one is based at the UK data center but there's also a link for the US one. Unlike the previous cloud offering, there's no way of doing this using the web interface so you have to use curl and the Rackspace Cloud API plus a bit of JSON magic.
Step 1: Get an Authentication Token
This is different from your Rackspace API key - sounds obvious, but I made this mistake. It stays live for 24 hours and you'll need the token to authenticate your request to set the reverse DNS.
N.B. If your server is in the US, you'll need to use a different URL https://identity.api.rackspacecloud.com/v1.0 (see this knowledgebase article for info).
You can find your API key by logging into to your Rackspace MyCloud Dashboard, click on your username (you'll need that too) in the top right hand corner and choose the API Keys option.
The response will looking something like this:
There'll be some other info too, but the one you want is YOUR_AUTH_TOKEN.
Step 2: Create a JSON file with the reverse DNS info
The reverse DNS record or PTR record, for those that speak DNS, is specified using JSON and saved into a file. Use the template below and fill in the info that's specific to your server, save it in to a file, here we'll use the file ptr.
replacing the following place holders with your info:
Step 3: Use Rackspace Cloud API to Set Reverse DNS
Last job is to fire this information at Rackspace Cloud's API to set the record. Almost there!
Use the following curl command, substituting in the values YOUR_AUTH_TOKEN and RACKSPACE_USERID that you'll have obtained from the previous two steps.
The @ptr part of the command refers to the file with the JSON info that we created above:
The response should look something like this:
which is good news and means the info has been accepted. It'll take a while to propogate across the DNS system. Last time I set a record, it took about 30 mins for most servers to pick up the info.
Bit fiddly, but once you've wrapped your head around it, should all work fine. A massive thank you to Oliver Gross at Rackspace's support for fantastic support on this and pointers to Rackspace support docs. As always, use at your own peril and make sure there's plenty of testing.
Cross-posted from this post on my blog.