This document describes the necessary steps to successfully configure Hairpin on a Cisco Adaptive Security Appliance (ASA).
Cisco recommends that you have knowledge of these topics:
The information in this document is based on these software and hardware versions:
The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.
Hairpin Network Address Translation (NAT), also known as NAT loopback or NAT reflection, is a technique used in network routing whereby a device on a private network can access another device on the same private network via a public IP address.
This is used when a server is hosted behind a router, and you want to enable devices on the same local network as the server to access it using the public IP address (the one assigned to the router by the Internet Service Provider) just as an external device would.
The term hairpin is used because the traffic from the client makes it to the router (or firewall implementing NAT) and is then turned back like a hairpin to the internal network after translation to access the private IP address of the server.
For instance, you have a web server on your local network with a private IP address. You want to access this server using its public IP address or a domain name that resolves to the public IP address, even when you are on the same local network.
Without Hairpin NAT, your router would not understand this request because it expects requests for the public IP address to come from outside the network.
Hairpin NAT solves this problem by allowing the router to recognize that, although the request is being made to a public IP, it needs to be routed to a device on the local network.
ciscoasa(config)# object network Local_Clientciscoasa(config-network-object)# host 192.168.14.10 ciscoasa(config)# object network Web_Serverciscoasa(config-network-object)# host 192.168.14.25 ciscoasa(config)# object network P_Web_Serverciscoasa(config-network-object)# host 10.88.243.25 ciscoasa(config)# object service HTTPciscoasa(config-service-object)# service tcp destination eq 80
ciscoasa(config-service-object)# nat (Inside,Inside) source dynamic Local_Client interface destination static P_Web_Server Web_Server service HTTP HTTP
From the local client do a telnet destination IP with de destination port:
If this message “telnet unable to connect to remote host: Connection timed out” prompt, something went wrong at some point during the configuration.
But if it says Connected, it works!
If you are experiencing issues with Network Address Translation (NAT), use this step-by-step guide to troubleshoot and resolve common issues.
ciscoasa(config)# clear xlate
ciscoasa(config)# show xlate
ciscoasa(config)# show nat