Translating in Both Directions Simultaneously
Problem
You want to translate both internal and external addresses.
Solution
In some cases, you might need to translate IP addresses on both sides of your router:
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z. Router(config)#access-list
15
deny
Router(config)#
192.168.1.15
access-list
15
permit
Router(config)#
192.168.0.0 0.0.255.255
access-list
16
deny
Router(config)#
172.16.5.25
access-list
16
permit
Router(config)#
172.16.0.0 0.0.255.255
ip nat pool
NATPOOL 172.16.1.100 172.16.1.150
netmask
Router(config)#
255.255.255.0
ip nat pool
INBOUNDNAT 192.168.15.100 192.168.15.200
netmask
Router(config)#
255.255.255.0
ip nat inside source list
15
pool
NATPOOL
overload
Router(config)#ip nat inside source list
16
pool
INBOUNDNAT
overload
Router(config)#ip nat inside source static
Router(config)#
192.168.1.15 172.16.1.10
ip nat outside source static
Router(config)#
172.16.5.25 192.168.15.5
ip route
192.168.15.0 255.255.255.0
Ethernet
Router(config)#
0/0
interface
Router(config-if)#
FastEthernet 0/0
ip address
Router(config-if)#
192.168.1.1 255.255.255.0
ip nat inside
Router(config-if)#exit
Router(config)#interface
Router(config-if)#
FastEthernet 0/1
ip address
Router(config-if)#
192.168.2.1 255.255.255.0
ip nat inside
Router(config-if)#interface
Router(config-if)#
Ethernet0/0
ip address
Router(config-if)#
172.16.1.2 255.255.255.0
ip nat outside
Router(config-if)#exit
Router(config)#end
Router#
Discussion
Sometimes you need to ...
Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.