Setting Up NAT Hairpinning to Connect to Site from an Internal IP Address

We use a WordPress plugin that checks for broken links. It uses cURL to do this. External links work fine but internal ones, not so much. The connection is refused.

Talked to our host about this and they said "we put the servers on an internal private network and then NAT to the internet.

The curl command will have to connect directly to the private IP address of the server."

In other words, curl people-press.org/about/danielle-gewurz/

would need to be...

curl -H "Host: people-press.org" 10.5.1.66/about/danielle-gewurz/

I'd really not like to have to mess with the plugin to make it work with our unusual setup so is there anything you might recommend from a network architecture perspective?

I understand what I'm looking for is something called hairpinning NAT loopback / NAT inside-to-inside and kind of looks like this... www.juniper.net/techpubs/en_US/junos11.2/information-products/topic-collections/security/software-all/security/index.html?topic-56995.html

Of course my host has no idea what I'm talking about.


You are correct, NAT hairpinning would solve your problem. If your NAT-gateway/router is any good, it should be a simple matter to consult the docs and get that working.

Another solution is to set up a so-called "split-brain" DNS, so that external clients get the server's external IP address, while internal clients get the local RFC1918 address. One quick-n-dirty way to implement that would be to add the local IP address mappings to the internal clients' /etc/hosts files.