چارەسەری لاب / Services
NAT not working: PCs can't reach the internet
Packet Tracer · GNS3 · Cisco IOS · دوایین پشکنین
وەڵامی کورتNAT needs four pieces:
ip nat inside on the LAN interface, ip nat outside on the ISP interface, an ACL that matches the inside addresses, and the ip nat inside source command (with overload for PAT). Then the router needs a default route to the ISP. If show ip nat translations stays empty, one of those is wrong.لەم پەڕەیەدا
What you see
PCs can ping the router's inside address, maybe even its outside address, but not the ISP or a web server on the "internet" side. show ip nat translations is empty.
Check it
show ip nat statisticslists which interfaces are inside and outside, and how many hits and misses there are.show ip nat translationswhile a PC is pinging. No entries means NAT never matched the traffic.show access-listsand look at the match count on the NAT ACL.show ip routemust have a way out (usuallyS* 0.0.0.0/0).
A PAT config that works
Inside LAN 192.168.1.0/24 on g0/0, ISP on g0/1:
access-list 1 permit 192.168.1.0 0.0.0.255
ip nat inside source list 1 interface g0/1 overload
interface g0/0
ip nat inside
interface g0/1
ip nat outside
ip route 0.0.0.0 0.0.0.0 203.0.113.1
The ACL uses a wildcard mask (0.0.0.255), not a subnet mask. access-list 1 permit 192.168.1.0 255.255.255.0 matches the wrong addresses.
The usual mistakes
- inside and outside swapped, or missing on a subinterface. With router-on-a-stick, every LAN subinterface needs
ip nat inside. - No
overload: without it the router translates one PC to the outside address and the next PCs fail. - ACL for the wrong subnet, or the ACL number in the NAT command is not the one you wrote.
- Testing from the router itself. A ping from the router uses its outside address and is not translated, so it proves nothing about NAT. Test from a PC.
- No default route, so the router doesn't know where to send the translated packet.
Static NAT for a server
To reach an inside server from outside, map it to a public address:
ip nat inside source static 192.168.1.10 203.0.113.10
Clear old entries after you change NAT with clear ip nat translation *, then test again.
Still not working?
An ACL on the outside interface may drop the replies. See ACL blocking traffic.