Allocating External Addresses Statically
Problem
You want to translate specific internal IP addresses to specific external addresses.
Solution
For some applications, you need each internal (inside local) address to always translate to the same external (inside global) address. This is particularly true if you need inbound connections from the outside network to always reach a particular internal device, such as a web or email server:
Router#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Router(config)#ip nat inside source staticRouter(config)#192.168.1.15 172.16.1.10ip nat inside source staticRouter(config)#192.168.1.16 172.16.1.11interfaceRouter(config-if)#FastEthernet 0/0ip addressRouter(config-if)#192.168.1.1 255.255.255.0ip nat insideRouter(config-if)#exitRouter(config)#interfaceRouter(config-if)#FastEthernet 0/1ip addressRouter(config-if)#192.168.2.1 255.255.255.0ip nat insideRouter(config-if)#exitRouter(config)#interfaceRouter(config-if)#Ethernet1/0ip addressRouter(config-if)#172.16.1.2 255.255.255.0ip nat outsideRouter(config-if)#exitRouter(config)#endRouter#
Discussion
This recipe includes static translations for two internal
devices. The internal address 192.168.1.15 will always appear on the
outside as 172.16.1.10, and
192.168.1.16 will always appear as
172.16.1.11. Note that because these translations are static, they will work in either direction. So any packets sent to the NAT address from the external network will reach ...
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