Icnd210s07 Nat
Icnd210s07 Nat
Network
with NAT
and PAT
Address Space Management
What is NAT ?
The Internet has grown larger than anyone ever imagined it could be. With the
explosion of the Internet and the increase in home networks and business networks,
the number of available IP addresses is simply not enough. The obvious solution is
to redesign the address format to allow for more possible addresses. This is being
developed (called IPv6), but will take several years to implement because it requires
modification of the entire infrastructure of the Internet.
NAT(Network Address Translation ) and
CIDR (Classless Inter Domain Routing) was developed as a interim solution for
prevention to exahusition of ip address
With NAT an internal network has been set up with IP addresses that were not
specifically allocated to any company (Private Address) ,
by IANA (Internet Assigned Numbers Authority), the global authority that hands out IP
addresses. These addresses should be considered non-routable since they are not
unique.
Private Addressing Space
Class RFC 1918 Internal Address Range CIDR Prefix
A 10.0.0.0 - 10.255.255.255 10.0.0.0/8
B 172.16.0.0 - 172.31.255.255. 172.16.0.0/12
C 192.168.0.0 - 192.168.255.255 192.168.0.0/16
A INSIDE OUTSIDE
Web Server
212.10.1.3
192.168.0.3
E0 S0
B PUBLIC NETWORK
NAT (Internet)
192.168.0.5
IP packet IP packet
SRC DST SRC DST
192.168.0.3 212.10.1.3 NAT 85.18.3.1 212.10.1.3
A INSIDE OUTSIDE
Web Server
212.10.1.3
192.168.0.3
E0 S0
B PUBLIC NETWORK
NAT (Internet)
192.168.0.5
IP packet IP packet
SRC DST SRC DST
192.168.0.3 212.10.1.3 85.18.3.1 212.10.1.3
Inside local addr Outside local addr Inside global addr Outside global addr
NAT Table
How is NAT table if Host B
communicate with same server at
the outside , same time with A?
Inside Local Add. Inside Global Add. Ouside Local Add. Ouside Global Add.
A 192.168.0.3 85.18.3.1 212.10.1.3 212.10.1.3
B 192.168.0.5 85.18.3.2 212.10.1.3 212.10.1.3
NAT still limits the number of hosts you can have access the
Internet at the same time (depending upon the number of hosts
in your public network mask.) Because its one-to-one.
For example; You can use /24 subnet mask at the inside, to
define 254 host. But, if you have a /28 Public address pool, only
14 host can be translated at the same time.
Solution :PAT
NAT with PAT
PAT (Port Address Translation) allows you to use a single Public IP
address to represent many inside hosts.
PAT use TCP/UDP source port to track inside Host addresses. Also can
modifies port numbers Why can ? Later
Inside Local Add. Inside Gobal Add. Ouside Local Add. Ouside Global Add.
A 192.168.0.3 : 1453 85.18.3.1 : 1453 212.10.1.3 : 80 212.10.1.3 : 80
B 192.168.0.5 : 1200 85.18.3.1 : 1200 212.10.1.3 : 80 212.10.1.3: 80
!!!!!TCP & UDP port numbers was added to NAT table
PAT (Port Address Translation)
INSIDE OUTSIDE
A
Web Server
212.10.1.3
192.168.0.3
E0 S0
B PUBLIC NETWORK
NAT (Internet)
192.168.0.5
SA DA NAT SA DA
192.168.0.3 : 1453 212.10.1.3 : 80 85.18.3.1 : 1453 212.10.1.3 : 80
SA DA NAT SA DA
192.168.0.5 : 1200 212.10.1.3 : 80 85.18.3.1 : 1200 212.10.1.3 : 80
PAT (Port Address Translation)
INSIDE OUTSIDE
A
Web Server
212.10.1.3
192.168.0.3
E0 S0
B PUBLIC NETWORK
NAT (Internet)
192.168.0.5
Solution: Translate (change) Port number if they same and remember? (PAT)
Why its name is PAT ?
For previous scenario, actually router changes
source port of the packet. The previous example for
just demonstrating.So real NAT table for previous
example look like that;
Inside Local Add. Inside Gobal Add. Ouside Local Add. Ouside Global Add.
Change Source
Port number
interface s0
ip address 85.18.3.1 255.255.255.0
ip nat outside
!
interface e0
ip address 10.10.10.1 255.255.255.0
ip nat inside
!
ip nat inside source static 10.10.10.2 85.18.3.2
INSIDE OUTSIDE
E0 S0 PUBLIC NETWORK
GW (Internet)
ip
ipnat
natpool
poolnathavuzu
nathavuzu85.18.3.1
85.18.3.1 85.18.3.14
85.18.3.14 netmask
netmask255.255.255.240
255.255.255.240
ip nat inside source list 1 pool nathavuzu
ip nat inside source list 1 pool nathavuzu
access-list
access-list11permit
permit10.10.10.0
10.10.10.0 0.0.0.255
0.0.0.255
!!
interface
interfaceethernet0
ethernet0
ip
ip address10.10.10.254
address 255.255.255.0 The
10.10.10.254 255.255.255.0 Thenetwork
networkaddress
address
ip nat inside
ip nat inside you
you have receivedfrom
have received from
!! your ISP is 85.18.3.0/28
your ISP is 85.18.3.0/28
interface serial0
interface serial0
ip
ipaddress
address90.20.3.1
90.20.3.1 255.255.255.252
255.255.255.252
ip nat outside
ip nat outside
Note: Max. 14 host (limited with the pool) can reach outside at the same time.
Configuring Dynamic NAT
with overload keyword (PAT)
10.10.10.0/24
INSIDE OUTSIDE
E0 S0 PUBLIC NETWORK
GW (Internet)
ip
ipnat
natpool
poolnathavuzu
nathavuzu85.18.3.1
85.18.3.1 85.18.3.14
85.18.3.14 netmask
netmask255.255.255.240
255.255.255.240
ip
ipnat
natinside
insidesource
sourcelist
list11pool nathavuzuoverload
poolnathavuzu overload
access-list 1 permit 10.10.10.0 0.0.0.255
access-list 1 permit 10.10.10.0 0.0.0.255
!!
interface
interfaceethernet0
ethernet0
ip Every
Everyhost
host can
canreach
ip address10.10.10.254
address 10.10.10.254 255.255.255.0
255.255.255.0 outside
reach
ip
ipnat
natinside
inside outside at the sametime.
at the same time.
!! By using overload
By using overload
interface keyword
interfaceserial0
serial0 keyword
ip
ipaddress
address90.20.3.1
90.20.3.1 255.255.255.252
255.255.255.252
ip nat outside
ip nat outside
NAT to interface’s address (PAT)
10.10.10.0/24
INSIDE OUTSIDE
E0 S0 PUBLIC NETWORK
GW (Internet)
ip
ipnat
natinside
insidesource
sourcelist
list11interface
interfaceserial
serial00overload
overload
access-list 1 permit 10.10.10.0 0.0.0.255
access-list 1 permit 10.10.10.0 0.0.0.255
!!
interface
interfaceethernet0
ethernet0 By
Bythis
thisway
wayyou youcan
canuse
use
ip address 10.10.10.254 255.255.255.0
ip address 10.10.10.254 255.255.255.0 Interface’s ip address
Interface’s ip address
ip nat inside
ip nat inside for
forNAT
NATitsitssuitable
suitablefor
for
!! where interface address
where interface address
interface serial0 changes
changes.For .Forexample;
example;
interface serial0 ADSL
ip
ipaddress
address90.20.3.1
90.20.3.1255.255.255.252
255.255.255.252 ADSL
ip
ipnat
natoutside
outside
Be careful; Without overload keyword only one host can reach outside.
Interface’s ip address can be staticaly defined or dynamically obtanied from provider
Clearing the NAT Translation Table
RouterX# clear ip nat translation *
Clears all dynamic address translation entries
DISADVANTAGES OF NAT
NAT is not without drawbacks. Enabling address translation
will cause a loss of functionality, particularly with any protocol or
application that involves sending IP address information inside the IP
payload. This requires additional support by the NAT device.
One significant disadvantage when implementing and using NAT is the loss of
end-to-end IP traceability. It becomes much more difficult to trace packets that
undergo numerous packet address changes over multiple NAT hops.
NAT also forces some applications that use IP addressing to stop functioning
because it hides end-to-end IP addresses. Applications that use physical
addresses instead of a qualified domain name will not reach destinations that
are translated across the NAT router. Sometimes, this problem can be avoided
by implementing static NAT mappings.
Clearing the NAT Translation Table
Verify that:
There are no inbound ACLs that are denying the packets entry to
the NAT router
The ACL referenced by the NAT command is permitting all
necessary networks
There are enough addresses in the NAT pool
The router interfaces are appropriately defined as NAT inside or
NAT outside
Displaying Information with show and
debug Commands
RouterX# debug ip nat