Document ID: 15243
Interactive: This document offers customized analysis of your Cisco device.
This document provides examples of basic Network Address Translation (NAT) and Port Address Translation (PAT) configurations on the Cisco Secure PIX Firewall. This document also provides simplified network diagrams. Consult the PIX documentation for your PIX software version for detailed information.
Refer to PIX/ASA 7.x NAT and PAT Statements in order to learn more about the basic NAT and PAT configurations on the Cisco PIX 500 Series Security Appliances.
Refer to Using nat, global, static, conduit, and access-list Commands and Port Redirection(Forwarding) on PIX in order to learn more about the nat, global, static, conduit, and access-list Commands and Port Redirection(Forwarding) on PIX 5.x and later.
Cisco recommends that you have knowledge of the Cisco Secure PIX Firewall.
The information in this document is based on these software and hardware versions:
Cisco Secure PIX Firewall Software version 5.3.1 and later.
Note: Policy NAT was introduced from 6.2.
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, make sure that you understand the potential impact of any command.
Refer to the Cisco Technical Tips Conventions for more information on document conventions.
In this example, the ISP provides the network manager with an IP address block 18.104.22.168/27 that ranges from 22.214.171.124 to 126.96.36.199. The network manager decides to assign 188.8.131.52 to the inside interface on the Internet router, and 184.108.40.206 to the outside interface of the PIX.
The network administrator already has a Class C address assigned to the network, 192.168.10.0/24, and has some workstations that use these addresses in order to access the Internet. These workstations do not require any address translation as they already have valid addresses. However, new workstations are assigned addresses in the 10.0.0.0/8 network and they need to be translated (because 10.x.x.x is one of the unroutable address spaces per RFC 1918 .
In order to accommodate this network design, the network administrator must use two NAT statements and one global pool in the PIX configuration:
global (outside) 1 220.127.116.11-18.104.22.168 netmask 255.255.255.224 nat (inside) 0 192.168.10.0 255.255.255.0 0 0 nat (inside) 1 10.0.0.0 255.0.0.0 0 0
This configuration does not translate the source address of any outbound traffic from the 192.168.10.0/24 network. It translates a source address in the 10.0.0.0/8 network into an address from the range 22.214.171.124 through 126.96.36.199.
Note: When you have an interface with a NAT policy and if there is no global pool to another interface, you need to use nat 0 in order to set up NAT exception.
In this example, the network manager has two ranges of IP addresses that are registered on the Internet. The network manager must convert all of the internal addresses, which are in the 10.0.0.0/8 range, into registered addresses. The ranges of IP addresses that the network manager must use are 188.8.131.52 through 184.108.40.206 and 220.127.116.11 through 18.104.22.168 . The network manager can do this with:
global (outside) 1 22.214.171.124-126.96.36.199 netmask 255.255.255.224 global (outside) 1 188.8.131.52-184.108.40.206 netmask 255.255.255.224 nat (inside) 1 0.0.0.0 0.0.0.0 0 0
Note that a wildcard addressing scheme is used in the NAT statement. This statement tells the PIX to translate any internal source address when it goes out to the Internet. The address in this command can be more specific if desired.
In this example, the ISP provides the network manager with a range of addresses from 220.127.116.11 to 18.104.22.168 for the company to use. The network manager has decided to use 22.214.171.124 for the inside interface on the Internet router and 126.96.36.199 for the outside interface on the PIX. You are then left with 188.8.131.52 through 184.108.40.206 to use for the NAT pool. However, the network manager knows that, at any one time, there can be more than 28 people that try to go out of the PIX. The network manager has decided to take 220.127.116.11 and make it a PAT address so that multiple users can share one address at the same time.
global (outside) 1 18.104.22.168-22.214.171.124 netmask 255.255.255.224 global (outside) 1 126.96.36.199 netmask 255.255.255.224 nat (inside) 1 0.0.0.0 0.0.0.0 0 0
These commands instruct the PIX to translate the source address to 188.8.131.52 through 184.108.40.206 for the first 27 internal users to pass across the PIX. After these addresses are exhausted, the PIX then translates all subsequent source addresses to 220.127.116.11 until one of the addresses in the NAT pool becomes free.
Note: A wildcard addressing scheme is used in the NAT statement. This statement tells the PIX to translate any internal source address when it goes out to the Internet. The address in this command can be more specific if desired.
In this example, the ISP again provides the network manager with a range of addresses from 18.104.22.168 to 22.214.171.124 . The network manager decides to assign 126.96.36.199 to the inside interface on the Internet router and 188.8.131.52 to the outside interface of the PIX.
However, in this scenario, another private LAN segment is placed off of the Internet router. The network manager prefers not to waste addresses from the global pool when hosts in these two networks talk to each other. The network manager still needs to translate the source address for all of the internal users (10.0.0.0/8) when it goes out to the Internet.
access-list 101 permit ip 10.0.0.0 255.0.0.0 192.168.1.0 255.255.255.0 global (outside) 1 184.108.40.206-220.127.116.11 netmask 255.255.255.224 nat (inside) 0 access-list 101 nat (inside) 1 10.0.0.0 255.0.0.0 0 0
This configuration does not translate those addresses with a source address of 10.0.0.0/8 and a destination address of 192.168.1.0/24. It translates the source address from any traffic initiated from within the 10.0.0.0/8 network and destined for anywhere other than 192.168.1.0/24 into an address from the range 18.104.22.168 through 22.214.171.124 .
When you use an access list with the nat command for any NAT ID other than 0, you enable policy NAT.
Policy NAT allows you to identify local traffic for address translation by the specification of the source and destination addresses (or ports) in an access list. Regular NAT uses source addresses/ports only. Policy NAT uses both source and destination addresses/ports.
Note: All types of NAT support policy NAT except for NAT exemption (nat 0 access-list). NAT exemption uses an access control list in order to identify the local addresses, but differs from policy NAT in that the ports are not considered.
With policy NAT, you can create multiple NAT or static statements that identify the same local address as long as the source/port and destination/port combination is unique for each statement. You can then match different global addresses to each source/port and destination/port pair.
In this example, the network manager has to provide access for destination IP address 172.30.1.11 for port 80 (web) and port 23 (Telnet), but must use two different IP addresses as a source address. 126.96.36.199 is used as a source address for web and 188.8.131.52 is used for Telnet, and must convert all of the internal addresses, which are in the 10.0.0.0/8 range. The network manager can do this with:
access-list WEB permit tcp 10.0.0.0 255.0.0.0 172.30.1.11 255.255.255.255 eq 80 access-list TELNET permit tcp 10.0.0.0 255.0.0.0 172.30.1.11 255.255.255.255 eq 23 nat (inside) 1 access-list WEB nat (inside) 2 access-list TELNET global (outside) 1 184.108.40.206 255.255.255.224 global (outside) 2 220.127.116.11 255.255.255.224
- PIX Support Page
- Cisco PIX Firewall Software
- PIX Command Reference
- Requests for Comments (RFCs)
- Security Product Field Notices (including PIX)
- Technical Support & Documentation - Cisco Systems
|Updated: Oct 24, 2008||Document ID: 15243|