– Configure Static NAT
Router(config) # ip nat inside source static (inside_local_address) (inside_global_address)
For example:
Router(config) # ip nat inside source static 10.0.0.1 202.103.2.1 (The address 10.10.0.1 will be converted to 202.103.2.1 when leaving the Router)
– After configuration is complete, apply to the print port and output port. In the example below, the Ethernet port is the print port, and the Serial port is the output port.
Router(config) # interface ethernet 0
Router(config-if) # ip nat inside
Router(config) # interface serial 0
Router(config-if) # ip nat outside
Apply:
NAT can be implemented both statically and dynamically. Static NAT simply maps a private IP address to a single public IP address, and this is the NAT we are discussing in this section.
A router Cisco Routers Implementing NAT divides it into inside and outside. Usually, the inside is a business, and the outside is the public Internet. In addition to the concept of inside and outside, Cisco NAT routers classify addresses as local or global.
Let’s jump right into configuring static NAT on the router Cisco Routers as shown in Figure below:
R1 is the router that performs network address translation (NAT) and has two interfaces: Fa0/0 on the inside and Fa0/1 on the outside. The specific IP addresses involved are:
You probably know very well how to configure the IP address on the router interface, so we skip those configuration steps. First, we have to assign Fa0/0 as NAT inside the interface and Fa0/1 as NAT outside the interface on R1. This will tell the router that traffic entering or exiting these two interfaces will depend on address translation.
R1#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface Fa0/0
R1(config-if)#ip nat inside
R1(config-if)#interface Fa0/1
R1(config-if)#ip nat outside
R1(config-if)#end
We will now tell the router how to perform address translation and which IP address (source or destination) to mention to record in packets moving between the internal and external interfaces.
R1(config)#ip nat inside source static 192.168.1.2 89.203.12.47
Here, we are asking the router to perform NAT on packets coming into the router on internal interface Fa0/0. More specifically, the router will determine which of these packets has the correct address. source IP is 192.168.1.2 and will change it to 89.203.12.47 before forwarding the packet out to external interface Fa0/1. Similarly, return packets arriving at external interface Fa0/1 will go through the destination IP address translator.
We have just configured and verified a simple NAT scenario that only translates the source or destination IP addresses (not both at the same time) of packets moving between internal and external interfaces.
This type of NAT configuration is called static NAT because an inside local IP address is statically mapped to an outside local IP address.
For details see here: Configure NAT and PAT on Cisco Router devices
Xem tiếp...