Cyber Services / All lessons / CCNA — Networking / Day 10 — ACL & NAT

Day 10 — ACL & NAT

Module 10 of 12 · 6 min read · Free to read

MODULES ↓ Command blocks have a COPY button

Access Control Lists & Network Address Translation

Mastering network security with ACLs and implementing NAT for IPv4 address conservation

Standard ACLs
Extended ACLs
Static NAT
Dynamic NAT
PAT

Access Control Lists (ACLs)

Packet filtering for network security and traffic control

What are ACLs?
  • ACLs filter network traffic by controlling whether packets are forwarded or blocked
  • Consist of sequential list of permit or deny statements
  • Applied to router interfaces for inbound or outbound traffic
  • Implicit deny all statement at the end of every ACL
  • Processed sequentially from top to bottom
ACL Operation
ACL Packet Processing
Packet Arrives
ACL Applied
Match Found?
Apply Action
# ACL Processing Rules
1. Packets are compared to ACL conditions sequentially
2. First match determines permit/deny action
3. If no match found, implicit deny applies
4. Once a match is found, no further conditions are checked

ACL Types

Standard vs Extended ACLs and their applications

Standard ACLs
  • Filter based on source IP address only
  • ACL numbers: 1-99 and 1300-1999
  • Should be placed close to destination
  • Less specific than extended ACLs
# Standard ACL Configuration
R1(config)# access-list 10 permit 192.168.1.0 0.0.0.255
R1(config)# access-list 10 deny 192.168.2.0 0.0.0.255
R1(config)# access-list 10 permit any
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip access-group 10 out
Extended ACLs
  • Filter based on source/destination IP, protocol, port numbers
  • ACL numbers: 100-199 and 2000-2699
  • Should be placed close to source
  • More granular control than standard ACLs
# Extended ACL Configuration
R1(config)# access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 10.1.1.1 eq 80
R1(config)# access-list 101 permit tcp 192.168.1.0 0.0.0.255 host 10.1.1.1 eq 443
R1(config)# access-list 101 deny ip any any
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip access-group 101 in

Wildcard Masks

Understanding how to match IP addresses in ACLs

Wildcard Mask Basics
  • Similar to subnet masks but with inverted logic
  • 0 = must match exactly
  • 1 = ignore this bit
  • Calculated by subtracting subnet mask from 255.255.255.255
  • Used to match groups of IP addresses
Subnet Mask Wildcard Mask Description
255.255.255.0 0.0.0.255 Match entire subnet
255.255.255.252 0.0.0.3 Match /30 subnet
255.255.255.255 0.0.0.0 Match single host
0.0.0.0 255.255.255.255 Match any address
Wildcard Mask Examples
# Common Wildcard Mask Examples
# Match specific host
access-list 10 permit 192.168.1.5 0.0.0.0
# OR use "host" keyword
access-list 10 permit host 192.168.1.5

# Match entire subnet
access-list 10 permit 192.168.1.0 0.0.0.255

# Match any address
access-list 10 permit 0.0.0.0 255.255.255.255
# OR use "any" keyword
access-list 10 permit any

# Match range 192.168.1.0 - 192.168.1.127
access-list 10 permit 192.168.1.0 0.0.0.127

Named ACLs

Using descriptive names instead of numbers for ACLs

Named ACL Advantages
  • Descriptive names instead of numbers
  • Can add/delete specific lines
  • No number restrictions
  • Easier to understand and manage
  • Can edit individual lines without recreating entire ACL
Named ACL Configuration
# Create named standard ACL
R1(config)# ip access-list standard OFFICE-ACCESS
R1(config-std-nacl)# permit 192.168.10.0 0.0.0.255
R1(config-std-nacl)# deny 192.168.20.0 0.0.0.255
R1(config-std-nacl)# permit any

# Create named extended ACL
R1(config)# ip access-list extended WEB-TRAFFIC
R1(config-ext-nacl)# permit tcp 192.168.1.0 0.0.0.255 any eq 80
R1(config-ext-nacl)# permit tcp 192.168.1.0 0.0.0.255 any eq 443
R1(config-ext-nacl)# deny ip any any

# Apply named ACL to interface
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip access-group WEB-TRAFFIC out

Network Address Translation (NAT)

Conserving IPv4 addresses and enhancing network security

Why NAT?
  • IPv4 address exhaustion
  • Hides internal network structure
  • Reduces costs by using private IP addresses
  • Allows multiple devices to share a single public IP
  • Connects networks with overlapping addresses
NAT Terminology
Term Description
Inside Local Private IP address assigned to host on inside network
Inside Global Public IP address that represents inside host to outside world
Outside Local IP address of outside host as it appears to inside network
Outside Global Public IP address assigned to host on outside network
NAT Address Translation
Inside Local
192.168.1.10
NAT Router
Inside Global
203.0.113.5

NAT Types

Static NAT, Dynamic NAT, and PAT (NAT Overload)

Static NAT
  • One-to-one mapping between local and global addresses
  • Used when inside device must be accessible from outside
  • Permanent mapping that remains in NAT table
  • Typically used for servers
# Static NAT Configuration
R1(config)# ip nat inside source static 192.168.1.10 203.0.113.10
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip nat inside
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip nat outside
Dynamic NAT
  • Many-to-many mapping between local and global addresses
  • Uses pool of public IP addresses
  • Mapping created dynamically when traffic initiates
  • Entries timeout after period of inactivity
# Dynamic NAT Configuration
R1(config)# ip nat pool PUBLIC-POOL 203.0.113.10 203.0.113.20 netmask 255.255.255.0
R1(config)# access-list 1 permit 192.168.1.0 0.0.0.255
R1(config)# ip nat inside source list 1 pool PUBLIC-POOL
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip nat inside
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip nat outside
PAT (Port Address Translation)
  • Many-to-one mapping using port numbers
  • Also known as NAT Overload
  • Allows thousands of devices to share a single public IP
  • Most common form of NAT in home/small business networks
# PAT Configuration using interface IP
R1(config)# access-list 1 permit 192.168.1.0 0.0.0.255
R1(config)# ip nat inside source list 1 interface gigabitethernet 0/1 overload
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ip nat inside
R1(config)# interface gigabitethernet 0/1
R1(config-if)# ip nat outside

NAT Verification & Troubleshooting

Commands to verify NAT operation and troubleshoot issues

NAT Verification Commands
# Show NAT translations
R1# show ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 203.0.113.10 192.168.1.10 --- ---
tcp 203.0.113.5:1024 192.168.1.5:1024 198.51.100.10:80 198.51.100.10:80

# Show NAT statistics
R1# show ip nat statistics
Total active translations: 2 (0 static, 2 dynamic; 2 extended)
Outside interfaces: GigabitEthernet0/1
Inside interfaces: GigabitEthernet0/0
Hits: 100 Misses: 5

# Clear NAT translations
R1# clear ip nat translation *
R1# clear ip nat translation inside 192.168.1.10 203.0.113.10
Common NAT Issues
1

ACL Not Matching

Verify ACL used in NAT configuration matches intended traffic

R1# show access-lists
R1# show ip nat statistics
2

Interface Not Configured

Ensure inside/outside interfaces are correctly designated

R1# show running-config interface gigabitethernet 0/0
R1# show ip interface brief
3

Pool Exhaustion

Dynamic NAT pools can run out of addresses

R1# show ip nat statistics
R1# debug ip nat

IPv6 ACLs

Access control for IPv6 networks

IPv6 ACL Differences
  • Only named ACLs (no numbered ACLs)
  • Implicit permit for neighbor discovery packets
  • No wildcard masks - use prefix-length instead
  • Implicit deny at the end (same as IPv4)
  • Can filter based on IPv6 extension headers
IPv6 ACL Configuration
# IPv6 ACL Configuration
R1(config)# ipv6 access-list OFFICE-V6-ACCESS
R1(config-ipv6-acl)# permit tcp 2001:db8:acad:1::/64 any eq 80
R1(config-ipv6-acl)# permit tcp 2001:db8:acad:1::/64 any eq 443
R1(config-ipv6-acl)# deny ipv6 any any

# Apply IPv6 ACL to interface
R1(config)# interface gigabitethernet 0/0
R1(config-if)# ipv6 traffic-filter OFFICE-V6-ACCESS in

Day 10 Summary

Key concepts for ACLs and NAT implementation

ACL Concepts

  • Standard vs Extended ACLs
  • Wildcard masks for IP matching
  • Named ACLs for better management
  • Implicit deny at end of all ACLs
  • Processed sequentially top to bottom

NAT Types

  • Static NAT - one-to-one mapping
  • Dynamic NAT - pool-based mapping
  • PAT - many-to-one with ports
  • Conserves public IPv4 addresses
  • Provides security through obscurity

Standard ACLs

  • Numbers 1-99, 1300-1999
  • Filter by source IP only
  • Place close to destination
  • access-list [number] [permit/deny] [source]

Extended ACLs

  • Numbers 100-199, 2000-2699
  • Filter by src/dst IP, protocol, port
  • Place close to source
  • access-list [number] [permit/deny] [protocol] [source] [destination] [port]

Verification Commands

  • show access-lists
  • show ip nat translations
  • show ip nat statistics
  • clear ip nat translation
  • debug ip nat
Modules (12) ← CCNA — Networking