Today I would like to discuss transparent ASA NAT. The good news about this technology is that implementation of NAT on a transparent firewall is actually the same as in routed mode, however, some additional steps may need to be taken in the Control Plane to make it work.
When you use NAT in transparent mode, the outgoing interface of a packet is determined by performing a MAC address lookup instead of a route lookup. This is because the firewall simply switches the frame based on L2 information instead of trying to route it (it uses the frame’s destination MAC to find the outgoing port in the CAM). There are, however, few exceptions to this rule, and one of them may be NAT (I said “may” because it would only come into play if the translated traffic is one hop away from the ASA – then the firewall needs to perform a route lookup to find the next hop gateway).
Take this topology for example :
Now let’s try to configure simple translations (NAT configuration will not be our focus – again, it’s the same as in routed mode) and think about changes needed (if any) in the Control Plane of the devices involved. I am going to break this example into four different scenarios to better illustrate the problem :
- Original & Translated addresses belong to the Local network (ASA’s subnet)
- Original address is Local, Translated is not
- Translated address is Local, Original is not
- Both Original and Translated addresses are not directly connected to the ASA
Scenario #1 (Local addresses) :
Here we will translate R2’s IP address (172.3.245.2) to something from that Local range, let’s say 172.3.245.200 :
And we test :
Works great. No additional changes were needed in addition to regular NAT config but note what happened in the background :
After return Telnet packet was received from R5 (that was de-translated to real destination address 172.3.245.2) ASA internally generated an ARP Request to that address. It was trying to learn the interface connected to 172.3.245.2 to know where to send the frame after the de-translation and with what L2 destination MAC. This is because when the original packet was translated (Telnet SYN segment from R2 to R5) the ASA also changed L2 source to itself (it Proxy-ARPs for .200) :
Then the reply (before and after ASA processing) :
Note that ASA did not have to learn R5’s interface and MAC because packets from R2 to R5 are bridged based on the original MAC – R5’s address which is already in the CAM.
Scenario #2 (Local Original & Non-local Translated addresses) :
Here we will translate R4’s IP address (172.3.245.4) to something Remote (Non-local) – like 22.22.22.22 :
Is this now enough to communicate R4 with outside bi-directionally? Not really. The problem is that our upstream device (R5) does not know how to get to 22.22.22.0/24 :
OK, we will fix it by adding a route for 22.22.22.0/24 on R5 via ASA (you could also point to R2) :
Now a similar thing occurs as in the previous case. When ASA gets a reply (destination 22.22.22.22) it performs a de-translation and then, since the address is found out to be “local”, it generates an ARP request to figure out the outgoing interface and destination MAC for the frame (no RIB lookup) :
Scenario #3 (Non-local Original & Local Translated addresses) :
Here we will translate Remote address 10.2.2.2 (connected to R2) to something from the Local subnet – e.g 172.3.245.222 :
Initially we don’t have connectivity. Even that ASA technically does the translation and de-translation (debug nat) :
It does not know where (MAC) to send a packet with a L3 destination of 10.2.2.2 :
What do we do? A static route comes to rescue :
So what happened here? After de-NAT took place ASA had to learn the interface and MAC corresponding to 10.2.2.2. This address is Non-local so ASA had to use its routing table to learn the Local next-hop. After next-hop was found (172.3.245.222) it generated ARP request to get the corresponding MAC (same as in our previous cases).
Scenario #4 (Non-local addresses) :
The translation configured in this scenario will be for Remote address 10.4.4.4 (connected to R4) and we will use 44.44.44.44 as the translated address :
All right so in addition to the NAT config we definitely want to let the ASA know about 10.4.4.4/24 but this time our upstream router (R5) must also learn about the NAT pool :
This case was almost the same like #3 – we just had to add one more route – on upstream R5.
As you can see even that NAT configuration in the transparent mode is the same as in routed (one limitation here is that you cannot configure interface PAT – since interfaces don’t have addresses assigned), some routing changes might be needed on the ASA and/or upstream device to ensure bi-directional connectivity.
– Piotr Kaluzny CCIE #25665 (Security) / CCIE Security Instructor – iPexpert, Inc.
About Piotr: Piotr, a MSc in Computer Science, has been in the networking industry for over seven years working in several different capacities within enterprise Cisco environments. His responsibilities included, but were not limited to, implementation, design, and level three technical support. Piotr already has an extensive background as a Technical Instructor – he has been designing and developing Cisco training solutions and teaching CCIE classes for the past four years.