4.1 Configure and verify NAT for inside hosts using static mappings and address pools
CCNA 200-301 v1.1 · 4.0 IP Services
NAT rewrites addresses as packets cross a router, so hosts with private addresses (RFC 1918) can reach the internet and public services can be published from inside. For the CCNA you configure static NAT for a server, dynamic NAT with a pool, and PAT (overload), mark the inside and outside interfaces, and read the translation table.
What you must know
- Define inside local, inside global, outside local and outside global.
- Configure static NAT, dynamic NAT with a pool, and PAT on the outside interface.
- Mark the right interfaces
ip nat insideandip nat outside. - Read
show ip nat translationsandshow ip nat statistics. - Troubleshoot NAT: wrong ACL, missing inside/outside, exhausted pool.
The four NAT addresses
| Term | Meaning | In the drawing |
|---|---|---|
| Inside local | The inside host's real address. | PC1 192.168.1.11 |
| Inside global | The inside host as the internet sees it. | 203.0.113.2 (R1's outside address) |
| Outside local | The outside host as the inside sees it. | Usually the same as outside global |
| Outside global | The outside host's real address. | A web server on the internet |
Local is what the inside sees, global what the outside sees. Inside and outside say where the host lives.
Static NAT
Static NAT maps one inside address to one global address, permanently and in both directions. Use it to publish a server: connections to 203.0.113.10 from the internet reach SRV1 (2).
interface GigabitEthernet0/1
ip nat inside
interface GigabitEthernet0/0
ip nat outside
!
ip nat inside source static 192.168.1.10 203.0.113.10Dynamic NAT with a pool
Dynamic NAT gives each inside host that matches an ACL a free address from a pool, one to one, for as long as it is in use. When the pool is empty, the next host fails.
access-list 1 permit 192.168.1.0 0.0.0.255
ip nat pool PUBLIC 203.0.113.20 203.0.113.30 netmask 255.255.255.224
ip nat inside source list 1 pool PUBLICPAT (overload)
PAT lets many hosts share one global address by also translating the source port. It is what home routers and most branches do: PC1 leaves as 203.0.113.2 with a new port (1), and the reply finds its way back through the port.
access-list 1 permit 192.168.1.0 0.0.0.255
ip nat inside source list 1 interface GigabitEthernet0/0 overload
! or overload a pool:
ip nat inside source list 1 pool PUBLIC overloadR1# show ip nat translations
Pro Inside global Inside local Outside local Outside global
tcp 203.0.113.2:1024 192.168.1.11:51512 198.51.100.80:443 198.51.100.80:443
--- 203.0.113.10 192.168.1.10 --- ---Commands
show ip nat translations | Active translations: inside global, inside local, outside local, outside global (with ports for PAT). |
show ip nat statistics | Hits and misses, the inside and outside interfaces, and pool usage. |
clear ip nat translation * | Removes dynamic translations, for example after changing the configuration. |
debug ip nat | Each translation as it happens. Use with care on a busy router. |
Exam traps
- Without
ip nat insideandip nat outsideon the right interfaces, nothing is translated. - The NAT ACL uses a wildcard mask:
0.0.0.255, not255.255.255.0. - Dynamic NAT without
overloadfails for the next host once the pool is used up; PAT does not. - Static NAT works in both directions; dynamic NAT and PAT only create entries for traffic started inside.
- Inside global is the address the internet sees, not the host's real address.
Check yourself
- PC1 is 192.168.1.11 and leaves as 203.0.113.2. Which is the inside local and which the inside global?
- Inside local 192.168.1.11 (the real address), inside global 203.0.113.2 (as seen outside).
- Hosts cannot reach the internet and
show ip nat statisticsshows no hits. What do you check first? - That the interfaces are marked
ip nat insideandip nat outside, and that the ACL matches the hosts' addresses with a wildcard mask. - What one word turns dynamic NAT into PAT?
overload.- Which kind of NAT lets someone on the internet open a connection to an inside server?
- Static NAT (or a static port mapping), because its entry exists before any traffic flows.
Labs
Try it live: PAT, DHCP server and NTP
More topics in 4.0 IP Services
- 4.3 Explain what DHCP and DNS do for hosts
- 4.4 Explain how SNMP is used in network operations
- 4.5 Describe syslog, including facilities and severity levels
- 4.6 Configure and verify DHCP client and relay
- 4.7 Explain QoS per-hop behavior: classification, marking, queuing, congestion handling, policing, shaping
- 4.8 Configure and verify remote device access with SSH
- 4.9 Describe what TFTP and FTP do on a network