Home Blog Certs Knowledge Base About

Cisco NAT & DHCP โ€” Configuration Reference

Cisco IOS cheat sheet for NAT (Network Address Translation) and DHCP. Covers static NAT, dynamic NAT, PAT (overload), NVI NAT, DHCP server setup, and DHCP relay.

NAT โ€” Network Address Translation

Static NAT

One-to-one permanent mapping. Used to expose an internal server to the outside.

Static NAT
CommandDescription
int fa0/0Internal interface (LAN side)
ip nat insideMark as inside NAT interface
int fa0/1External interface (Internet side)
ip nat outsideMark as outside NAT interface
ip nat inside source static 192.168.1.2 215.215.215.20Map private 192.168.1.2 permanently to public 215.215.215.20
ip nat inside source static tcp 192.168.1.3 80 172.20.20.15 80Port forward: external port 80 โ†’ internal 192.168.1.3:80
ip nat inside source static tcp 192.168.1.3 80 interface Ethernet0/0 80Port forward using interface IP instead of hardcoded public IP
ip nat inside source static 192.168.1.5 interface fa0/0DMZ-style: forward ALL ports to 192.168.1.5

Dynamic NAT

Pool of public IPs โ€” each private IP gets a different public IP from the pool.

Dynamic NAT
CommandDescription
access-list 1 permit 192.168.1.0 0.0.0.255Define which private addresses are eligible for NAT
ip nat pool TRANS 215.215.215.20 215.215.215.30 netmask 255.255.255.0Define public IP pool (range .20โ€“.30)
ip nat inside source list 1 pool TRANSEnable dynamic NAT: ACL 1 โ†’ pool TRANS

PAT โ€” Port Address Translation (NAT Overload)

Many private IPs share one public IP, differentiated by port numbers. Most common in home/office routers.

PAT with Pool
CommandDescription
ip nat pool OVRLD 172.16.10.1 172.16.10.1 netmask 255.255.255.0Pool with a single public IP
access-list 7 permit 192.168.1.0 0.0.0.255Private IP range eligible for PAT
ip nat inside source list 7 pool OVRLD overloadEnable PAT (overload)
PAT Using Interface IP (Recommended)
CommandDescription
ip nat inside source list 7 interface e0/1 overloadTranslate to the IP of the outbound interface โ€” no hardcoded public IP needed

Prefer the interface-based form โ€” it follows the interface IP automatically if the ISP reassigns it.

NVI NAT (NAT Virtual Interface)

Alternative to inside/outside model โ€” mark interfaces with ip nat enable on both sides.

NVI NAT โ€” PAT Example
CommandDescription
ip nat enableEnable NAT on interface (both LAN and WAN side)
ip nat source list 7 interface fa0/1 overloadEnable PAT โ€” note: no `inside` keyword

NAT Diagnostics

NAT show / debug
CommandDescription
show ip nat translationCurrent NAT translation table
show ip nat statisticsNAT hit counters and stats
show ip nat nvi translationTranslation table for NVI NAT
clear ip nat translation *Clear dynamic translation table (settings unchanged)
debug ip natReal-time NAT translation log

DHCP Server

DHCP Pool Configuration
CommandDescription
ip dhcp excluded-address 192.168.10.50Exclude IP from DHCP assignment (static servers, gateways)
ip dhcp pool VLAN2POOLCreate DHCP pool named VLAN2POOL
network 192.168.2.0 255.255.255.0Address range to hand out
default-router 192.168.2.50Default gateway to advertise
dns-server 217.217.217.2DNS server to advertise
netbios-name-server 192.168.1.2WINS server address
bootfile FILENAMEPXE boot filename
option 33 ip 156.42.45.0 192.168.1.1Option 33: send static route to client
lease 2Lease time of 2 days
Sub-interface for Inter-VLAN DHCP
CommandDescription
interface fa0/0.2Create sub-interface for VLAN 2
encapsulation dot1Q 2Tag sub-interface for VLAN 2
ip address 192.168.2.2 255.255.255.0Assign IP (this becomes the DHCP gateway)
Static IPโ€“MAC Binding
CommandDescription
ip dhcp pool CLIENTCreate a dedicated pool for one client
host 192.168.50.5 255.255.255.255Always assign this IP
client-identifier 0001.976B.291DMatch by MAC address (client-identifier)

Windows clients: prefix MAC with 01 (e.g., 0100.0476.106c.bc).
UNIX clients: prefix with 00 (e.g., 0000.0476.106c.bc).

DHCP Relay and Advanced Settings
CommandDescription
ip helper-address 10.0.1.4DHCP Relay Agent โ€” forward requests to DHCP server at 10.0.1.4
ip dhcp ping packets 0Disable ping check before assigning IP (0 = off)
ip dhcp ping timeout 200Timeout between ping attempts (ms)
clear ip dhcp binding *Clear all DHCP lease bindings
clear ip dhcp binding 192.168.2.4Clear binding for specific IP
clear ip dhcp conflict *Clear IP conflict database
ip dhcp database ftp://user:pass@192.168.1.5/router-dhcp timeout 80Store DHCP bindings on external FTP server
DHCP Diagnostics
CommandDescription
show ip dhcp poolAvailable and used addresses per pool
show ip dhcp bindingAll assigned leases
show ip dhcp binding 192.168.10.1Details for a specific IP (includes MAC)
show ip dhcp conflictIP address conflict log
show ip dhcp server statisticsDHCP server stats (requests, acks, declines)
debug ip dhcp server packetReal-time DHCP packet debug

Cisco IOS Command Reference | NAT & DHCP