NAT Configuration
NAT Configuration
NAT is a very important tool in an IPv4 network, because you may remember we have 2
network types (private - RFC 1918 and public - formally called internet).
There are several types and ways to configure NAT, but we will only focus on the "common
and must use ones" this are for CCNA purposes.
Static NAT is a very simple NAT configuration where it works for inbound and outbound
traffic, in other words, we can use this to access a server from outside (some books call this as
DMZ)
From ExternalPC open firefox and browse 189.203.32.10 this actually doesn't work, but if
you browse youtube or facebook, it should work
The first thing we need to do is configure the interfaces with the correct nat role
(inside/outside)
On R1
# Now it is time to configure the nat rule (static nat, also called one to one)
again, from ExternalPC try to open 189.203.32.10 (nagiosadmin/nagios), now it works, also
if you use the port of graphito (189.203.32.10:8080) it also works, because we consider to nat
all the 189.203.32.10 to 192.168.40.20
you can also use show ip nat translations to observe how it is working or debug ip nat
The cold truth here is that we will need a public IP for each private IP, let try the next Task
Task 2 - Static NAT with Port forward
Most of the time we have some limited Public IP's, also most of the times our Public IP is
dynamic, we can still use Static NAT, but in order to several Servers use the same public IP,
we will add port forwarding
At this moment you should have the interfaces as nat inside/outside, if don't you need to do it
first.
this time we only will add the NAT rules as follow, notice that you can't use the same port
twice (the public one), but you can forward to another port.
ip nat inside source static tcp 192.168.40.10 80 interface ethernet 0/0 80
ip nat inside source static tcp 192.168.40.10 80 interface ethernet 0/0 9000
ip nat inside source static tcp 192.168.40.40 3000 interface ethernet 0/0 777
ip nat inside source static tcp 192.168.40.30 80 interface ethernet 0/0 3000
you can also use show ip nat translations to observe how it is working or debug ip nat
At this moment you shoul have the interfaces as nat inside/outside, if don't you need to do it
first.
From all PC's (PC1, PC2, PC3 and PC4) open firefox and open Facebook.
Third one... oops it doesn't work, this is because we only have 2 Public IP, this means only 2
PC's can translate at a time, don't worry we can do a little trick called "overload or pat"
try again, and now all the PC's can go to internet, you can also use show ip nat translations
to observe how it is working or debug ip nat
great job!
Task 4 - PAT
The last type of NAT we will talk is the most used one to go to internet, this is called nat
overloaded or PAT.
try again, and now all the PC's can go to internet, you can also use show ip nat translations
to observe how it is working or debug ip nat
great job!