Configuration Exercise 1-2: NAT Using Access Lists and Route Maps
In this exercise, you will use NAT to allow your internal routers (PxR3 and PxR4) to download a configuration file from the TFTP server.
NOTE
Throughout this exercise, the pod number is referred to as x, and the router number is referred to as y. Substitute the appropriate numbers as needed.
Objectives
After completing this exercise, you will be able to
Demonstrate the uses and limits of access control list (ACL)-based NAT
Demonstrate the usefulness of NAT with route maps by implementing separate concurrent translations
Connect the internal router to the TFTP server or the opposite edge router using appropriate translation
Download a configuration file for the internal routers
Visual Objective
Figure 1-35 illustrates the topology used in this exercise.
NOTE
Backbone Router 2 (BBR2), shown in Figure 1-35, is not used until a later Configuration Exercise.
Command List
In this exercise, you will use the commands in Table 1-6, listed in logical order. Refer to this list if you need configuration command assistance during the exercise.
Figure 1-35 NAT Configuration Exercise Topology
CAUTION
Although the command syntax is shown in this table, the addresses shown are typically for the PxR1 and PxR3 routers. Be careful when addressing your routers! Refer to the exercise instructions and the appropriate visual objective diagram for addressing details.
Table 1-6 NAT Configuration Exercise Commands
Command |
Description |
(config)#access-list 100 permit ip 10.1.x.0 0.0.0.255 10.254.0.0 0.0.0.255 |
Creates an access list that specifies the traffic that should be translated. |
(config)#ip nat pool BBR 192.168.x.1 192.168.x.254 netmask 255.255.255.0 or (config)#ip nat pool BBR 192.168.x.1 192.168.x.254 prefix-length 24 |
Creates a named pool of addresses for use by NAT. |
(config)#ip nat inside source list 100 pool BBR |
Translates inside addresses that match the access list into this pool. |
continues |
|
Command |
Description |
(config-if)#ip nat inside |
Identifies an inside NAT address. |
(config-if)#ip nat outside |
Identifies an external NAT address. |
(config)#ip route 0.0.0.0 0.0.0.0 e0 |
Creates a default route pointing out interface E0. |
#show ip nat translations |
Views the translation table. |
#debug ip icmp |
Starts the console display of ICMP events. |
#debug ip packet |
Starts the console display of IP packet events. |
(config)#route-map TO_BBR permit 10 (config-route-map)#match ip address 100 |
Creates a route map to match the source address with addresses permitted by the access list. |
#clear ip nat translation * |
Removes all address translations from the NAT table. |
(config)#ip nat inside source route-map TO_POD pool POD |
Specifies a route map to be used for NAT. |
#debug ip nat detailed |
Starts the console display of translation entries being created. |
Task 1: Connecting the Internal Router to the Edge Router
In this task, you will connect the internal routers in your pod, PxR3 and PxR4, to the edge routers, PxR1 and PxR2. Complete the following steps:
Step 1 |
The internal routers (PxR3 and PxR4) should not have a configuration. If a configuration is present, use the erase start and reload commands to clear the configuration and reload the router. |
Step 2 |
Connect to your internal routers. Supply an IP address to the Ethernet interface, and enable the interface. The Ethernet address of PxR3 should be 10.x.1.3/24, and the Ethernet address of PxR4 should be 10.x.2.4/24. |
Step 3 |
PxR1 has an Ethernet address of 10.x.1.1, and PxR2 has an Ethernet address of 10.x.2.2. Verify connectivity to the Ethernet-attached edge router from each internal router. |
Task 2: Setting Up ACL-Based NAT
In this task, you will configure one-to-one NAT using an access list on the edge routers (PxR1 or PxR2). The access list translates the internal router Ethernet address using either 192.168.x.0/24 or 192.168.xx.0/24.
NOTE
BBR1 has static routes for 192.168.x.0/24 and 192.168.xx.0/24. It does not have any remote routes for the pod 10.x.0.0 addresses, only its local TFTP server network 10.254.0.0.
Complete the following steps:
Step 1 |
On the PxR1 and PxR2 routers, configure the sources to be translated using extended access list 100. Access list 100 should match traffic sourced from the network on your edge router's Ethernet interface, destined for the network that the TFTP server is located on. For example, PxR1 should match traffic sourced from 10.x.1.0/24, and PxR2 should match traffic sourced from 10.x.2.0/24. The access list must match only packets with a destination of 10.254.0.0/24. |
Step 2 |
On the PxR1 and PxR2 routers, create a pool of addresses called BBR for use by NAT, using the ip nat pool command. PxR1 should use the address range of 192.168.x.0/24, and PxR2 should use 192.168.xx.0/24. For example, P2R1 would use 192.168.2.1 through 192.168.2.254, and P2R2 would use 192.168.22.1 through 192.168.22.254. |
Step 3 |
On the PxR1 and PxR2 routers, use the ip nat inside source list command to specify that packets that match access list 100 should have their source addresses translated into the BBR pool. |
Step 4 |
On the PxR1 and PxR2 routers, define which interfaces are inside or outside for NAT translation purposes. |
Step 5 |
On the PxR3 and PxR4 routers, configure a default route pointing to the attached edge router e0 interface. This configuration allows the internal router to reach the core network. |
Step 6 |
From the PxR3 and PxR4 routers, verify connectivity to the TFTP server (10.254.0.254) using the ping command. |
CAUTION
You will not be able to reach the TFTP server if the NAT translation is not done correctly.
Step 7 |
View the NAT translation table on the edge router (PxR1 and PxR2). |
Task 3: Translating to the Other Edge Router
In this task, you will translate traffic from the odd half of the pod (PxR1 and PxR3) to the even half of the pod (PxR2 and PxR4) and vice versa. Because you are not running a routing protocol, you will translate the internal addresses to addresses that would be appropriate on the serial link between PxR1 and PxR2. Complete the following steps:
Step 1 |
On the PxR1 and PxR2 routers, configure the source addresses to be translated using extended access list 101. Access list 101 should match traffic sourced from the network on your edge router's Ethernet interface, bound for any destination. For instance, PxR1 should match traffic from 10.x.1.0/24, and PxR2 should match traffic from 10.x.2.0/24. The access list must match packets with a destination to any network. |
Step 2 |
On the PxR1 and PxR2 routers, create a pool of addresses named POD for use by NAT. PxR1 should use the address range 10.x.0.64 to 10.x.0.95, and PxR2 should use the address range 10.x.0.96 to 10.x.0.127. |
Step 3 |
On the PxR1 and PxR2 routers, specify that packets that match access list 101 should have their source addresses translated into the POD pool. |
Step 4 |
At the PxR1 and PxR2 routers, define the S1 interface of each router as the NAT outside interface by using the ip nat outside command so that traffic from the respective internal routers is translated. |
Step 5 |
From one internal router, ping the Serial 1 interface of the nonconnected edge router. (For example, from PxR3, ping the Serial 1 address of PxR2.) Is the ping successful? |
Step 6 |
Look at the IP translation table on the edge routers to help explain the result of the previous ping. |
Step 7 |
From the nonconnected edge router, use the debug ip icmp and debug ip packet commands while the pings are still active. Observe the output to help explain the results of the previous ping. Turn off all debugging when you are finished. |
Step 8 |
Look at the routing table on the nonconnected edge router. Is there a route back to the destination address of the ping echo reply message? |
Step 9 |
What does a router do when it does not find an appropriate address? |
Task 4: Using a Route Map with NAT to Translate Internal Addresses
In this task, you will configure NAT using a route map to match traffic. You saw in Task 3 that when NAT uses an access list without overloading addresses, the translation entry contains only local and global inside IP addresses. When a route map is used with NAT, the translation entry contains both the inside and outside (local and global) address entries and any TCP or UDP port information. This translation entry lets the router recognize different conversations.
In this exercise, traffic needs to be translated based on destination. Traffic to the TFTP server and the core should still be translated to 192.168.x.0/24 or 192.168.xx.0/24, but traffic to the other edge router should be translated to an IP address in the 10.x.0.0 subnet. This address will appear to be local to the serial 1 interface of the other edge and will have a path entered in the routing table (connected routes are automatically in the routing table). To prevent confusion, PxR1 uses the address range of 10.x.0.64/24 through 10.x.0.95/24, and PxR2 uses the address range of 10.x.0.96/24 through 10.x.0.127/24.
Complete the following steps:
Step 1 |
Create a route map that will be used to conditionally translate traffic based on the packet's destination. |
Step 2 |
Replace the translation commands from Task 3 with route map-based commands to perform the required translation. |
|
If the router reports "%Dynamic mapping in use, cannot remove," simply go to privileged mode and enter the clear ip nat translation * command to remove all mappings. You then can configure the router. |
Step 3 |
Ping from one internal router to the opposite edge router and to the TFTP server to verify that the previous step was successful. Turn on debug ip nat detailed debugging on the edge routers to see the translation. |
Step 4 |
Use the show ip nat translations command on each edge router to see the resulting NAT translation table. |
Task 5: Downloading a Configuration File
Now that NAT is properly configured and working, you will download a configuration for the internal routers (PxR3 and PxR4).
On the internal routers, use TFTP to download the configuration file called PxRy.txt from the TFTP server to the running-config.
NOTE
The configurations for PxR3 and PxR4 include the command no ip classless in preparation for the next Configuration Exercise at the end of the next chapter. If you try to communicate with the TFTP server now, it will not work. The reasoning behind this behavior is examined in the next Configuration Exercise.
Exercise Verification
You have successfully completed this exercise when you achieve the following results:
Your internal router can ping the TFTP server using a translation to 192.168.x.0/24.
Your internal router can ping the opposite edge router using a translation to 10.x.0.0/24.
You have demonstrated the limitations of access list-based NAT and have overcome those limitations by configuring NAT using a route map.
You have connected to the TFTP server through NAT and have downloaded a configuration file for your internal routers.