Rackspace Cloud Team T-shirt by Shaun Farrell

Setting Reverse DNS for Rackspace Next Generation Cloud Servers

OK, so a heavy duty bit of geekery here. 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.

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.

Here goes…

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.

curl -H "x-auth-key:RACKSPACE_API_KEY" -H "x-auth-user:RACKSPACE_USERNAME" \
https://lon.identity.api.rackspacecloud.com/v1.0 -i

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:

HTTP/1.1 204 No Content
Server: nginx/0.8.55
Date: Thu, 22 Nov 2012 10:15:37 GMT
Connection: keep-alive
vary: Accept, Accept-Encoding, X-Auth-Token, X-Auth-Key, X-Storage-User, X-Storage-Pass, X-Auth-User
Cache-Control: s-maxage=74459
VIA: 1.0 Repose (Repose/2.3.5)
Front-End-Https: on

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.

"records": [ {
"name" : "DOMAIN_NAME",
"type" : "PTR",
"data" : "IP_ADDRESS",
"ttl" : 56000
"link" : {
"content" : "",
"href" : "https://lon.servers.api.rackspacecloud.com/v2/RACKSPACE_USERID/servers/NEXTGEN_SERVERID",
"rel" : "cloudServersOpenStack"

replacing the following place holders with your info:

  • DOMAIN_NAME – the domain name to use e.g. server1.mycompany.com
  • IP_ADDRESS – used for the reverse lookup
  • RACKSPACE_USERID – the numeric ID for the Rackspace user, find this in the API Keys page on your Rackspace Dashboard, click on username in top right-hand corner, select API Keys.
  • NEXTGEN_SERVERID – The ID of the server – get from the main list of servers, hover over the server name and you’ll get a pop-up window listing the server’s ID.

N.B. The URL will be based on the location of your servers. The one I was using is in London, but if you’re using a different data centre you’ll need to update this (Thanks Ian for pointing this out).

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:

curl -H "x-auth-token: YOUR_AUTH_TOKEN" \
https://lon.dns.api.rackspacecloud.com/v1.0/RACKSPACE_USERID/rdns \
-d @ptr -H "Content-Type: application/json" -i

The response should look something like this:

HTTP/1.1 202 Accepted
Date: Thu, 22 Nov 2012 10:22:12 GMT
Content-Length: 598
Content-Type: application/json
Server: Jetty(8.0.y.z-SNAPSHOT)

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.
Pic (cc) Shaun Farrell.


Inquisitive. Hopeful. Jovial. Cantankerous. Digital marketer. Event organiser. Long-time fan of tech, collaboration and innovation. Exploring digital, social, business, technology, society, psychology & startups. Founder Chinwag, Digital Mission, Pitch NYC, ChinwagPsych. Former Exec Dir, Social Media Week London. More short stuff @toodlepip on Twitter.

  • facebook
  • flickr
  • googleplus
  • linkedin
  • twitter