Chapter 11. Implementing and Configuring Network Address Translation (NAT)

This chapter covers the following subject:

• Network Address Translation (NAT): Describes the different types of NAT available and discusses how to configure them to meet the requirements of modern networks.

The use of Network Address Translation (NAT) is widespread; it is used by millions of people every day, most without knowing it. The understanding of how NAT works is a vital part of securing a network because so many networks use its abilities. This chapter reviews the different types of NAT that are available and displays examples of how each of them would be configured in operation.

“Do I Know This Already?” Quiz

The “Do I Know This Already?” quiz helps you decide whether you really need to read the entire chapter. If you already intend to read the entire chapter, you do not necessarily need to answer these questions now.

The nine-question quiz, derived from the major sections in the “Foundation Topics” section of this chapter, helps you determine how to spend your limited study time.

Table 11-1 outlines the major topics discussed in this chapter and the “Do I Know This Already?” quiz questions that correspond to those topics.

Table 11-1. “Do I Know This Already?” Foundation Topics Section-to-Question Mapping

image

Caution

The goal of self-assessment is to gauge your mastery of the topics in this chapter. If you do not know the answer to a question or are only partially sure of the answer, you should mark this question wrong for purposes of the self-assessment. Giving yourself credit for an answer that you correctly guess skews your self-assessment results and might provide you with a false sense of security.

1. Which of the following are potential limitations of using NAT?

a. Embedding address complications

b. Private address support complications

c. Logging complications

d. Overlapping address complications

2. Which of the following are valid NAT interface types?

a. Inside

b. Internet

c. Outside

d. Broadcast

3. Which of the following NAT address types displays the address of the internal host as seen by external hosts?

a. Outside global address

b. Inside local address

c. Outside local address

d. Inside global address

4. Which of the following NAT types has a one-to-one relationship without a specific external address?

a. Static

b. Dynamic

c. Overloaded

d. Overlapping

5. Which command is used to configure static NAT?

a. ip nat inside source static local-ip remote-ip

b. ip nat inside source static remote-ip local-ip

c. ip nat inside static source local-ip remote-ip

d. ip nat inside static source remote-ip local-ip

6. Which command is used to configure a NAT pool?

a. ip nat pool pool-name ip-address [netmask mask | prefix-length prefix-length]

b. nat pool pool-name start-ip end-ip [netmask mask | prefix-length prefix-length]

c. nat pool pool-name ip-address [netmask mask | prefix-length prefix-length]

d. ip nat pool pool-name start-ip end-ip [netmask mask | prefix-length prefix-length]

7. Which of the following can be used as an alternative name for Port Address Translation?

a. Dynamic NAT

b. Static NAT

c. Overloaded NAT

d. Overlapping NAT

8. What is the default translation timeout when using dynamic NAT?

a. 60 minutes

b. 24 hours

c. 5 minutes

d. 10 minutes

9. Which command is used to configure an overlapping NAT configuration?

a. ip nat outside source static local-ip remote-ip

b. ip nat inside source static local-ip remote-ip

c. ip nat outside source static remote-ip local-ip

d. ip nat inside source static remote-ip local-ip

The answers to the “Do I Know This Already?” quiz are found in Appendix A. The suggested choices for your next step are as follows:

• 7 or less overall score: Read the entire chapter. This includes the “Foundation Topics” and the “Exam Preparation” sections.

• 8 or 9 overall score: If you want more review on these topics, skip to the “Exam Preparation” section.

Foundation Topics

Network Address Translation

Network Address Translation (NAT) provides the capability to translate one set of addresses to another; typically, this is done with internal private addresses and external public addresses. This can be used for a number of different reasons, including the ability to separate an internal network from an external one and the ability to translate an entire internal network to a few external addresses. In an environment where the number of Internet users continues to rise at a high rate, the number of IPv4 addresses available to be used has dwindled; it is only through the wide-scale implementation of NAT that has, up to this point, made the continued use of IPv4 addresses still a viable solution.

NAT can be used for many purposes, including the following:

• Address migration: If an organization is changing the way that its addresses are organized, an easy way to maintain connectivity is through the use of NAT during the migration.

• Private address use: In many organizational networks, it is an advantage to use private address space to have the most addressing flexibility. In these situations, it is required to translate these addresses to global public addresses for public (Internet) traffic.

• Address overlap: In some situations, an organization could be using other companies’ legitimate public addresses for internal addressing. When these organizations connect to a public network, an address conflict can occur.

• Load sharing: It is possible to configure NAT to map a single external address to multiple internal devices; this is used to spread the load of network traffic and processing capability.

As with any technology, the use of NAT can introduce problems because some technologies do not support the use of NAT. These limitations include

• Embedding address complications: For the correct operation of NAT, it must understand the source and destination address information for each conversation. Some protocols obscure this information, which can be troublesome.

• Encryption and authorization protocol support: Because the point in many of these protocols is to ensure that a packet has not been interfered with in transit, the use of NAT in itself already breaks this requirement because it alters the original packet. Some protocols are likely to fail in situations where traffic traverses a NAT device.

• Logging complications: The use of NAT can complicate the way to view and interpret logs. As the address that is used for a specific packet changes from an inside to outside interface, this must be considered when using logging.

With typical NAT implementations, an inside and outside interface is defined. Each interface is described in Table 11-2 and illustrated in Figure 11-1.

image

Table 11-2. NAT Interface Types

image

Figure 11-1. NAT Interfaces

image

Along with the NAT interfaces, there are definitions for the different addresses that are used. The typical NAT implementation includes a single internal (local) stub host (or network) that requires translation to an external (global) network. In this situation, the internal network address is referred to as the inside local address, and the address used by this host as it appears on the external network is called the inside global address. There is also an outside local address and outside global address. The outside local address is the address of the destination host address as seen by the local host, and the outside global address is the address as it was originally assigned. Table 11-3 describes these addresses.

image

Table 11-3. NAT Address Types

image

There are also three different types of NAT that can be configured. These include static, dynamic, and overloaded (Port Address Translation [PAT]) NAT, as described in Table 11-4. Static NAT is used when a single one-to-one mapping is required between inside and outside networks.

image

Table 11-4. NAT Types

image

Static NAT Example

Figure 11-2 shows an example of static NAT with a connection that is established between the internal host 192.168.1.1 and the external host 64.28.85.16. The external host sees traffic come from the internal host with an address of 209.202.161.1, and the internal host sees the external host traffic as coming from 64.28.85.16 (or the original address without translation).

Figure 11-2. NAT Addresses (Static NAT)

image

Dynamic NAT Example

Dynamic NAT is used to map an internal local address to outside addresses by utilizing an outside address pool; in this configuration, there is still a one-to-one address relationship.

Figure 11-3 shows an example of dynamic NAT, with two different connections that include traffic from hosts 192.168.1.1 and 192.168.1.2 going to two different remote hosts 64.28.85.16 and 64.28.85.25. The NAT pool is configured to give out addresses 209.202.161.1 through 209.202.161.10. These addresses from the pool are assigned on a first-come, first-served basis. The host 192.168.1.1 initiates a connection to remote host 64.28.85.16; being the first to request NAT services, the first address from this pool is assigned for use with 192.168.1.1. After this, a connection is initiated from host 192.168.1.2 to the remote host 64.28.85.25; being the second to request NAT services, the second address from the pool is assigned for use with 192.168.1.2. From the perspective of the remote hosts, traffic comes from the addresses 209.202.161.1 (192.168.1.1) and 209.202.161.2 (192.168.1.2). From the perspective of the local hosts, the traffic comes from its original host addresses 64.28.85.16 and 64.28.85.25.

Figure 11-3. Dynamic NAT

image

PAT Example

Overloading, or PAT, is a form of dynamic NAT where multiple internal addresses are mapped to outside addresses by mapping not only the address but also mapping a specific port. In this configuration, the relationship is many-to-one, and each traffic conversation is assigned a specific port on the outside address used. All traffic conversations are kept separate by NAT and redirected to the original source port by NAT.

Figure 11-4 shows an example of overloading NAT (PAT) with two different connections that include traffic from hosts 192.168.1.1 and 192.168.1.2 going to a single remote host at address 64.28.85.16. The NAT pool is configured to give out address 209.202.161.1. This address and port assignments come from the pool on a first-come, first-served basis. The host 192.168.1.1 initiates an HTTP connection to remote host 64.28.85.16; being the first to request NAT services, the first available address/port combination is assigned (209.202.161.1, port 1). After this, the host 192.168.1.2 initiates an HTTP connection to the remote host 64.28.85.16; being the second to request NAT services, the second available address/port combination is assigned (209.202.161.1, port 2). From the perspective of the remote host, both connections come from the same addresses 209.202.161.1 but from different source ports. When the remote host sends back traffic, it will be sent to these separate remote ports; this is how the NAT device differentiates connections. From the perspective of the local hosts, the traffic comes from its original host address 64.28.85.16 and original port.

Figure 11-4. Overloaded NAT (PAT)

image

NAT Configuration

The configuration of NAT requires that a few pieces of information be available, including the following:

image

• The type of NAT to be used

• The list of systems requiring NAT services

• The available addresses that can be used

• A list of potential problem network applications

• The location of each host in relation to the NAT device

Each NAT type requires a slightly different configuration that provides the correct NAT capabilities.

Figure 11-5 shows an example of a common configuration topology.

Figure 11-5. Common Configuration Topology

image

Static NAT Configuration

The configuration of static NAT requires a local address (inside local address) that will be translated and an external address (inside global address) that will be used in place of this local address on the outside network. Table 11-5 describes the different commands that are required to configure static NAT.

Table 11-5. Configuring Static NAT

image

Example 11-1 shows the configuration of static NAT. The fastethernet0/0 interface is the inside interface, and the fastethernet0/1 interface is the outside interface. The local IP address 172.16.1.100 (inside local address) will be translated on the outside network to address 209.202.161.100 (inside global address).

Example 11-1. Configuring Static NAT


Router# configure terminal
Router(config)# ip nat inside source static 172.16.1.100 209.202.161.100
Router(config)# interface fastethernet0/0
Router(config-if)# ip nat inside
Router(config-if)# interface fastethernet0/1
Router(config-if)# ip nat outside


Dynamic NAT Configuration

The configuration of dynamic NAT is different because it requires the local addresses (inside local addresses) that will be translated and the external addresses (inside global addresses) that will be used in place of these local addresses on the outside network. With dynamic NAT, the source addresses are identified through the use of a standard IP access control list (ACL). The addresses to be used as the external addresses will be defined in a NAT pool. Table 11-6 describes the different commands that are required to configure dynamic NAT.

Table 11-6. Configuring Dynamic NAT

image

Example 11-2 shows the configuration of dynamic NAT. The fastethernet0/0 interface is the inside interface, and the fastethernet0/1 interface is the outside interface. All addresses with a source address in the 172.16.1.0/24 network (inside local addresses) will be translated using NAT. The address range from 209.202.161.100 through 209.202.161.110 will be used for external addresses (inside global addresses); these are allocated in a first-come, first-served fashion. In this case, the first ten hosts that require a NAT translation will be successful, but the 11th host would be unsuccessful because no address would be available.

Example 11-2. Configuring Dynamic NAT


Router# configure terminal
Router(config)# access-list 1 permit 172.16.1.0 0.0.0.255
Router(config)# ip nat pool addresspool 209.202.161.100 209.202.161.110 prefix-
  length 24
Router(config)# ip nat inside source list 1 pool addresspool
Router(config)# interface fastethernet0/0
Router(config-if)# ip nat inside
Router(config-if)# interface fastethernet0/1
Router(config-if)# ip nat outside


Overloading NAT (PAT) Configuration

The configuration of overloading NAT is similar to that of dynamic NAT but works quite differently. When using overloading NAT, instead of having a one-to-one addressing relationship, multiple internal hosts share the same external address or addresses and are differentiated by the source port number allocated by the NAT device. As with dynamic NAT configuration, a standard IP access list is used to identify the source addresses to be translated. A pool is also configured with the available external addresses; however, unlike with dynamic NAT, a single address can be configured in the pool that can be used for multiple internal hosts. Table 11-7 describes the different commands that are required to configure PAT.

Table 11-7. Configuring PAT

image

Example 11-3 shows the configuration of overloading NAT. The fastethernet0/0 interface is the inside interface, and the fastethernet0/1 interface is the outside interface. All addresses with a source address in the 17216.1.0/24 network (inside local addresses) will be translated using NAT. The address 209.202.161.100 will be used for the external address (inside global address). With each connection translated, a different source port number is assigned using the address in the pool; this enables the NAT device to distinguish the connections from each other.

Example 11-3. Configuring Overloading NAT


Router# configure terminal
Router(config)# access-list 1 permit 172.16.1.0 0.0.0.255
Router(config)# ip nat pool addresspool 209.202.161.100 209.202.161.100 prefix-
  length 24

Router(config)# ip nat inside source list 1 pool addresspool overload
Router(config)# interface fastethernet0/0
Router(config-if)# ip nat inside
Router(config-if)# interface fastethernet0/1
Router(config-if)# ip nat outside


NAT Timer Configuration

The amount of time that a specific NAT translation entry is assigned depends on the type of NAT that has been configured. By default, translation entry timeout is 24 hours with dynamic NAT. With overloading NAT, the translation entry timeout period depends on the specific protocol being translated. By default, the timeouts described in Table 11-8 are used.

image

Table 11-8. Overloading NAT Timeouts

image

To change the timeouts from their defaults, use the commands outlined in Table 11-9.

Table 11-9. Configuring NAT Timeouts

image

Overlapping NAT

With overlapping NAT, the internal addresses used could potentially overlap with external addresses (this is typical if internal addressing was assigned before an Internet connection was considered); this requires that the NAT configuration be altered. This is because with a typical NAT configuration, the internal network hosts see the unaltered external addresses. If there is an overlap and a connection is attempted to a remote device with one of the overlapping addresses, there will be a connection problem. The typical connection setup for a host would be to perform a DNS lookup of the specific external host. If no extra configuration is given, the address returned will be an address that the internal host sees as being on the internal network; a connection will then be attempted but to the internal host with the same overlapping address. Overlapping NAT configuration offers a solution to this problem. When configured, the NAT device will monitor the DNS traffic to and from the configured overlapping address or addresses. When a conflict occurs, the NAT device will alter the DNS response so that the internal client will not see it as a conflict. Traffic going to the altered DNS response IP will then be translated back as the connection is established.

Figure 11-6 shows a configuration where the internal host A has an address of 192.168.1.1 that conflicts with an external host C address, which is also assigned 192.168.1.1. When host A performs a DNS lookup for host C, the DNS response will be altered so that the internal host sees the address for host C as being 172.16.1.1. Traffic from host A will then be directed at 172.16.1.1 for host C, which is translated again on the NAT device to 192.168.1.1.

Figure 11-6. Overlapping NAT

image

The end result of this example would be that the traffic from host A to the NAT device would be using addresses 192.168.1.1 (host A) and 172.16.1.1; the traffic from the NAT device to host C would be using addresses 209.202.161.1 and 192.168.1.1 (host C). The translation happens in two different directions: outbound (toward host C) through the first command and inbound (toward host A) by the second command.

Tip

Trying to get your head around overlapping address examples can be difficult. The best way to get it straight is to perform a test in a lab environment.

Overlapping NAT Configuration

The configuration of overlapping NAT can be confusing because the configuration uses aspects of a typical NAT configuration as well as the configuration dealing with the overlapping address problems.

The configurations specific to the overlapping address problem are covered here because the other aspect of the configuration is covered in detail in previous sections. The configuration of an outside NAT command is similar to that of the inside NAT command, except instead of altering the inside source addresses to appear differently to the outside, the outside addresses are altered to appear differently to the inside. The other difference is in how the NAT device automatically alters DNS responses; this is not part of the inside NAT commands.

The overlapping NAT configuration can be configured statically or dynamically, as with typical NAT configurations.

Table 11-10 describes the different commands that are required to configure overlapping NAT.

Table 11-10. Configuring Overlapping NAT

image

Example 11-4 shows the configuration of overlapping dynamic NAT. In this example, all traffic from the outside interface (outside global addresses) will be translated to all inside hosts as from the 172.16.1.1–172.16.1.10 range (outside local addresses).

Example 11-4. Configuring Overlapping Dynamic NAT


Router# configure terminal
Router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
Router(config)# ip nat pool addresspool 172.16.1.1 172.16.1.10 prefix-length 24
Router(config)# ip nat outside source list 1 pool addresspool
Router(config)# interface fastethernet0/0
Router(config-if)# ip nat inside
Router(config-if)# interface fastethernet0/1
Router(config-if)# ip nat outside


Exam Preparation

As mentioned in the section, “How to Use This Book,” in the Introduction, you have several choices for exam preparation: the exercises here, the memory tables in Appendix C, the final exam preparation chapter, and the exam simulation questions on the CD-ROM. The following questions present a bigger challenge than the exam itself because they use an open-ended question format. By using this more difficult format, you exercise your memory better and prove your conceptual and factual knowledge of this chapter. You can find the answers to these questions in Appendix A, “Answers to the DIKTA Quizzes and Fill in the Blanks Questions.”

Review All Key Topics

Review the most important topics in the chapter, noted with the Key Topics icon in the margin of the page. Table 11-11 lists a reference of these key topics and the page numbers on which each is found.

Table 11-11. Key Topics

image

Complete Tables and Lists from Memory

Print a copy of Appendix C, “Memory Tables” (found on the CD), or at least the section for this chapter, and complete the tables and lists from memory. Appendix D, “Memory Table Answers,” also on the CD, includes completed tables and lists to check your work.

Define Key Terms

Define the following key terms from this chapter, and check your answers in the Glossary:

inside local address

inside global address

outside local address

outside global address

static NAT

dynamic NAT

PAT

Use Command Reference to Check Your Memory

Table 11-12 lists the important commands from this chapter. To test your memory, cover the right side of the table with a piece of paper, read the description on the left side, and then see how much of the command you can remember.

Table 11-12. Command Reference

image

image

Fill in the Blanks

  1. A typical NAT implementation includes a single _____ stub host that requires translation to an _____ network.
  2. Three different types of NAT can be configured: _____, _____, and _____.
  3. _____ has a many-to-one relationship with traffic conversations being differentiated by port number.
  4. The configuration of _____ requires a local address that will be translated and an external address that will be used in place of this local address on the external network.
  5. With dynamic NAT, the source address(es) is/are identified through the use of a _____.
  6. By default, the translation entry timeout is _____ with dynamic NAT.
  7. In a typical NAT configuration, the internal network hosts see the external host address _____.