How To Configure Static NAT in Cisco
How To Configure Static NAT in Cisco
Hoow
w ttoo C
Coonnffiigguurree SSttaattiicc N
NAATT iinn C
Ciissccoo RRoouutteerr
how configure static NAT, map address (inside local address, outside local address, inside global address and outside global
address), debug and verify Static NAT translation step by step with practical examples in packet tracer.
In order to configure NAT we have to understand four basic terms; inside local, inside global, outside local and outside global. These
terms define which address will be mapped with which address.
Term Description
Inside Local IP Address Before translation source IP address located inside the local network.
Inside Global IP Address After translation source IP address located outside the local network.
Outside Global IP Address Before translation destination IP address located outside the remote network.
Outside Local IP Address After translation destination IP address located inside the remote network.
For this tutorial I assume that you are familiar with these basic terms. If you want to learn these terms in detail please go through the
first part of this article which explains them in details with examples.
This tutorial is the second part of our article “ Learn NAT (Network Address Translation) Step by Step in Easy Language with
Examples”. You can read other parts of this article here.
To explain Static NAT Configuration, I will use packet tracer network simulator software. You can use any network simulator s oftware or
can use real Cisco devices to follow this guide. There is no difference in output as long as your selected software contains the
commands explained in this tutorial.
Create a practice lab as shown in following figure or download this pre-created practice lab and load in packet tracer
To assign IP address in Laptop click Laptop and click Desktop and IP configuration and Select Static and set IP address as given in
above table.
Following same way configure IP address in Server.
To configure IP address in Router1 click Router1 and select CLI and press Enter key.
Two interfaces of Router1 are used in topology; FastEthernet0/0 and Serial 0/0/0.
By default interfaces on router are remain administratively down during the start up. We need to configure IP address and oth er
parameters on interfaces before we could actually use them for routing. Interface mode is used to assign the IP address and o ther
parameters. Interface mode can be accessed from global configuration mode. Following commands are used to access the global
configuration mode.
Router>enable
Router# configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#
Before we configure IP address in interfaces let’s assign a unique descriptive name to router.
Router(config)#hostname R1
R1#
Now execute the following commands to set IP address in FastEthernet 0/0 interface.
R1(config)#interface FastEthernet0/0
R1(config-if)#ip address 10.0.0.1 255.0.0.0
R1(config-if)#no shutdown
R1(config-if)#exit
Fourth line of output confirms that DCE end of serial cable is attached. If you see DTE here instead of DCE skip these parameters.
R1#configure terminal
R1(config)#interface Serial0/0/0
R1(config-if)#ip address 100.0.0.1 255.0.0.0
R1(config-if)#clock rate 64000
R1(config-if)#bandwidth 64
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#
In real life environment this parameter controls the data flow between serial links and need to be set at service provider’s end. In lab
environment we need not to worry about this value. We can use any valid rate here.
Router(config-if)#bandwidth 64
Bandwidth works as an influencer. It is used to influence the metric calculation of EIGRP or any other routing protocol which uses
bandwidth parameter in route selection process.
We will use same commands to assign IP addresses on interfaces of Router2. We need to provided clock rate and bandwidth only on
DCE side of serial interface. Following command will assign IP addresses on interface of Router2.
That’s all initial IP configuration we need. Now this topology is ready for the practice of static nat.
CCoonnffiigguurree SSttaattiicc N
NAATT
1. Define IP address mapping
2. Define inside local interface
3. Define inside global interface
Since static NAT use manual translation, we have to map each inside local IP address (which needs a translation) with inside global IP
address. Following command is used to map the inside local IP address with inside global IP address.
Router(config)#ip nat inside source static [inside local ip address] [inside global IP address]
For example in our lab Laptop1 is configured with IP address 10.0.0.10. To map it with 50.0.0.10 IP address we will use following
command
In second step we have to define which interface is connected with local the network. On both routers interface Fa0/0 is connected
with the local network which need IP translation.
In third step we have to define which interface is connected with the global network. On both routers serial 0/0/0 interface is
connected with the global network. Following command will define interface Serial0/0/0 as inside global.
Let’s implement all these commands together and configure the static NAT.
RR11 SSttaattiicc N
NAATT CCoonnffiigguurraattiioonn
R1(config)#ip nat inside source static 10.0.0.10 50.0.0.10
R1(config)#interface FastEthernet 0/0
R1(config-if)#ip nat inside
R1(config-if)#exit
R1(config)#
R1(config)#interface Serial 0/0/0
R1(config-if)#ip nat outside
R1(config-if)#exit
For testing purpose I configured only one static translation. You may use following commands to configure the translation for
remaining address.
RR22 SSttaattiicc N
NAATT CCoonnffiigguurraattiioonn
R2(config)#ip nat inside source static 192.168.1.10 200.0.0.10
R2(config)#interface FastEthernet 0/0
R2(config-if)#ip nat inside
R2(config-if)#exit
R2(config)#
R2(config)#interface Serial 0/0/0
R2(config-if)#ip nat outside
R2(config-if)#exit
Before we test this lab we need to configure the IP routing. IP routing is the process which allows router to route the packet between
different networks. Following tutorial explain routing in detail with examples
TTeessttiinngg SSttaattiicc N
NAATT CCoonnffiigguurraattiioonn
In this lab we configured static NAT on R1 and R2. On R1 we mapped inside local IP address 10.0.0.10 with inside global address
50.0.0.10 while on R2 we mapped inside local IP address 192.168.1.10 with inside global IP address 200.0.0.10.
To test this setup click Laptop0 and Desktop and click Command Prompt.
First command verifies that we are testing from correct NAT device.
Second command checks whether we are able to access the remote device or not. A ping reply confirms that we are able to connect
with remote device on this IP address.
Third command checks whether we are able to access the remote device on its actual IP address or not. A ping error confirms that we
are not able to connect with remote device on this IP address.
Let’s do one more testing. Click Laptop0 and click Desktop and click Web Browser and access 200.0.0.10.
Above figure confirms that host 10.0.0.10 is able to access the 200.0.0.10.
Why we are not able to connect with the remote device from this host?
Because we configured NAT only for one host (Laptop0) which IP address is 10.0.0.10. So only the host 10.0.0.10 will be able to access
the remote device.
To confirm it again, let’s try to access web service from this host.
If you followed this tutorial step by step, you should get the same output of testing. Although it’s very rare but some time you may get
different output. To figure out what went wrong you can use my practice topology with all above configuration. Download my pr actice
topology
We can also verify this translation on router with show ip nat translation command.
The actual IP address is not listed here because router is receiving packets after the translation. From R1’s point of view remote
device’s IP address is 200.0.0.10 while from R2’s point of view end device’s IP address is 50.0.0.10.
This way if NAT is enabled we would not be able to trace the actual end device.