24

Inside-to-inside NAT aka NAT loopback solves hairpin NAT issues when accessing a web server on the external interface of an ASA or similar device from computers on the internal interface. This prevents DNS admins from having to maintain a duplicate internal DNS zone that has the corresponding RFC1918 addresses for their servers that are NATted to public addresses. I'm not a network engineer, so I might be missing something, but this seems like a no-brainer to configure and implement. Asymmetric routing can be an issue but is easily mitigated.

In my experience, network admins/engineers prefer that systems folks just run split-dns rather than configuring their firewalls to properly handle NAT hairpins. Why is this?

MDMarra
  • 101,023
  • Maybe because DNS views are easier to troubleshoot? – NickW May 17 '13 at 12:28
  • 2
    Possibly, but when using DNS on AD Domain Controllers (a common scenario) views don't exist. – MDMarra May 17 '13 at 12:30
  • Very good point. – NickW May 17 '13 at 12:35
  • As a security measure, I don't want to publish my AD DNS zones to the Internet, so I already need split zones. – Zoredache May 17 '13 at 15:33
  • 2
    Why would you need to publish your AD zone to the Internet? If your AD is ad.example.com or similar (like it should be!), then this problem will exist for all public example.com DNS entries and nothing internal is published externally. Of course, if you've named your AD the same as your public presence you must use split-DNS, but that's not a best practice AD design. – MDMarra May 17 '13 at 15:51
  • 6
    I'd add that DNS views are only easier to troubleshoot if clients never move between them. Things can go oddly wrong when clients take a cached internal result outside. – LapTop006 May 18 '13 at 11:19
  • 3
    Clients shouldn't cache DNS answers, that's what DNS servers are for. I know Windows is very fond of silent (and deadly) cacheing, but that's one of the many reasons why I think it's unfit for production use. – MadHatter May 19 '13 at 16:39
  • Totally unrelated to this question, but you should know that it's trivial to disable Windows client-side DNS caching – MDMarra May 19 '13 at 16:41

7 Answers7

12

Obviously, there cannot be the definite answer for this, but I could think of a number of reasons:

  1. Elegance: NAT is not very elegant to begin with, but a necessity with IPv4's restricted address space. If I can avoid NAT, I will. With IPv6 the problem is going away at any rate.
  2. Complexity: especially in a case where you do not have just one single "core" router creating all of your security boundaries, filter configuraions can become quite tricky. Either that or you would have to spread and maintain the NAT rules across nearly all of your router devices.
  3. Reference: wherever firewall admins are different folks than the rest of the server admin team, they might be difficult to reach. In order to ensure that changes are not delayed by the firewall admin's backlog (or vacations), the option to keep the responsibility in the same team is chosen
  4. Portability and common practice: Using DNS views is "just the thing everybody knows is done" to solve this problem. Not every boundary router would support loopback NAT in a straightforward way, less people are likely to know how to set it up correctly in your specific environment. When troubleshooting network issues, the crew would need to be aware of the hairpin NAT configuration and all of its implications - even when they are chasing an apparently unrelated problem
the-wabbit
  • 41,007
  • 1
  • In this situation NAT is being used anyway. This isn't adding NAT where there wasn't NAT before 2. In my example, they are all handled by the same device or cluster of devices. 4. As stated in my comment above, a very common scenario is using AD Domain Controllers for DNS internally. Windows DNS does not support views. Also, I've found that most somewhat modern router/firewall firmwares support NAT hairpinning in one way or another.
  • – MDMarra May 21 '13 at 12:59
  • 1
    @MDMarra some remarks: 1. - "there would be one NAT weirdness less to care about" is what I basically meant, 2. - your question does not explicitly say so, but with just a single router it obviously will be easier to handle, 4. with internal DNS in place which is mandatory for all clients, you do not need views - you just would create an internal zone and get the same effect as you've mentioned in your question, the reasoning above still applying. – the-wabbit May 21 '13 at 13:25
  • 1
    What NAT weirdness, though? What specific behavior would this introduce that causes problems? I worked at a university that had NAT hairpinning configured on a Netscreen cluster for 100+ external hosts and we never had a problem. – MDMarra May 21 '13 at 14:57
  • Also note that using hairpin NAT in this scenario is actually making it look more like the IPv6 solution, because under IPv6 the system will have one globally-reachable address; hairpin NAT simulates that behaviour. – Paul Gear May 21 '13 at 22:22
  • @MDMarra the most outstanding "NAT weirdness" for the "hairpin NAT" case would be the non-optimal routing path, meaning the rewritten packets would have to travel most of the path back they came in through. Seeing this in a packet dump when troubleshooting connectivity is confusing at best. I believe others have already mentioned the asymmetric routing issue in their answers, which is related. There is no doubt you can make it work just fine. But it is not worth the effort in a majority of cases IMO. – the-wabbit May 25 '13 at 12:09
  • Parts 2 & 4 of this are the core of it, i think. – Paul Gear May 29 '13 at 21:10