Home > Articles > Cisco Certification > CCNP > CCNP Self-Study: Advanced IP Addressing

CCNP Self-Study: Advanced IP Addressing

  • Sample Chapter is provided courtesy of Cisco Press.
  • Date: Jun 11, 2004.

Network Address Translation

IP address depletion is a key problem facing the Internet. To assist in maximizing the use of registered IP addresses, Cisco IOS Release 11.2 and later implement NAT. This feature, which is Cisco's implementation of RFC 1631, The IP Network Address Translator (available at http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1631.html), is a solution that provides a way to use the same IP addresses in multiple internal stub networks, thereby reducing the need for registered IP addresses.

NAT is an important function in most scalable networks and is mandatory for the majority of companies that have Internet connections. ISPs have hundreds of users accessing the Internet, yet commonly are assigned only 8 or 16 individual addresses. The ISPs use NAT to map the hundreds of inside addresses to the few globally unique addresses assigned to that company. After introducing NAT terminology and features, this section demonstrates the following:

  • How to use basic NAT and a standard access list to assign separate address space to different users.

  • How to use an extended access list to check a packet's destination address and assign different source addresses based on it.

  • How to use a Cisco IOS software tool called a route map to create a fully extended address translation in an IP NAT table. The IP NAT table tracks the original address and its translation as well as the destination address and the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) ports for each.

NAT Terminology and Features

This section first introduces the terminology that is necessary to understand NAT and then explains NAT's various features.

NAT Terminology

The terms inside network and outside network are used with NAT, as shown in Figure 1-21. NAT terminology, as used in Figure 1-21, is defined in Table 1-3.

Figure 21Figure 1-21 Network Address Translation Is Used to Translate Addresses Between the Inside and Outside Networks

Table 1-3 NAT Terminology

Term

Definition

Inside local IP address (A)

The IP address assigned to a host on the inside network. (The address was either globally unique but obsolete, allocated from RFC 1918, or randomly picked.)

Inside global IP address (B)

A legitimate IP address (typically assigned by a service provider) that represents one or more inside local IP addresses to the outside world. (The address was allocated from a globally unique address space, typically provided by the ISP.)

Outside global IP address (C)

The IP address that was assigned to a host on the outside network by its owner. (The address was allocated from a globally routable address space.)

Outside local IP address (not shown)

The IP address of an outside host as it appears to the inside network. (The address was allocated from address space routable on the inside or possibly was allocated from RFC 1918, for example.) An example of when an outside local IP address is required is given in the "Handling Overlapping Networks" sidebar later in this section.

Simple translation entry

A translation entry that maps one IP address to another. This is the type of entry shown in the NAT table in Figure 1-21.

Extended translation entry (not shown)

A translation entry that maps one IP address and port pair to another.


A NAT entry is built in the IP NAT table as the packet goes from an IP NAT inside interface. A NAT entry usually changes the source IP address in the packet from an inside address to an outside address. When a device on the outside responds to the packet, the destination IP address of the returning packet is compared to the entries in the IP NAT table. If a match is found, the destination IP address is translated to the correct inside address and is sent to the routing table to be routed to the correct IP NAT inside interface. If no match is found, the packet is discarded.

NAT is performed when a packet is routed between the following interfaces:

  • IP NAT inside interface to an IP NAT outside interface

  • IP NAT outside interface to an IP NAT inside interface

A NAT table may contain the following information:

  • Protocol—IP, TCP, or UDP.

  • Inside local IP address:port—The IP address and port number used by the inside host before any translations. The inside local IP address is usually the private addressing defined in RFC 1918.

  • Inside global IP address:port—The IP address and port number used by the inside host as it appears to the outside network; this is the translated IP address and port. Addresses are allocated from a globally unique address space, typically provided by the ISP if the enterprise connects to the global Internet.

  • Outside global IP address:port—The configured globally unique IP address assigned to a host in the outside network, and the port number used.

  • Outside local IP address:port—The IP address and port number of an outside host as it appears to the inside network.

NOTE

Simple NAT entries consist of only the inside local IP address and the inside global IP address.

Features Supported by NAT

Supported NAT features include the following:

  • Static address translation—Establishes a one-to-one mapping between inside local and global addresses.

  • Dynamic source address translation—Establishes a dynamic mapping between the inside local and global addresses. This is accomplished by describing the local addresses to be translated, the pool of addresses from which to allocate global addresses, and associating the two. The router creates translations as needed.

  • Address overloading—Can conserve addresses in the inside global address pool by allowing source ports in TCP connections or UDP conversations to be translated. When different inside local addresses map to the same inside global address, each inside host's TCP or UDP port numbers are used to distinguish between them.

When the router determines that a packet's path is from an IP NAT inside interface to an IP NAT outside interface, an entry is built to include both the original source IP address and the original TCP for UDP port number. Each of these entries is assigned a unique TCP/UDP source port number to distinguish it from the others. When a packet returns to the IP NAT outside interface, it is compared to the IP NAT table. Although the packet destination address could match thousands of entries, NAT checks the destination TCP/UDP port for the correct entry for the returning packet. After the correct entry is found, the current destination address and port number change to the appropriate IP NAT inside destination address and port number.

  • TCP load distribution—A dynamic form of destination translation that can be configured for some outside-to-inside traffic. After a mapping is defined, destination addresses matching an access list are replaced with an address from a rotary pool. Allocation is done on a round-robin basis, and only when a new connection is opened from the outside to the inside. All non-TCP traffic is passed untranslated (unless other translations are in effect).

Handling Overlapping Networks

Figure 1-22 illustrates NAT operation when addresses in the inside network overlap with addresses that are in the outside network; in this case, outside local IP addresses are used.

Figure 22Figure 1-22 Handling Overlapping Networks

The following describes this process of handling overlapping addresses:

Step 1

The user at 10.1.1.1 opens a connection to Host C (10.1.1.3), causing 10.1.1.1 to perform a name-to-address lookup to a DNS server.

Step 2

If there is an overlap, the router intercepts the DNS reply and translates the returned address. In this case, 10.1.1.3 overlaps with an inside address. To translate the return address of Host C, the router creates a simple translation entry that maps the overlapping address 10.1.1.3 to an address from a separately configured outside local address pool. In this example, the address is 172.17.3.3.

Step 3

The router forwards the DNS reply to Host 10.1.1.1. The reply has Host C's address as 172.17.3.3. At this point, 10.1.1.1 opens a connection to 172.17.3.3.

Step 4

When the router receives the packet for Host C (172.17.3.3), it sets up a translation that maps the inside local and global addresses and the outside global and local addresses by replacing the source address of 10.1.1.1 with the inside global address 172.16.2.2 and replacing the destination address of 172.17.3.3 with Host C's outside global address, 10.1.1.3.

Step 5

Host C receives a packet and continues the conversation.

Step 6

For each packet sent between Host 10.1.1.1 and Host C, the router performs a lookup, replaces the destination address with the inside local address, and replaces the source address with the outside local address.


Configuring NAT with Access Lists

This section explains the IP NAT commands to configure IP NAT with access lists. It provides a sample IP NAT configuration and two specific examples of configuring IP NAT with access lists. The first example demonstrates how to use access lists to determine whether an IP address needs translation based on the original source address. The second example demonstrates how to use an access list to assign a NAT source IP address based on the source and destination addresses of the original packet.

The following commands are used to configure IP NAT with access lists:

  • ip nat {inside | outside}—This interface configuration command marks the IP networks attached to that interface as either internal or external to the controlled network. Only packets arriving on an interface marked as IP NAT inside or outside are subject to translation.

  • ip nat inside source list {access-list-number | access-list-name} pool pool-name—When a packet comes in on an interface marked as IP NAT inside, this global configuration command causes the router to compare the source IP address in the packet to the access list referenced in the command. The access list indicates whether the router should translate that source IP address to the next available address in the pool-name listed. NAT translates an address that is permitted in the access list. Addresses that are not permitted by the access list are not translated, and the packet is routed normally.

  • ip nat pool pool-name starting-ip-address ending-ip-address {prefix-length prefix-length | netmask netmask}—This global configuration command creates the translation pool referenced by the previous command. This command includes the starting and ending addresses for translation and either the prefix length or network mask associated with this range of addresses.

Standard Access List Translation Example

In Figure 1-23, when an IP packet comes in on Ethernet 0 of Router A with a source address of 10.1.2.x, the router translates it from the NAT pool of addresses defined by the name sale_pool. If the packet has a source address of 10.1.3.x, the router translates it from the NAT pool of addresses defined by the name acct_pool.

In this example, the Information Services (IS) department maps different groups of users to different blocks of NAT addresses. The IS department determines the percentage of users per department who can use the NAT interface and assigns an appropriate number of addresses. The percentage of users can typically be determined using accounting or security software.

Figure 23Figure 1-23 Translating with Standard Access Lists

Extended Access List Translation Example

The network used in this example is the same as that shown in Figure 1-23. However, in this configuration example, the extended access lists 102 and 103 are used to control NAT decisions. Instead of making the decision based only on the source address, an extended access list makes the decision based on the source and destination addresses of all packets coming in on interface Ethernet 0.

The configuration used on Router A is shown in Example 1-2.

Example 1-2 NAT Example Using Extended Access Lists on Router A in Figure 1-23

In this example, if the packet is not from the 10.1.1.0/24 subnet, the packet's source IP address is not translated. If the packet is from the 10.1.1.0/24 subnet and the destination address matches either 172.16.1.0/24 or 192.168.200.0/24, the source IP address is translated to the next available address in the trusted_pool, which is the 192.168.2.0/24 network.

If the packet is from the 10.1.1.0/24 subnet and the destination address does not match either 172.16.1.0/24 or 192.168.200.0/24, the source IP address is translated to the next available address in the untrusted_pool, which is the 192.168.3.0/24 network.

In this example, the outside NAT environment has both trusted and untrustworthy sites. For example, the company might be attached to an industry internetwork where it exchanges information with corporate partners and competitors. 172.16.1.0/24 and 192.168.200.0/24 are addresses of trusted networks on the industry internetwork, but all other destination addresses are considered untrustworthy. (A firewall system may also be added to allow greater control over the trusted sites.)

Configuring NAT with Route Maps

A route map is a Cisco IOS software function that serves a variety of purposes. This section explains route maps and compares the results of using NAT with a route map to the results of using NAT with only an access list.

NOTE

Route maps are discussed in more detail in Chapter 7, "Manipulating Routing Updates."

When you use only access lists for NAT, as described in the previous section, the resulting NAT table has only simple translation entries, identifying only which inside local address is being translated to which inside global address. Example 1-3 shows simple translation entries using the show ip nat translations command. The simple translation entry contains only local and global IP address entries. It does not include any TCP or UDP port information or the packet's destination address.

Example 1-3 Simple IP Address Translation Entries

The entries in this IP NAT translation table are called simple entries because they track only the original source address (the inside local address) and the address to which it is translated (the inside global address). The other fields in the table are left blank. It is difficult to troubleshoot connectivity using simple address entries, because you do not see the destination address or the application (port) associated with each NAT translation. This might also prevent proper translation among multiple address pools. The first address pool matched creates a simple NAT entry; a second session initiated by the same source to a different host already matches the simple entry, thereby preventing proper translation to the second address pool. (Configuration Exercise 1-2, at the end of this chapter, includes an example of this translation problem.)

To get an extended translation entry in the NAT table, you must either configure NAT for overloading (using the overload keyword on the ip inside source command) or use a Cisco IOS software tool called a route map. Example 1-4 shows an example of an extended translation entry. The extended translation entry identifies the source and destination addresses with their appropriate translations, the transport layer protocol used, and the port (or application) used for the session.

Example 1-4 IP Address Translation with Route Maps

Understanding Route Maps

Route maps are complex access lists that allow some conditions to be tested against the packet or route in question using match commands. If the conditions match, some actions can be taken to modify attributes of the packet or route. These actions are specified by set commands.

A collection of route map statements that have the same route map name are considered one route map. Within a route map, each route map statement is numbered and therefore can be edited individually.

The statements in a route map correspond to the lines of an access list. Specifying the match conditions in a route map is similar to specifying the source and destination addresses and masks in an access list.

Key Point: Route Maps Versus Access Lists

One big difference between route maps and access lists is that route maps can modify the route by using set commands.

The route-map map-tag [permit | deny] [sequence-number] global configuration command can be used to define the conditions for NAT. This command is explained in detail in Table 1-4.

Table 1-4 route-map Command

Command

Description

map-tag

Name of the route map

permit | deny

Optional parameter that specifies the action to be taken if the route map match conditions are met

sequence-number

Optional sequence number that indicates the position that a new route map statement will have in the list of route map statements already configured with the same name


The default for the route-map command is permit, with a sequence-number of 10.

Route Map Sequence Numbering

If you leave out the sequence number when configuring all statements for the same route map name, the router will assume that you are editing and adding to the first statement, sequence number 10. Route map sequence numbers do not automatically increment!

A route map may be made up of multiple route map statements. The statements are processed top-down, similar to an access list. The first match found for a route is applied. The sequence number is used for inserting or deleting specific route map statements in a specific place in the route map.

The match condition route map configuration commands are used to define the conditions to be checked. The set condition route map configuration commands are used to define the actions to be followed if there is a match and the action to be taken is permit. (The consequences of a deny action depend on how the route map is being used.)

A single match statement may contain multiple conditions. At least one condition in the match statement must be true for that match statement to be considered a match. A route map statement may contain multiple match statements. All match statements in the route map statement must be considered true for the route map statement to be considered matched.

Key Point: Route Map Match Conditions

Only one match condition listed on the same line must match for the entire line to be considered a match.

For example, IP standard or extended access lists can be used to establish match criteria using the match ip address {access-list-number | name} [...access-list-number | name] route map configuration command. (If multiple access lists are specified, matching any one results in a match.) A standard IP access list can be used to specify match criteria for a packet's source address; extended access lists can be used to specify match criteria based on source and destination addresses, application, protocol type, type of service (ToS), and precedence.

The sequence number specifies the order in which conditions are checked. For example, if two statements in a route map are named MYMAP, one with sequence 10 and the other with sequence 20, sequence 10 is checked first. If the match conditions in sequence 10 are not met, sequence 20 is checked.

Like an access list, an implicit deny any appears at the end of a route map. The consequences of this deny depend on how the route map is being used.

Another way to explain how a route map works is to use a simple example and see how a router would interpret it. Example 1-5 shows a sample route map configuration. (Note that on a router, all the conditions and actions shown would be replaced with specific conditions and actions, depending on the exact match and set commands used.)

Example 1-5 route-map Command

The route map named demo in Example 1-5 is interpreted as follows:

NAT with Route Maps Example

The ip nat inside source route-map route-map-name pool pool-name global configuration command causes the router to compare the source IP address in the packet to the route map referenced in the command. The route map indicates whether the router should translate that source IP address to the next available address in the pool-name listed. NAT translates an address that is matched in the route map.

Example 1-6 provides an alternative configuration for Router A in Figure 1-23. Two route maps have been added to the configuration shown in Figure 1-23. In this example, the what_is_sales_doing route map is linked to the sales_pool using the ip nat inside source route-map what_is_sales_doing pool sales_pool command.

Example 1-6 Alternative Configuration for Router A in Figure 1-23

Following the path of a packet through this configuration is the best way to understand it. An IP packet with a source address of 10.1.2.100 arrives on interface Ethernet 0, which is an IP NAT inside interface. The ip nat inside source route-map what_is_sales_doing pool sales_pool command causes the router to send the packet to the what_is_sales_doing route map. Sequence 10 of this route map matches the packet's source IP address, 10.1.2.100, against access list 2, which permits the packet and therefore matches the route map. The router then queries the NAT pool sales_pool and obtains the next address to which to translate the 10.1.2.100 packet.

The what_is_acct_doing route map together with the ip nat inside source route-map what_is_acct_doing pool acct_pool command causes the router to look for source IP addresses in the 10.1.3.0/24 range and change them to source IP addresses in the 192.168.3.0/24 range.

As discussed, to examine the IP NAT translation table, use the show ip nat translations command. When using just an access list (as in the configuration shown in Figure 1-23), the router creates only a simple translation entry, one entry per application, without the TCP and UDP ports; Example 1-3 shows a simple translation entry. However, when using a route map, the router creates a fully extended translation entry in the IP NAT translation table, which includes the source and destination TCP or UDP port numbers. The extended translation entry shown in Example 1-4 results from the configuration in Example 1-6.

Notice in Example 1-4 that each session has individual entries; the IP address of each user and the applications in use can be determined from these entries. The local device with IP address 10.1.2.100 has three sessions with an outside device that has IP address 172.16.1.20. Example 1-4 shows that 10.1.2.100 has a TFTP session (UDP port 69) and an FTP session (TCP ports 20 and 21) with 172.16.1.20. Local device 10.1.3.67 has two sessions with the same remote device (172.16.1.20). Its two sessions are Telnet (TCP port 23) and HTTP (TCP port 80).

6. Understanding IP Version 6 | Next Section Previous Section

Cisco Press Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Cisco Press and its family of brands. I can unsubscribe at any time.

Overview

Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Cisco Press products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@ciscopress.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security

Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children

This site is not directed to children under the age of 13.

Marketing

Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out

Users can always make an informed choice as to whether they should proceed with certain services offered by Cisco Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.ciscopress.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links

This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020