Skip to content

ENCOR course / Keep the gateway and services up · Step 3 of 14

Guide: NAT, PAT and policy-based routingSwitch

Guide

NAT, PAT and policy-based routing (CCNP ENCOR)

NAT translates IP addresses as packets pass between inside and outside networks. Policy-based routing uses a route-map to choose how matching packets are forwarded on Cisco IOS XE.

6 parts · video · 7 practice questions

How NAT and PBR fit together

NAT rewrites the source or destination address of a packet at the edge between an inside network and an outside network. PBR overrides the normal destination-based routing table lookup for packets that match a route-map.

Mark the interfaces participating in NAT as inside or outside. On Catalyst 9300 and 9500, NAT and PBR cannot be configured on the same interface; they can work together on different interfaces.

References (2)

Inside local and inside global addresses

Cisco names a NAT address by two things: whether the host is inside or outside, and whether you see the address from the inside (local) or the outside (global).

Inside local and inside global addresses, PAT sharing one address, then static port forwarding, as a 24 second clip. Watch on its own page

An inside local address is assigned to a host on the inside network and may be an unregistered address. An inside global address is a globally routable address, assigned by the NIC or service provider, that represents one or more inside local addresses to the outside world. An inside host's address as it appears to the outside network is its inside global address.

The outside local and outside global addresses name an outside host in the same two views.

References (1)

PAT: many hosts behind one address

Port Address Translation (PAT), also called NAT overload, lets many inside hosts share one inside global address. For TCP and UDP, port numbers distinguish hosts and translations.

PAT is also called
NAT overload
Shared address
one inside global address
Protocols
TCP and UDP

To use an interface address for PAT, use the overload keyword on the interface form of the command. Cisco permits any operational Layer 3 interface with a valid IP address for this overload configuration.

IOS XE
access-list 101 permit tcp 192.168.1.0 0.0.0.255 any
access-list 101 permit udp 192.168.1.0 0.0.0.255 any
access-list 101 permit icmp 192.168.1.0 0.0.0.255 any
ip nat inside source list 101 interface GigabitEthernet0/0 overload
!
interface GigabitEthernet0/1
 ip nat inside
interface GigabitEthernet0/0
 ip nat outside
References (1)

Static NAT with ports (port forwarding)

A static translation maps one inside local address to one inside global address, which lets an inside host be reached from outside by a fixed address. A static TCP port mapping translates traffic addressed to the inside global address and global port to the configured inside local address and local port. For example, inbound TCP traffic to 203.0.113.10 port 80 maps to 192.168.1.50 port 80.

Global endpoint
203.0.113.10 port 80
Local endpoint
192.168.1.50 port 80
Mapping protocol
TCP

The command form is: ip nat inside source static tcp local-ip local-port global-ip global-port.

IOS XE
ip nat inside source static tcp 192.168.1.50 80 203.0.113.10 80
References (1)

Policy-based routing with a route-map

PBR uses a route-map. Match clauses, often an access list, select traffic, and set clauses such as a next hop decide where it goes. If no route-map sequence matches, normal destination-based routing is used. A deny decision in a sequence skips its PBR action and continues to the next sequence; if there is no next sequence, the packet uses the default IP routing table.

Interface command
ip policy route-map
Local PBR default
disabled
Local PBR protocols
NTP, DNS, MSDP, SYSLOG, and TFTP

To turn PBR on for traffic entering an interface, apply the route-map under that interface with ip policy route-map followed by the map name. On Catalyst 9500, ip route-cache policy optionally enables fast-switching PBR.

Packets generated by the switch are not normally policy-routed by the interface command. Use the global command ip local policy route-map to enable local PBR. On Catalyst 9500, local PBR is disabled by default and supports NTP, DNS, MSDP, SYSLOG, and TFTP.

IOS XE
access-list 101 permit ip 10.1.1.0 0.0.0.255 any
route-map PBR-MAP permit 10
 match ip address 101
 set ip next-hop 10.2.2.2
!
interface GigabitEthernet0/1
 ip policy route-map PBR-MAP
!
ip local policy route-map PBR-MAP
References (1)

When the PBR next hop is unreachable

On Cisco IOS, when the address configured with set ip next-hop is not in the routing table, the packet uses the normal routing table. IOS XE recursive next-hop handling also routes through the default routing table when the recursive next hop is unavailable. This fallback describes the routing-table case; behavior for other failed set actions and individual Catalyst models can differ.

References (4)

Check your understanding

NAT, PAT and policy-based routing (CCNP ENCOR)

All 6 sections · no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.