Adventures in dns - conditional forwarding reverse dns requests



Well that title is a bit of a mouthful but what i actually want to do is quite simple - take the case in the screenshot below - i can quite happily do the forward lookup (i.e. resolve a name to an ip address), however if i then try and lookup the ip address in dns to see what name that's linked to it doesn't work......



So in the case above i quite happily resolve portal.azure.com to an ip (this is kind of how the internet works so it's pretty fundamental that it does work), However if i take that ip and look it up it can't be resolved back to a name.

This is generally not a problem as you don't often need to do this, in our specific case though we have a use case where we need to be able to resolve an on premises ip address back to a name - so how can we deal with that?

After a bit of research it seems it's possible by adding a conditional forwarder - now normally these are used for the forward lookups I mentioned just previously  resolving names to ip addresses. A classic case is for an environment where you have multiple dns servers all managing their own domain. Instead of replicating the information in all dns servers we just set a conditional forwarder - so for example if i send a request to  a dns server that looks after internaldomain.com for a name test.otherinternaldomain.com by default it won't be able to do anything with it and will just fail to resolve.

My adding a conditional forwarder we are just 'passing the buck' - i.e. getting someone else who knows what to do look it up for us. In the case above we just add a record in internaldomain.com that says if you get any requests for otherinternaldomain.com send them to x.x.x.x (the ip address of the other dns server) - that then resolves it sends us back the result which we then pass back to the client.

This is all pretty standard stuff.

I personally had never had to do this for a reverse lookup and wasn't sure it was possible - there is no option to directly add a conditional reverse lookup.

It turns out it is possible though - you just need a specially formatted conditional forwarder.

Take the case that the range of ip's i want to be able to resolve back to name all exist in the 10.20.30.x subnet. I need to add a forwarder for that specific subnet to the dns server that has those reverse records in it - to do that is quite simple.

The screenshot below shows how to add that in Microsoft dns manager


The key part being the format of the 'domain' we wan't to forward - in this case it's not a domain really as it's an ip - but we have to add it here.

The name we add (as you can see in the pic) is 30.20.10.in-addr.arpa - this specially formatted name is in the format that dns understands as a 'reverse conditional forwarder' - note the ip numbers have to be reversed so 10.20.30 becomes 30.20.10 in the record (that is not a mistake :-)). The other element we need is the ip address of the server that has these reverse records in it - in my case i just picked 10.10.10.10 as an example.

And that's it - now it should work.

If i now do nslookup 10.20.30.1, a request is sent to my normal dns server, this server hasn't got the info but it now has a forwarder to say send it on to 10.10.10.10. 10.10.10.10 then checks its records finds the name and sends that back to my dns server which then sends back the name to me.

Conditional reverse lookups done......



Comments

Post a Comment