Configuring Basic NAT Functionality
Problem
You want to set up Network Address Translation on your router.
Solution
In the simplest NAT configuration, all of your internal devices use the same external global address as the router’s external interface:
Router#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router(config)#access-list15permitRouter(config)#192.168.0.0 0.0.255.255ip nat inside source list15interfaceFastEthernet0/0overloadRouter(config)#interfaceRouter(config-if)#FastEthernet0/2ip addressRouter(config-if)#192.168.1.1 255.255.255.0ip nat insideRouter(config-if)#exitRouter(config)#interfaceRouter(config-if)#FastEthernet0/1ip addressRouter(config-if)#192.168.2.1 255.255.255.0ip nat insideRouter(config-if)#exitRouter(config)#interfaceRouter(config-if)#Ethernet0/0ip addressRouter(config-if)#172.16.1.5 255.255.255.252ip nat outsideRouter(config-if)#exitRouter(config)#endRouter#
Discussion
In this example, the router will rewrite that address of all of
the internal devices whose IP addresses are in the range 192.168.0.0/16. When these internal devices
connect to devices on the outside of the network, they will all appear
to have the same source address as the external interface of the
router, 172.16.1.5.
This example actually includes two internal interfaces and one external. You designate the internal interfaces with the ip nat inside command. You can have as many inside interfaces as you like:
Router(config)#interface ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access