Sie sind auf Seite 1von 7

NAT on PIX/ASA

This is a list of links and documentation that you can use in order to improve your
skills when configuring and troubleshooting different problems on the PIX/ASA
that includes NAT.

http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_tech_note09
186a00800b6e1a.shtml

https://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_tech_note0
9186a00804708b4.shtml

http://www.cisco.com/en/US/products/ps6120/products_configuration_example09
186a008046f31a.shtml

http://www.cisco.com/en/US/products/hw/vpndevc/ps2030/products_configuratio
n_example09186a00808c9950.shtml

http://www.cisco.com/en/US/docs/security/asa/asa72/configuration/guide/cfgnat.h
tml

http://www.cisco.com/en/US/products/ps6120/products_configuration_example09
186a00805734ae.shtml

You can also read the chapters 1 through 8 from the book “Cisco ASA, PIX, and
FWSM Firewall Handbook”. These chapters will give you a better idea of how the
ASA and the PIX works.

It is also important that you reinforce what you read with lab practices. You can
reserve equipment from the lab when you need it for you to practice. ONLY BY
READING YOU WILL NOT LEARN TO CONFIGURE IT. If you need to practice
at home you can use PEMU or GNS3.

I will be testing you with a practice that includes NAT on the PIX/ASA as well as
basic VPN configurations, L2L and RA.
Nat

In this example, the ISP provides the network manager with a range of addresses (for
example, 172.16.1.1 to 172.16.1.63). (ISP issues the Public IP addresses. But for the sake
of discussion, this document uses Private IP addresses.) The network manager decides to
assign 172.16.1.1 to the inside interface on the Internet router, and 172.16.1.2 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 172.16.1.3-172.16.1.62 netmask 255.255.255.192


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 172.16.1.3 through 172.16.1.62.

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.

Multiple Global Pools


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 172.16.1.1 through 172.16.1.62 and 172.20.1.1 through
172.20.1.254 . The network manager can do this with:

global (outside) 1 172.16.1.3-172.16.1.62 netmask 255.255.255.192


global (outside) 1 172.20.1.1-172.20.1.254 netmask 255.255.255.0
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.
Mix NAT and PAT Global Statements
In this example, the ISP provides the network manager with a range of addresses from
172.16.1.1 through 172.16.1.63 for the company to use. The network manager has
decided to use 172.16.1.1 for the inside interface on the Internet router and 172.16.1.2 for
the outside interface on the PIX. You are then left with 172.16.1.3 through 172.16.1.62 to
use for the NAT pool. However, the network manager knows that, at any one time, there
can be more than 60 people that try to go out of the PIX. The network manager has
decided to take 172.16.1.62 and make it a PAT address so that multiple users can share
one address at the same time.

global (outside) 1 172.16.1.3-172.16.1.61 netmask 255.255.255.192


global (outside) 1 172.16.1.62 netmask 255.255.255.192
nat (inside) 1 0.0.0.0 0.0.0.0 0 0

These commands instruct the PIX to translate the source address to 172.16.1.3 through
172.16.1.61 for the first 59 internal users to pass across the PIX. After these addresses are
exhausted, the PIX then translates all subsequent source addresses to 172.16.1.62 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.

Multiple NAT Statements with NAT 0 Access-List


In this example, the ISP again provides the network manager with a range of addresses
from 172.16.1.1 through 172.16.1.63 . The network manager decides to assign 172.16.1.1
to the inside interface on the Internet router and 172.16.1.2 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 172.16.1.3-172.16.1.62 netmask 255.255.255.192
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 172.16.1.3 through 172.16.1.62 .
If you have the output of a write terminal command from your Cisco device, you can
use the Output Interpreter Tool ( registered customers only) .

Use Policy NAT


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. 172.16.1.3 is used as a source address for web and
172.16.1.4 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 172.16.1.3 255.255.255.192
global (outside) 2 172.16.1.4 255.255.255.192

There are two policies that are required in order to allow outbound access with NAT
control. The first one is a translation method. This can be a static translation with the use
of the static command, or a dynamic translation with the use of a nat/global rule. This is
not required if NAT control is disabled and your inside hosts have public addresses.

The other requirement for outbound access (which applies whether NAT control is
enabled or disabled), is if there is an access control list (ACL) present. If an ACL is
present, then it must allow the source host access to the destination host with the use of
the specific protocol and port. By default, there are no access restrictions on outbound
connections through the PIX. This means that if there is no ACL configured for the
source interface, then by default, the outbound connection is allowed if there is a
translation method configured.

Allow Inside Hosts Access to Outside Networks with NAT

This configuration gives all of the hosts on the subnet 10.1.6.0/24 access to the outside.
In order to accomplish this, use the nat and global commands as this procedure
demonstrates.

1. Define the inside group you want to include for NAT.


2. nat (inside) 1 10.1.6.0 255.255.255.0
3. Specify a pool of addresses on the outside interface to which the hosts defined in
the NAT statement are translated.
4. global (outside) 1 172.16.1.5-172.16.1.10 netmask 255.255.255.0

Allow Inside Hosts Access to Outside Networks with the


use of PAT

If you want inside hosts to share a single public address for translation, use PAT. If the
global statement specifies one address, that address is port translated. The PIX allows one
port translation per interface and that translation supports up to 65,535 active xlate
objects to the single global address. Complete these steps in order to allow inside hosts
access to outside networks with the use of PAT.

1. Define the inside group you want to include for PAT (when you use 0 0, you
select all inside hosts.)
2. nat (inside) 1 10.1.6.0 255.255.255.0
3. Specify the global address you want to use for PAT. This can be the interface
address.

global (outside) 1 172.16.1.4 netmask 255.255.255.0

4. In ASDM, choose Configuration > Features > NAT and uncheck Enable traffic
through the firewall without address translation.
5. Click Add in order to configure the NAT rule.
6. Choose Manage Pools in order to configure your PAT address.
7. Choose Outside > Add and click Port Address Translation (PAT) in order to
configure a single address for PAT.
8. Enter an address, a Pool ID, and click OK.

There are a few things to consider when you use PAT.

• The IP addresses you specify for PAT cannot be in another global address pool.
• PAT does not work with H.323 applications, caching nameservers, and Point-to-
Point Tunneling Protocol (PPTP). PAT works with Domain Name Service (DNS),
FTP and passive FTP, HTTP, mail, remote-procedure call (RPC), rshell, Telnet,
URL filtering, and outbound traceroute.
• Do not use PAT when you need to run multimedia applications through the
firewall. Multimedia applications can conflict with port mappings that PAT
provides.
• In PIX software release 4.2(2), the PAT feature does not work with IP data packets
that arrive in reverse order. PIX software release 4.2(3) corrects this problem.
• IP addresses in the pool of global addresses specified with the global command
require reverse DNS entries in order to ensure that all external network addresses
are accessible through the PIX. In order to create reverse DNS mappings, use a
DNS Pointer (PTR) record in the address-to-name mapping file for each global
address. Without the PTR entries, sites can experience slow or intermittent
Internet connectivity and FTP requests fail consistently.

For example, if a global IP address is 192.168.1.3 and the domain name for the
PIX Security Appliance is pix.caguana.com, the PTR record is:

3.1.1.175.in-addr.arpa. IN PTR
pix3.caguana.com
4.1.1.175.in-addr.arpa. IN PTR
pix4.caguana.com & so on.

Restrict Inside Hosts Access to Outside Networks

Allow Untrusted Hosts Access to Hosts on Your Trusted


Network
Most organizations need to allow untrusted hosts access to resources in their trusted
network. A common example is an internal web server. By default, the PIX denies
connections from outside hosts to inside hosts. In order to allow this connection in NAT
control mode, use the static command, with access-list and access-group commands. If
NAT control is disabled, only the access-list and access-group commands are required, if
no translation is performed.

Apply ACLs to interfaces with an access-group command. This command associates the
ACL with the interface to examine traffic that flows in a particular direction.

In contrast to the nat and global commands which allow inside hosts out, the static
command creates a two-way translation that allows inside hosts out and outside hosts in if
you add the proper ACLs/groups.

In the PAT configuration examples shown in this document, if an outside host tries to
connect to the global address, it can be used by thousands of inside hosts. The static
command creates a one-to-one mapping. The access-list command defines what type of
connection is allowed to an inside host and is always required when a lower security host
connects to a higher security host. The access-list command is based on both port and
protocol and can be very permissive or very restrictive, based on what the system
administrator wants to achieve.

The network diagram in this document illustrates the use of these commands in order to
configure the PIX to allow any untrusted hosts to connect to the inside web server, and
allow untrusted host 192.168.1.1 access to an FTP service on the same machine.

Use ACLs on PIX Versions 7.0 and Later

Complete these steps for PIX software versions 7.0 and later with the use of ACLs.

1. If NAT control is enabled, define a static address translation for the inside web
server to an outside/global address.
2. static (inside, outside) 172.16.1.16 10.16.1.16
3. Define which hosts can connect on which ports to your web/FTP server.
4. access-list 101 permit tcp any host 172.16.1.16 eq www
access-list 101 permit tcp host 192.168.1.1 host 172.16.1.16 eq
ftp

5. Apply the ACL to the outside interface.

access-group 101 in interface outside

6. Choose Configuration > Features > NAT and click Add in order to create this
static translation with the use of ASDM.