<s>
Network	B-Protocol
address	I-Protocol
translation	I-Protocol
(	O
NAT	O
)	O
is	O
a	O
method	O
of	O
mapping	O
an	O
IP	B-Protocol
address	I-Protocol
space	O
into	O
another	O
by	O
modifying	O
network	B-Protocol
address	I-Protocol
information	O
in	O
the	O
IP	B-Protocol
header	I-Protocol
of	O
packets	O
while	O
they	O
are	O
in	O
transit	O
across	O
a	O
traffic	O
routing	B-Protocol
device	I-Protocol
.	O
</s>
<s>
The	O
technique	O
was	O
originally	O
used	O
to	O
bypass	O
the	O
need	O
to	O
assign	O
a	O
new	O
address	O
to	O
every	O
host	O
when	O
a	O
network	O
was	O
moved	O
,	O
or	O
when	O
the	O
upstream	O
Internet	O
service	O
provider	O
was	O
replaced	O
,	O
but	O
could	O
not	O
route	O
the	O
network	O
's	O
address	B-General_Concept
space	I-General_Concept
.	O
</s>
<s>
It	O
has	O
become	O
a	O
popular	O
and	O
essential	O
tool	O
in	O
conserving	O
global	O
address	B-General_Concept
space	I-General_Concept
in	O
the	O
face	O
of	O
IPv4	B-Protocol
address	I-Protocol
exhaustion	I-Protocol
.	O
</s>
<s>
One	O
Internet-routable	O
IP	B-Protocol
address	I-Protocol
of	O
a	O
NAT	O
gateway	O
can	O
be	O
used	O
for	O
an	O
entire	O
private	B-Protocol
network	I-Protocol
.	O
</s>
<s>
As	O
network	B-Protocol
address	I-Protocol
translation	I-Protocol
modifies	O
the	O
IP	B-Protocol
address	I-Protocol
information	O
in	O
packets	O
,	O
NAT	O
implementations	O
may	O
vary	O
in	O
their	O
specific	O
behavior	O
in	O
various	O
addressing	O
cases	O
and	O
their	O
effect	O
on	O
network	O
traffic	O
.	O
</s>
<s>
The	O
simplest	O
type	O
of	O
NAT	O
provides	O
a	O
one-to-one	O
translation	O
of	O
IP	B-Protocol
addresses	I-Protocol
.	O
</s>
<s>
In	O
this	O
type	O
of	O
NAT	O
,	O
only	O
the	O
IP	B-Protocol
addresses	I-Protocol
,	O
IP	B-Protocol
header	I-Protocol
checksum	B-Algorithm
,	O
and	O
any	O
higher-level	O
checksums	B-Algorithm
that	O
include	O
the	O
IP	B-Protocol
address	I-Protocol
are	O
changed	O
.	O
</s>
<s>
The	O
majority	O
of	O
network	B-Protocol
address	I-Protocol
translators	I-Protocol
map	O
multiple	O
private	O
hosts	O
to	O
one	O
publicly	O
exposed	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
A	O
local	B-General_Concept
network	I-General_Concept
uses	O
one	O
of	O
the	O
designated	O
private	B-Protocol
IP	I-Protocol
address	I-Protocol
subnets	O
(	O
RFC	B-Protocol
1918	I-Protocol
)	O
.	O
</s>
<s>
The	O
network	O
has	O
a	O
router	B-Protocol
having	O
both	O
a	O
private	O
and	O
a	O
public	O
address	O
.	O
</s>
<s>
The	O
private	B-Protocol
address	I-Protocol
is	O
used	O
by	O
the	O
router	B-Protocol
for	O
communicating	O
with	O
other	O
devices	O
in	O
the	O
private	O
local	B-General_Concept
network	I-General_Concept
.	O
</s>
<s>
The	O
public	O
address	O
(	O
typically	O
assigned	O
by	O
an	O
Internet	O
service	O
provider	O
)	O
is	O
used	O
by	O
the	O
router	B-Protocol
for	O
communicating	O
with	O
the	O
rest	O
of	O
the	O
Internet	O
.	O
</s>
<s>
As	O
traffic	O
passes	O
from	O
the	O
network	O
to	O
the	O
Internet	O
,	O
the	O
router	B-Protocol
translates	O
the	O
source	O
address	O
in	O
each	O
packet	O
from	O
a	O
private	B-Protocol
address	I-Protocol
to	O
the	O
router	B-Protocol
's	O
own	O
public	O
address	O
.	O
</s>
<s>
The	O
router	B-Protocol
tracks	O
basic	O
data	O
about	O
each	O
active	O
connection	O
(	O
particularly	O
the	O
destination	O
address	O
and	O
port	B-Protocol
)	O
.	O
</s>
<s>
When	O
the	O
router	B-Protocol
receives	O
inbound	O
traffic	O
from	O
the	O
Internet	O
,	O
it	O
uses	O
the	O
connection	O
tracking	O
data	O
it	O
stored	O
during	O
the	O
outbound	O
phase	O
to	O
determine	O
to	O
which	O
private	B-Protocol
address	I-Protocol
(	O
if	O
any	O
)	O
it	O
should	O
forward	O
the	O
reply	O
.	O
</s>
<s>
All	O
IP	O
packets	O
have	O
a	O
source	O
IP	B-Protocol
address	I-Protocol
and	O
a	O
destination	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
Typically	O
,	O
packets	O
passing	O
from	O
the	O
private	B-Protocol
network	I-Protocol
to	O
the	O
public	O
network	O
will	O
have	O
their	O
source	O
address	O
modified	O
,	O
while	O
packets	O
passing	O
from	O
the	O
public	O
network	O
back	O
to	O
the	O
private	B-Protocol
network	I-Protocol
will	O
have	O
their	O
destination	O
address	O
modified	O
.	O
</s>
<s>
The	O
vast	O
bulk	O
of	O
Internet	O
traffic	O
uses	O
Transmission	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
(	O
TCP	B-Protocol
)	O
or	O
User	B-Protocol
Datagram	I-Protocol
Protocol	I-Protocol
(	O
UDP	B-Protocol
)	O
.	O
</s>
<s>
For	O
these	O
protocols	O
,	O
the	O
port	B-Protocol
numbers	I-Protocol
are	O
changed	O
so	O
that	O
the	O
combination	O
of	O
IP	B-Protocol
address	I-Protocol
(	O
within	O
the	O
IP	B-Protocol
header	I-Protocol
)	O
and	O
port	B-Protocol
number	I-Protocol
(	O
within	O
the	O
Transport	B-Architecture
Layer	I-Architecture
header	O
)	O
on	O
the	O
returned	O
packet	O
can	O
be	O
unambiguously	O
mapped	O
to	O
the	O
corresponding	O
private	B-Protocol
network	I-Protocol
destination	O
.	O
</s>
<s>
RFC	O
2663	O
uses	O
the	O
term	O
network	B-Protocol
address	I-Protocol
and	I-Protocol
port	I-Protocol
translation	I-Protocol
(	O
NAPT	O
)	O
for	O
this	O
type	O
of	O
NAT	O
.	O
</s>
<s>
Other	O
names	O
include	O
port	B-Protocol
address	O
translation	O
(	O
PAT	O
)	O
,	O
IP	B-Protocol
masquerading	I-Protocol
,	O
NAT	B-Protocol
overload	I-Protocol
and	O
many-to-one	O
NAT	O
.	O
</s>
<s>
This	O
method	O
allows	O
communication	O
through	O
the	O
router	B-Protocol
only	O
when	O
the	O
conversation	O
originates	O
in	O
the	O
private	B-Protocol
network	I-Protocol
,	O
since	O
the	O
initial	O
originating	O
transmission	O
is	O
what	O
establishes	O
the	O
required	O
information	O
in	O
the	O
translation	O
tables	O
.	O
</s>
<s>
Thus	O
a	O
web	B-Application
browser	I-Application
within	O
the	O
private	B-Protocol
network	I-Protocol
would	O
be	O
able	O
to	O
browse	O
websites	O
that	O
are	O
outside	O
the	O
network	O
,	O
whereas	O
web	B-Application
browsers	I-Application
outside	O
the	O
network	O
would	O
be	O
unable	O
to	O
browse	O
a	O
website	O
hosted	O
within	O
.	O
</s>
<s>
Protocols	O
not	O
based	O
on	O
TCP	B-Protocol
and	O
UDP	B-Protocol
require	O
other	O
translation	O
techniques	O
.	O
</s>
<s>
An	O
additional	O
benefit	O
of	O
one-to-many	O
NAT	O
is	O
that	O
it	O
mitigates	O
IPv4	B-Protocol
address	I-Protocol
exhaustion	I-Protocol
by	O
allowing	O
entire	O
networks	O
to	O
be	O
connected	O
to	O
the	O
Internet	O
using	O
a	O
single	O
public	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
Network	B-Protocol
address	I-Protocol
and	I-Protocol
port	I-Protocol
translation	I-Protocol
may	O
be	O
implemented	O
in	O
several	O
ways	O
.	O
</s>
<s>
Some	O
applications	O
that	O
use	O
IP	B-Protocol
address	I-Protocol
information	O
may	O
need	O
to	O
determine	O
the	O
external	O
address	O
of	O
a	O
network	B-Protocol
address	I-Protocol
translator	I-Protocol
.	O
</s>
<s>
For	O
this	O
purpose	O
,	O
RFC	O
3489	O
specified	O
a	O
protocol	O
called	O
Simple	B-Protocol
Traversal	I-Protocol
of	I-Protocol
UDP	I-Protocol
over	I-Protocol
NATs	I-Protocol
(	O
STUN	B-Protocol
)	O
in	O
2003	O
.	O
</s>
<s>
It	O
classified	O
NAT	O
implementations	O
as	O
full-cone	O
NAT	O
,	O
(	O
address	O
)	O
restricted-cone	O
NAT	O
,	O
port-restricted	O
cone	O
NAT	O
or	O
symmetric	O
NAT	O
,	O
and	O
proposed	O
a	O
methodology	O
for	O
testing	O
a	O
device	O
accordingly	O
.	O
</s>
<s>
RFC	O
5389	O
standardized	O
new	O
methods	O
in	O
2008	O
and	O
the	O
acronym	O
STUN	B-Protocol
now	O
represents	O
the	O
new	O
title	O
of	O
the	O
specification	O
:	O
Session	B-Protocol
Traversal	I-Protocol
Utilities	I-Protocol
for	I-Protocol
NAT	I-Protocol
.	O
</s>
<s>
"	O
Any	O
"	O
means	O
the	O
port	B-Protocol
number	I-Protocol
does	O
n't	O
matter	O
.	O
</s>
<s>
right|400px	O
Port-restricted	O
cone	O
NAT	O
Like	O
an	O
address	O
restricted	O
cone	O
NAT	O
,	O
but	O
the	O
restriction	O
includes	O
port	B-Protocol
numbers	I-Protocol
.	O
</s>
<s>
The	O
combination	O
of	O
one	O
internal	B-Protocol
IP	I-Protocol
address	I-Protocol
plus	O
a	O
destination	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
is	O
mapped	O
to	O
a	O
single	O
unique	O
external	O
source	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
;	O
if	O
the	O
same	O
internal	O
host	O
sends	O
a	O
packet	O
even	O
with	O
the	O
same	O
source	O
address	O
and	O
port	B-Protocol
but	O
to	O
a	O
different	O
destination	O
,	O
a	O
different	O
mapping	O
is	O
used	O
.	O
</s>
<s>
For	O
the	O
first	O
bullet	O
in	O
each	O
row	O
of	O
the	O
above	O
table	O
,	O
the	O
RFC	O
would	O
characterize	O
Full-Cone	O
,	O
Restricted-Cone	O
,	O
and	O
Port-Restricted	O
Cone	O
NATs	O
as	O
having	O
an	O
Endpoint-Independent	O
Mapping	O
,	O
whereas	O
it	O
would	O
characterize	O
a	O
Symmetric	O
NAT	O
as	O
having	O
an	O
Address	O
-	O
and	O
Port-Dependent	O
Mapping	O
.	O
</s>
<s>
For	O
the	O
second	O
bullet	O
in	O
each	O
row	O
of	O
the	O
above	O
table	O
,	O
RFC	O
4787	O
would	O
also	O
label	O
Full-Cone	O
NAT	O
as	O
having	O
an	O
Endpoint-Independent	O
Filtering	O
,	O
Restricted-Cone	O
NAT	O
as	O
having	O
an	O
Address-Dependent	O
Filtering	O
,	O
Port-Restricted	O
Cone	O
NAT	O
as	O
having	O
an	O
Address	O
and	O
Port-Dependent	O
Filtering	O
,	O
and	O
Symmetric	O
NAT	O
as	O
having	O
either	O
an	O
Address-Dependent	O
Filtering	O
or	O
Address	O
and	O
Port-Dependent	O
Filtering	O
.	O
</s>
<s>
Specifically	O
,	O
most	O
NATs	O
combine	O
symmetric	O
NAT	O
for	O
outgoing	O
connections	O
with	O
static	O
port	B-Protocol
mapping	I-Protocol
,	O
where	O
incoming	O
packets	O
addressed	O
to	O
the	O
external	O
address	O
and	O
port	B-Protocol
are	O
redirected	O
to	O
a	O
specific	O
internal	O
address	O
and	O
port	B-Protocol
.	O
</s>
<s>
The	O
NAT	B-Protocol
traversal	I-Protocol
problem	O
arises	O
when	O
peers	O
behind	O
different	O
NATs	O
try	O
to	O
communicate	O
.	O
</s>
<s>
One	O
way	O
to	O
solve	O
this	O
problem	O
is	O
to	O
use	O
port	B-Protocol
forwarding	I-Protocol
.	O
</s>
<s>
Another	O
way	O
is	O
to	O
use	O
various	O
NAT	B-Protocol
traversal	I-Protocol
techniques	O
.	O
</s>
<s>
The	O
most	O
popular	O
technique	O
for	O
TCP	B-Protocol
NAT	B-Protocol
traversal	I-Protocol
is	O
TCP	B-Protocol
hole	O
punching	O
.	O
</s>
<s>
TCP	B-Protocol
hole	O
punching	O
requires	O
the	O
NAT	O
to	O
follow	O
the	O
port	B-Protocol
preservation	O
design	O
for	O
TCP	B-Protocol
.	O
</s>
<s>
For	O
a	O
given	O
outgoing	O
TCP	B-Protocol
communication	O
,	O
the	O
same	O
port	B-Protocol
numbers	I-Protocol
are	O
used	O
on	O
both	O
sides	O
of	O
the	O
NAT	O
.	O
</s>
<s>
NAT	O
port	B-Protocol
preservation	O
for	O
outgoing	O
TCP	B-Protocol
connections	O
is	O
crucial	O
for	O
TCP	B-Protocol
NAT	B-Protocol
traversal	I-Protocol
because	O
,	O
under	O
TCP	B-Protocol
,	O
one	O
port	B-Protocol
can	O
only	O
be	O
used	O
for	O
one	O
communication	O
at	O
a	O
time	O
,	O
so	O
programs	O
bind	O
distinct	O
TCP	B-Protocol
sockets	I-Protocol
to	O
ephemeral	B-Protocol
ports	I-Protocol
for	O
each	O
TCP	B-Protocol
communication	O
,	O
rendering	O
NAT	O
port	B-Protocol
prediction	O
impossible	O
for	O
TCP	B-Protocol
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
for	O
UDP	B-Protocol
,	O
NATs	O
do	O
not	O
need	O
port	B-Protocol
preservation	O
.	O
</s>
<s>
Indeed	O
,	O
multiple	O
UDP	B-Protocol
communications	O
(	O
each	O
with	O
a	O
distinct	O
endpoint	B-Protocol
)	O
can	O
occur	O
on	O
the	O
same	O
source	O
port	B-Protocol
,	O
and	O
applications	O
usually	O
reuse	O
the	O
same	O
UDP	B-Protocol
socket	I-Protocol
to	O
send	O
packets	O
to	O
distinct	O
hosts	O
.	O
</s>
<s>
This	O
makes	O
port	B-Protocol
prediction	O
straightforward	O
,	O
as	O
it	O
is	O
the	O
same	O
source	O
port	B-Protocol
for	O
each	O
packet	O
.	O
</s>
<s>
Furthermore	O
,	O
port	B-Protocol
preservation	O
in	O
NAT	O
for	O
TCP	B-Protocol
allows	O
P2P	O
protocols	O
to	O
offer	O
less	O
complexity	O
and	O
less	O
latency	O
because	O
there	O
is	O
no	O
need	O
to	O
use	O
a	O
third	O
party	O
(	O
like	O
STUN	B-Protocol
)	O
to	O
discover	O
the	O
NAT	O
port	B-Protocol
since	O
the	O
application	O
itself	O
already	O
knows	O
the	O
NAT	O
port	B-Protocol
.	O
</s>
<s>
However	O
,	O
if	O
two	O
internal	O
hosts	O
attempt	O
to	O
communicate	O
with	O
the	O
same	O
external	O
host	O
using	O
the	O
same	O
port	B-Protocol
number	I-Protocol
,	O
the	O
NAT	O
may	O
attempt	O
to	O
use	O
a	O
different	O
external	O
IP	B-Protocol
address	I-Protocol
for	O
the	O
second	O
connection	O
or	O
may	O
need	O
to	O
forgo	O
port	B-Protocol
preservation	O
and	O
remap	O
the	O
port	B-Protocol
.	O
</s>
<s>
Every	O
TCP	B-Protocol
and	O
UDP	B-Protocol
packet	I-Protocol
contains	O
a	O
source	O
port	B-Protocol
number	I-Protocol
and	O
a	O
destination	O
port	B-Protocol
number	I-Protocol
.	O
</s>
<s>
Each	O
of	O
those	O
packets	O
is	O
encapsulated	O
in	O
an	O
IP	O
packet	O
,	O
whose	O
IP	B-Protocol
header	I-Protocol
contains	O
a	O
source	O
IP	B-Protocol
address	I-Protocol
and	O
a	O
destination	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
The	O
IP	O
address/protocol/port	O
number	O
triple	O
defines	O
an	O
association	O
with	O
a	O
network	B-Protocol
socket	I-Protocol
.	O
</s>
<s>
For	O
publicly	O
accessible	O
services	O
such	O
as	O
web	O
and	O
mail	O
servers	O
the	O
port	B-Protocol
number	I-Protocol
is	O
important	O
.	O
</s>
<s>
For	O
example	O
,	O
port	B-Protocol
80	O
connects	O
through	O
a	O
socket	O
to	O
the	O
web	B-Application
server	I-Application
software	O
and	O
port	B-Protocol
25	I-Protocol
to	O
a	O
mail	O
server	B-Application
's	O
SMTP	B-Protocol
daemon	B-Operating_System
.	O
</s>
<s>
The	O
IP	B-Protocol
address	I-Protocol
of	O
a	O
public	O
server	B-Application
is	O
also	O
important	O
,	O
similar	O
in	O
global	O
uniqueness	O
to	O
a	O
postal	O
address	O
or	O
telephone	O
number	O
.	O
</s>
<s>
Both	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
number	I-Protocol
must	O
be	O
correctly	O
known	O
by	O
all	O
hosts	O
wishing	O
to	O
successfully	O
communicate	O
.	O
</s>
<s>
Private	B-Protocol
IP	I-Protocol
addresses	I-Protocol
as	O
described	O
in	O
RFC	B-Protocol
1918	I-Protocol
are	O
usable	O
only	O
on	O
private	B-Protocol
networks	I-Protocol
not	O
directly	O
connected	O
to	O
the	O
internet	O
.	O
</s>
<s>
Ports	O
are	O
endpoints	O
of	O
communication	O
unique	O
to	O
that	O
host	O
,	O
so	O
a	O
connection	O
through	O
the	O
NAT	B-Protocol
device	I-Protocol
is	O
maintained	O
by	O
the	O
combined	O
mapping	O
of	O
port	B-Protocol
and	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
A	O
private	B-Protocol
address	I-Protocol
on	O
the	O
inside	O
of	O
the	O
NAT	O
is	O
mapped	O
to	O
an	O
external	O
public	O
address	O
.	O
</s>
<s>
Port	B-Protocol
address	O
translation	O
(	O
PAT	O
)	O
resolves	O
conflicts	O
that	O
arise	O
when	O
multiple	O
hosts	O
happen	O
to	O
use	O
the	O
same	O
source	O
port	B-Protocol
number	I-Protocol
to	O
establish	O
different	O
external	O
connections	O
at	O
the	O
same	O
time	O
.	O
</s>
<s>
A	O
NAT	B-Protocol
device	I-Protocol
is	O
similar	O
to	O
a	O
phone	O
system	O
at	O
an	O
office	O
that	O
has	O
one	O
public	O
telephone	O
number	O
and	O
multiple	O
extensions	O
.	O
</s>
<s>
In	O
this	O
scenario	O
,	O
the	O
office	O
is	O
a	O
private	O
LAN	B-General_Concept
,	O
the	O
main	O
phone	O
number	O
is	O
the	O
public	O
IP	B-Protocol
address	I-Protocol
,	O
and	O
the	O
individual	O
extensions	O
are	O
unique	O
port	B-Protocol
numbers	I-Protocol
.	O
</s>
<s>
With	O
NAT	O
,	O
all	O
communications	O
sent	O
to	O
external	O
hosts	O
actually	O
contain	O
the	O
external	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
information	O
of	O
the	O
NAT	B-Protocol
device	I-Protocol
instead	O
of	O
internal	O
host	O
IP	B-Protocol
addresses	I-Protocol
or	O
port	B-Protocol
numbers	I-Protocol
.	O
</s>
<s>
NAT	O
only	O
translates	O
IP	B-Protocol
addresses	I-Protocol
and	O
ports	O
of	O
its	O
internal	O
hosts	O
,	O
hiding	O
the	O
true	O
endpoint	B-Protocol
of	O
an	O
internal	O
host	O
on	O
a	O
private	B-Protocol
network	I-Protocol
.	O
</s>
<s>
When	O
a	O
computer	O
on	O
the	O
private	O
(	O
internal	O
)	O
network	O
sends	O
an	O
IP	O
packet	O
to	O
the	O
external	O
network	O
,	O
the	O
NAT	B-Protocol
device	I-Protocol
replaces	O
the	O
internal	O
source	O
IP	B-Protocol
address	I-Protocol
in	O
the	O
packet	O
header	O
with	O
the	O
external	O
IP	B-Protocol
address	I-Protocol
of	O
the	O
NAT	B-Protocol
device	I-Protocol
.	O
</s>
<s>
PAT	O
may	O
then	O
assign	O
the	O
connection	O
a	O
port	B-Protocol
number	I-Protocol
from	O
a	O
pool	O
of	O
available	O
ports	O
,	O
inserting	O
this	O
port	B-Protocol
number	I-Protocol
in	O
the	O
source	O
port	B-Protocol
field	O
.	O
</s>
<s>
The	O
NAT	B-Protocol
device	I-Protocol
then	O
makes	O
an	O
entry	O
in	O
a	O
translation	O
table	O
containing	O
the	O
internal	B-Protocol
IP	I-Protocol
address	I-Protocol
,	O
original	O
source	O
port	B-Protocol
,	O
and	O
the	O
translated	O
source	O
port	B-Protocol
.	O
</s>
<s>
Subsequent	O
packets	O
from	O
the	O
same	O
internal	O
source	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
number	I-Protocol
are	O
translated	O
to	O
the	O
same	O
external	O
source	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
number	I-Protocol
.	O
</s>
<s>
The	O
computer	O
receiving	O
a	O
packet	O
that	O
has	O
undergone	O
NAT	O
establishes	O
a	O
connection	O
to	O
the	O
port	B-Protocol
and	O
IP	B-Protocol
address	I-Protocol
specified	O
in	O
the	O
altered	O
packet	O
,	O
oblivious	O
to	O
the	O
fact	O
that	O
the	O
supplied	O
address	O
is	O
being	O
translated	O
.	O
</s>
<s>
Upon	O
receiving	O
a	O
packet	O
from	O
the	O
external	O
network	O
,	O
the	O
NAT	B-Protocol
device	I-Protocol
searches	O
the	O
translation	O
table	O
based	O
on	O
the	O
destination	O
port	B-Protocol
in	O
the	O
packet	O
header	O
.	O
</s>
<s>
If	O
a	O
match	O
is	O
found	O
,	O
the	O
destination	O
IP	B-Protocol
address	I-Protocol
and	O
port	B-Protocol
number	I-Protocol
is	O
replaced	O
with	O
the	O
values	O
found	O
in	O
the	O
table	O
and	O
the	O
packet	O
is	O
forwarded	O
to	O
the	O
inside	O
network	O
.	O
</s>
<s>
Otherwise	O
,	O
if	O
the	O
destination	O
port	B-Protocol
number	I-Protocol
of	O
the	O
incoming	O
packet	O
is	O
not	O
found	O
in	O
the	O
translation	O
table	O
,	O
the	O
packet	O
is	O
dropped	O
or	O
rejected	O
because	O
the	O
PAT	O
device	O
does	O
n't	O
know	O
where	O
to	O
send	O
it	O
.	O
</s>
<s>
The	O
NAT	B-Protocol
device	I-Protocol
may	O
function	O
as	O
the	O
default	B-Protocol
gateway	I-Protocol
for	O
the	O
internal	O
host	O
which	O
is	O
typically	O
aware	O
of	O
the	O
true	O
IP	B-Protocol
address	I-Protocol
and	O
TCP	B-Protocol
or	O
UDP	B-Protocol
port	B-Protocol
of	O
the	O
external	O
host	O
.	O
</s>
<s>
However	O
,	O
the	O
external	O
host	O
is	O
only	O
aware	O
of	O
the	O
public	O
IP	B-Protocol
address	I-Protocol
for	O
the	O
NAT	B-Protocol
device	I-Protocol
and	O
the	O
particular	O
port	B-Protocol
being	O
used	O
to	O
communicate	O
on	O
behalf	O
of	O
a	O
specific	O
internal	O
host	O
.	O
</s>
<s>
Routing	B-Protocol
Network	B-Protocol
address	I-Protocol
translation	I-Protocol
can	O
be	O
used	O
to	O
mitigate	O
IP	B-Protocol
address	I-Protocol
overlap	O
.	O
</s>
<s>
Address	O
overlap	O
occurs	O
when	O
hosts	O
in	O
different	O
networks	O
with	O
the	O
same	O
IP	B-Protocol
address	I-Protocol
space	O
try	O
to	O
reach	O
the	O
same	O
destination	O
host	O
.	O
</s>
<s>
This	O
is	O
most	O
often	O
a	O
misconfiguration	O
and	O
may	O
result	O
from	O
the	O
merger	O
of	O
two	O
networks	O
or	O
subnets	O
,	O
especially	O
when	O
using	O
RFC	B-Protocol
1918	I-Protocol
private	B-Protocol
network	I-Protocol
addressing	O
.	O
</s>
<s>
The	O
destination	O
host	O
experiences	O
traffic	O
apparently	O
arriving	O
from	O
the	O
same	O
network	O
,	O
and	O
intermediate	O
routers	B-Protocol
have	O
no	O
way	O
to	O
determine	O
where	O
reply	O
traffic	O
should	O
be	O
sent	O
to	O
.	O
</s>
<s>
The	O
solution	O
is	O
either	O
renumbering	O
to	O
eliminate	O
overlap	O
or	O
network	B-Protocol
address	I-Protocol
translation	I-Protocol
.	O
</s>
<s>
Load	B-Application
balancing	I-Application
In	O
client	B-Operating_System
–	I-Operating_System
server	I-Operating_System
applications	O
,	O
load	B-Application
balancers	I-Application
forward	O
client	O
requests	O
to	O
a	O
set	O
of	O
server	B-Application
computers	I-Application
to	O
manage	O
the	O
workload	O
of	O
each	O
server	B-Application
.	O
</s>
<s>
Network	B-Protocol
address	I-Protocol
translation	I-Protocol
may	O
be	O
used	O
to	O
map	O
a	O
representative	O
IP	B-Protocol
address	I-Protocol
of	O
the	O
server	B-Application
cluster	O
to	O
specific	O
hosts	O
that	O
service	O
the	O
request	O
.	O
</s>
<s>
IEEE	O
Reverse	B-Protocol
Address	I-Protocol
and	I-Protocol
Port	I-Protocol
Translation	I-Protocol
(	O
RAPT	O
or	O
RAT	O
)	O
allows	O
a	O
host	O
whose	O
real	O
IP	B-Protocol
address	I-Protocol
changes	O
from	O
time	O
to	O
time	O
to	O
remain	O
reachable	O
as	O
a	O
server	B-Application
via	O
a	O
fixed	O
home	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
Cisco	O
's	O
RAPT	O
implementation	O
is	O
PAT	O
or	O
NAT	O
overloading	O
and	O
maps	O
multiple	O
private	B-Protocol
IP	I-Protocol
addresses	I-Protocol
to	O
a	O
single	O
public	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
Multiple	O
addresses	O
can	O
be	O
mapped	O
to	O
a	O
single	O
address	O
because	O
each	O
private	B-Protocol
address	I-Protocol
is	O
tracked	O
by	O
a	O
port	B-Protocol
number	I-Protocol
.	O
</s>
<s>
PAT	O
uses	O
unique	O
source	O
port	B-Protocol
numbers	I-Protocol
on	O
the	O
inside	O
global	O
IP	B-Protocol
address	I-Protocol
to	O
distinguish	O
between	O
translations	O
.	O
</s>
<s>
PAT	O
attempts	O
to	O
preserve	O
the	O
original	O
source	O
port	B-Protocol
.	O
</s>
<s>
If	O
this	O
source	O
port	B-Protocol
is	O
already	O
used	O
,	O
PAT	O
assigns	O
the	O
first	O
available	O
port	B-Protocol
number	I-Protocol
starting	O
from	O
the	O
beginning	O
of	O
the	O
appropriate	O
port	B-Protocol
group	O
0	O
–	O
511	O
,	O
512	O
–	O
1023	O
,	O
or	O
1024	O
–	O
65535	O
.	O
</s>
<s>
When	O
there	O
are	O
no	O
more	O
ports	O
available	O
and	O
there	O
is	O
more	O
than	O
one	O
external	O
IP	B-Protocol
address	I-Protocol
configured	O
,	O
PAT	O
moves	O
to	O
the	O
next	O
IP	B-Protocol
address	I-Protocol
to	O
try	O
to	O
allocate	O
the	O
original	O
source	O
port	B-Protocol
again	O
.	O
</s>
<s>
This	O
process	O
continues	O
until	O
it	O
runs	O
out	O
of	O
available	O
ports	O
and	O
external	O
IP	B-Protocol
addresses	I-Protocol
.	O
</s>
<s>
Mapping	B-Protocol
of	I-Protocol
Address	I-Protocol
and	I-Protocol
Port	I-Protocol
is	O
a	O
Cisco	O
proposal	O
that	O
combines	O
Address	B-Protocol
plus	I-Protocol
Port	I-Protocol
translation	O
with	O
tunneling	O
of	O
the	O
IPv4	O
packets	O
over	O
an	O
ISP	O
provider	O
's	O
internal	O
IPv6	B-Protocol
network	O
.	O
</s>
<s>
In	O
effect	O
,	O
it	O
is	O
an	O
(	O
almost	O
)	O
stateless	B-Protocol
alternative	O
to	O
carrier-grade	B-Protocol
NAT	I-Protocol
and	O
DS-Lite	O
that	O
pushes	O
the	O
IPv4	O
address/port	O
translation	O
function	O
(	O
and	O
the	O
maintenance	O
of	O
NAT	O
state	O
)	O
entirely	O
into	O
the	O
existing	O
customer	O
premises	O
equipment	O
NAT	O
implementation	O
.	O
</s>
<s>
Thus	O
avoiding	O
the	O
NAT444	B-Protocol
and	O
statefulness	O
problems	O
of	O
carrier-grade	B-Protocol
NAT	I-Protocol
,	O
and	O
also	O
provides	O
a	O
transition	O
mechanism	O
for	O
the	O
deployment	O
of	O
native	O
IPv6	B-Protocol
at	O
the	O
same	O
time	O
with	O
very	O
little	O
added	O
complexity	O
.	O
</s>
<s>
Hosts	O
behind	O
NAT-enabled	O
routers	B-Protocol
do	O
not	O
have	O
end-to-end	B-Application
connectivity	I-Application
and	O
cannot	O
participate	O
in	O
some	O
internet	O
protocols	O
.	O
</s>
<s>
Services	O
that	O
require	O
the	O
initiation	O
of	O
TCP	B-Protocol
connections	O
from	O
the	O
outside	O
network	O
,	O
or	O
that	O
use	O
stateless	B-Protocol
protocols	I-Protocol
such	O
as	O
those	O
using	O
UDP	B-Protocol
,	O
can	O
be	O
disrupted	O
.	O
</s>
<s>
Unless	O
the	O
NAT	O
router	B-Protocol
makes	O
a	O
specific	O
effort	O
to	O
support	O
such	O
protocols	O
,	O
incoming	O
packets	O
cannot	O
reach	O
their	O
destination	O
.	O
</s>
<s>
Some	O
protocols	O
can	O
accommodate	O
one	O
instance	O
of	O
NAT	O
between	O
participating	O
hosts	O
(	O
"	O
passive	O
mode	O
"	O
FTP	B-Protocol
,	O
for	O
example	O
)	O
,	O
sometimes	O
with	O
the	O
assistance	O
of	O
an	O
application-level	O
gateway	O
(	O
see	O
)	O
,	O
but	O
fail	O
when	O
both	O
systems	O
are	O
separated	O
from	O
the	O
internet	O
by	O
NAT	O
.	O
</s>
<s>
The	O
use	O
of	O
NAT	O
also	O
complicates	O
tunneling	B-Protocol
protocols	I-Protocol
such	O
as	O
IPsec	B-Protocol
because	O
NAT	O
modifies	O
values	O
in	O
the	O
headers	O
which	O
interfere	O
with	O
the	O
integrity	O
checks	O
done	O
by	O
IPsec	B-Protocol
and	O
other	O
tunneling	B-Protocol
protocols	I-Protocol
.	O
</s>
<s>
End-to-end	B-Application
connectivity	I-Application
has	O
been	O
a	O
core	O
principle	O
of	O
the	O
Internet	O
,	O
supported	O
,	O
for	O
example	O
,	O
by	O
the	O
Internet	O
Architecture	O
Board	O
.	O
</s>
<s>
Current	O
Internet	O
architectural	O
documents	O
observe	O
that	O
NAT	O
is	O
a	O
violation	O
of	O
the	O
end-to-end	B-Application
principle	I-Application
,	O
but	O
that	O
NAT	O
does	O
have	O
a	O
valid	O
role	O
in	O
careful	O
design	O
.	O
</s>
<s>
There	O
is	O
considerably	O
more	O
concern	O
with	O
the	O
use	O
of	O
IPv6	B-Protocol
NAT	O
,	O
and	O
many	O
IPv6	B-Protocol
architects	O
believe	O
IPv6	B-Protocol
was	O
intended	O
to	O
remove	O
the	O
need	O
for	O
NAT	O
.	O
</s>
<s>
An	O
implementation	O
that	O
only	O
tracks	O
ports	O
can	O
be	O
quickly	O
depleted	O
by	O
internal	O
applications	O
that	O
use	O
multiple	O
simultaneous	O
connections	O
such	O
as	O
an	O
HTTP	B-Protocol
request	O
for	O
a	O
web	O
page	O
with	O
many	O
embedded	O
objects	O
.	O
</s>
<s>
This	O
problem	O
can	O
be	O
mitigated	O
by	O
tracking	O
the	O
destination	O
IP	B-Protocol
address	I-Protocol
in	O
addition	O
to	O
the	O
port	B-Protocol
thus	O
sharing	O
a	O
single	O
local	O
port	B-Protocol
with	O
many	O
remote	O
hosts	O
.	O
</s>
<s>
Applications	O
such	O
as	O
VOIP	B-Application
,	O
videoconferencing	B-Application
,	O
and	O
other	O
peer-to-peer	O
applications	O
must	O
use	O
NAT	B-Protocol
traversal	I-Protocol
techniques	O
to	O
function	O
.	O
</s>
<s>
Pure	O
NAT	O
,	O
operating	O
on	O
IP	O
alone	O
,	O
may	O
or	O
may	O
not	O
correctly	O
parse	O
protocols	O
with	O
payloads	O
containing	O
information	O
about	O
IP	O
,	O
such	O
as	O
ICMP	B-Protocol
.	O
</s>
<s>
Basic	O
protocols	O
as	O
TCP	B-Protocol
and	O
UDP	B-Protocol
cannot	O
function	O
properly	O
unless	O
NAT	O
takes	O
action	O
beyond	O
the	O
network	B-Application
layer	I-Application
.	O
</s>
<s>
IP	O
packets	O
have	O
a	O
checksum	B-Algorithm
in	O
each	O
packet	O
header	O
,	O
which	O
provides	O
error	O
detection	O
only	O
for	O
the	O
header	O
.	O
</s>
<s>
IP	O
datagrams	O
may	O
become	O
fragmented	O
and	O
it	O
is	O
necessary	O
for	O
a	O
NAT	O
to	O
reassemble	O
these	O
fragments	O
to	O
allow	O
correct	O
recalculation	O
of	O
higher-level	O
checksums	B-Algorithm
and	O
correct	O
tracking	O
of	O
which	O
packets	O
belong	O
to	O
which	O
connection	O
.	O
</s>
<s>
TCP	B-Protocol
and	O
UDP	B-Protocol
,	O
have	O
a	O
checksum	B-Algorithm
that	O
covers	O
all	O
the	O
data	O
they	O
carry	O
,	O
as	O
well	O
as	O
the	O
TCP	B-Protocol
or	O
UDP	B-Protocol
header	O
,	O
plus	O
a	O
pseudo-header	O
that	O
contains	O
the	O
source	O
and	O
destination	O
IP	B-Protocol
addresses	I-Protocol
of	O
the	O
packet	O
carrying	O
the	O
TCP	B-Protocol
or	O
UDP	B-Protocol
header	O
.	O
</s>
<s>
For	O
an	O
originating	O
NAT	O
to	O
pass	O
TCP	B-Protocol
or	O
UDP	B-Protocol
successfully	O
,	O
it	O
must	O
recompute	O
the	O
TCP	B-Protocol
or	O
UDP	B-Protocol
header	B-Algorithm
checksum	I-Algorithm
based	O
on	O
the	O
translated	O
IP	B-Protocol
addresses	I-Protocol
,	O
not	O
the	O
original	O
ones	O
,	O
and	O
put	O
that	O
checksum	B-Algorithm
into	O
the	O
TCP	B-Protocol
or	O
UDP	B-Protocol
header	O
of	O
the	O
first	O
packet	O
of	O
the	O
fragmented	O
set	O
of	O
packets	O
.	O
</s>
<s>
Alternatively	O
,	O
the	O
originating	O
host	O
may	O
perform	O
path	B-Protocol
MTU	I-Protocol
Discovery	I-Protocol
to	O
determine	O
the	O
packet	O
size	O
that	O
can	O
be	O
transmitted	O
without	O
fragmentation	O
and	O
then	O
set	O
the	O
do	O
n't	O
fragment	O
(	O
DF	O
)	O
bit	O
in	O
the	O
appropriate	O
packet	O
header	O
field	O
.	O
</s>
<s>
Destination	O
network	B-Protocol
address	I-Protocol
translation	I-Protocol
(	O
DNAT	O
)	O
is	O
a	O
technique	O
for	O
transparently	O
changing	O
the	O
destination	O
IP	B-Protocol
address	I-Protocol
of	O
a	O
routed	B-Protocol
packet	O
and	O
performing	O
the	O
inverse	O
function	O
for	O
any	O
replies	O
.	O
</s>
<s>
Any	O
router	B-Protocol
situated	O
between	O
two	O
endpoints	O
can	O
perform	O
this	O
transformation	O
of	O
the	O
packet	O
.	O
</s>
<s>
DNAT	O
is	O
commonly	O
used	O
to	O
publish	O
a	O
service	O
located	O
in	O
a	O
private	B-Protocol
network	I-Protocol
on	O
a	O
publicly	O
accessible	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
This	O
use	O
of	O
DNAT	O
is	O
also	O
called	O
port	B-Protocol
forwarding	I-Protocol
,	O
or	O
DMZ	B-General_Concept
when	O
used	O
on	O
an	O
entire	O
server	B-Application
,	O
which	O
becomes	O
exposed	O
to	O
the	O
WAN	O
,	O
becoming	O
analogous	O
to	O
an	O
undefended	O
military	O
demilitarized	B-General_Concept
zone	I-General_Concept
(	O
DMZ	B-General_Concept
)	O
.	O
</s>
<s>
Secure	B-Protocol
network	I-Protocol
address	I-Protocol
translation	I-Protocol
(	O
SNAT	O
)	O
is	O
part	O
of	O
Microsoft	O
's	O
Internet	B-Application
Security	I-Application
and	I-Application
Acceleration	I-Application
Server	I-Application
and	O
is	O
an	O
extension	O
to	O
the	O
NAT	O
driver	O
built	O
into	O
Microsoft	B-Application
Windows	I-Application
Server	B-Application
.	O
</s>
<s>
It	O
provides	O
connection	O
tracking	O
and	O
filtering	O
for	O
the	O
additional	O
network	O
connections	O
needed	O
for	O
the	O
FTP	B-Protocol
,	O
ICMP	B-Protocol
,	O
H.323	B-Protocol
,	O
and	O
PPTP	B-Protocol
protocols	O
as	O
well	O
as	O
the	O
ability	O
to	O
configure	O
a	O
transparent	O
HTTP	B-Protocol
proxy	B-Application
server	I-Application
.	O
</s>
<s>
Where	O
static	O
NAT	O
provides	O
a	O
one-to-one	O
internal	O
to	O
public	O
static	O
IP	B-Protocol
address	I-Protocol
mapping	O
,	O
dynamic	O
NAT	O
uses	O
a	O
group	O
of	O
public	O
IP	B-Protocol
addresses	I-Protocol
.	O
</s>
<s>
NAT	O
hairpinning	O
,	O
also	O
known	O
as	O
NAT	O
loopback	O
or	O
NAT	O
reflection	O
,	O
is	O
a	O
feature	O
in	O
many	O
consumer	O
routers	B-Protocol
where	O
a	O
machine	O
on	O
the	O
LAN	B-General_Concept
is	O
able	O
to	O
access	O
another	O
machine	O
on	O
the	O
LAN	B-General_Concept
via	O
the	O
external	O
IP	B-Protocol
address	I-Protocol
of	O
the	O
LAN/router	O
(	O
with	O
port	B-Protocol
forwarding	I-Protocol
set	O
up	O
on	O
the	O
router	B-Protocol
to	O
direct	O
requests	O
to	O
the	O
appropriate	O
machine	O
on	O
the	O
LAN	B-General_Concept
)	O
.	O
</s>
<s>
This	O
is	O
the	O
address	O
of	O
the	O
WAN	O
interface	O
on	O
the	O
router	B-Protocol
.	O
</s>
<s>
Internal	O
address	O
of	O
router	B-Protocol
:	O
</s>
<s>
Address	O
of	O
the	O
server	B-Application
:	O
</s>
<s>
If	O
a	O
packet	O
is	O
sent	O
to	O
by	O
a	O
computer	O
at	O
,	O
the	O
packet	O
would	O
normally	O
be	O
routed	B-Protocol
to	O
the	O
default	B-Protocol
gateway	I-Protocol
(	O
the	O
router	B-Protocol
)	O
A	O
router	B-Protocol
with	O
the	O
NAT	O
loopback	O
feature	O
detects	O
that	O
is	O
the	O
address	O
of	O
its	O
WAN	O
interface	O
,	O
and	O
treats	O
the	O
packet	O
as	O
if	O
coming	O
from	O
that	O
interface	O
.	O
</s>
<s>
It	O
determines	O
the	O
destination	O
for	O
that	O
packet	O
,	O
based	O
on	O
DNAT	O
(	O
port	B-Protocol
forwarding	I-Protocol
)	O
rules	O
for	O
the	O
destination	O
.	O
</s>
<s>
If	O
the	O
data	O
were	O
sent	O
to	O
port	B-Protocol
80	O
and	O
a	O
DNAT	O
rule	O
exists	O
for	O
port	B-Protocol
80	O
directed	O
to	O
,	O
then	O
the	O
host	O
at	O
that	O
address	O
receives	O
the	O
packet	O
.	O
</s>
<s>
If	O
no	O
applicable	O
DNAT	O
rule	O
is	O
available	O
,	O
the	O
router	B-Protocol
drops	O
the	O
packet	O
.	O
</s>
<s>
An	O
ICMP	B-Protocol
Destination	O
Unreachable	O
reply	O
may	O
be	O
sent	O
.	O
</s>
<s>
If	O
any	O
DNAT	O
rules	O
were	O
present	O
,	O
address	O
translation	O
is	O
still	O
in	O
effect	O
;	O
the	O
router	B-Protocol
still	O
rewrites	O
the	O
source	O
IP	B-Protocol
address	I-Protocol
in	O
the	O
packet	O
.	O
</s>
<s>
The	O
local	O
computer	O
(	O
)	O
sends	O
the	O
packet	O
as	O
coming	O
from	O
,	O
but	O
the	O
server	B-Application
(	O
)	O
receives	O
it	O
as	O
coming	O
from	O
.	O
</s>
<s>
When	O
the	O
server	B-Application
replies	O
,	O
the	O
process	O
is	O
identical	O
to	O
an	O
external	O
sender	O
.	O
</s>
<s>
Thus	O
,	O
two-way	O
communication	O
is	O
possible	O
between	O
hosts	O
inside	O
the	O
LAN	B-General_Concept
network	I-General_Concept
via	O
the	O
public	O
IP	B-Protocol
address	I-Protocol
.	O
</s>
<s>
Network	B-Protocol
address	I-Protocol
translation	I-Protocol
is	O
not	O
commonly	O
used	O
in	O
IPv6	B-Protocol
because	O
one	O
of	O
the	O
design	O
goals	O
of	O
IPv6	B-Protocol
is	O
to	O
restore	O
end-to-end	O
network	O
connectivity	O
.	O
</s>
<s>
The	O
large	O
addressing	O
space	O
of	O
IPv6	B-Protocol
obviates	O
the	O
need	O
to	O
conserve	O
addresses	O
and	O
every	O
device	O
can	O
be	O
given	O
a	O
unique	O
globally	O
routable	B-Protocol
address	O
.	O
</s>
<s>
Use	O
of	O
unique	O
local	O
addresses	O
in	O
combination	O
with	O
network	B-Protocol
prefix	I-Protocol
translation	I-Protocol
can	O
achieve	O
results	O
similar	O
to	O
NAT	O
.	O
</s>
<s>
The	O
large	O
addressing	O
space	O
of	O
IPv6	B-Protocol
can	O
still	O
be	O
defeated	O
depending	O
on	O
the	O
actual	O
prefix	O
length	O
given	O
by	O
the	O
carrier	O
.	O
</s>
<s>
Even	O
actual	O
IPv6-to-IPv6	O
NAT	O
,	O
NAT66	B-Protocol
,	O
can	O
turn	O
out	O
useful	O
at	O
times	O
:	O
the	O
APNIC	O
blog	O
outlines	O
a	O
case	O
where	O
the	O
author	O
was	O
only	O
provided	O
a	O
single	O
address	O
(	O
/128	O
)	O
.	O
</s>
<s>
Some	O
application	B-Application
layer	I-Application
protocols	O
,	O
such	O
as	O
File	B-Protocol
Transfer	I-Protocol
Protocol	I-Protocol
(	O
FTP	B-Protocol
)	O
and	O
Session	B-Application
Initiation	I-Application
Protocol	I-Application
(	O
SIP	O
)	O
,	O
send	O
explicit	O
network	O
addresses	O
within	O
their	O
application	O
data	O
.	O
</s>
<s>
FTP	B-Protocol
in	O
active	O
mode	O
,	O
for	O
example	O
,	O
uses	O
separate	O
connections	O
for	O
control	O
traffic	O
(	O
commands	O
)	O
and	O
for	O
data	O
traffic	O
(	O
file	O
contents	O
)	O
.	O
</s>
<s>
When	O
requesting	O
a	O
file	O
transfer	O
,	O
the	O
host	O
making	O
the	O
request	O
identifies	O
the	O
corresponding	O
data	O
connection	O
by	O
its	O
network	B-Application
layer	I-Application
and	O
transport	B-Architecture
layer	I-Architecture
addresses	O
.	O
</s>
<s>
If	O
the	O
host	O
making	O
the	O
request	O
lies	O
behind	O
a	O
simple	O
NAT	O
firewall	O
,	O
the	O
translation	O
of	O
the	O
IP	B-Protocol
address	I-Protocol
or	O
TCP	B-Protocol
port	I-Protocol
number	O
makes	O
the	O
information	O
received	O
by	O
the	O
server	B-Application
invalid	O
.	O
</s>
<s>
SIP	O
commonly	O
controls	O
voice	B-Application
over	I-Application
IP	I-Application
calls	O
,	O
and	O
suffer	O
the	O
same	O
problem	O
.	O
</s>
<s>
SIP	O
and	O
its	O
accompanying	O
Session	B-Language
Description	I-Language
Protocol	I-Language
may	O
use	O
multiple	O
ports	O
to	O
set	O
up	O
a	O
connection	O
and	O
transmit	O
voice	O
stream	O
via	O
Real-time	B-Protocol
Transport	I-Protocol
Protocol	I-Protocol
.	O
</s>
<s>
IP	B-Protocol
addresses	I-Protocol
and	O
port	B-Protocol
numbers	I-Protocol
are	O
encoded	O
in	O
the	O
payload	O
data	O
and	O
must	O
be	O
known	O
before	O
the	O
traversal	O
of	O
NATs	O
.	O
</s>
<s>
Without	O
special	O
techniques	O
,	O
such	O
as	O
STUN	B-Protocol
,	O
NAT	O
behavior	O
is	O
unpredictable	O
and	O
communications	O
may	O
fail	O
.	O
</s>
<s>
Application	B-Application
Layer	I-Application
Gateway	O
(	O
ALG	O
)	O
software	O
or	O
hardware	O
may	O
correct	O
these	O
problems	O
.	O
</s>
<s>
For	O
example	O
,	O
on	O
many	O
Linux	B-Application
systems	O
,	O
there	O
are	O
kernel	O
modules	O
called	O
connection	O
trackers	O
that	O
serve	O
to	O
implement	O
ALGs	O
.	O
</s>
<s>
Another	O
possible	O
solution	O
to	O
this	O
problem	O
is	O
to	O
use	O
NAT	B-Protocol
traversal	I-Protocol
techniques	O
using	O
protocols	O
such	O
as	O
STUN	B-Protocol
or	O
Interactive	O
Connectivity	O
Establishment	O
(	O
ICE	O
)	O
,	O
or	O
proprietary	O
approaches	O
in	O
a	O
session	B-Protocol
border	I-Protocol
controller	I-Protocol
.	O
</s>
<s>
NAT	B-Protocol
traversal	I-Protocol
is	O
possible	O
in	O
both	O
TCP	B-Protocol
-	O
and	O
UDP-based	O
applications	O
,	O
but	O
the	O
UDP-based	O
technique	O
is	O
simpler	O
,	O
more	O
widely	O
understood	O
,	O
and	O
more	O
compatible	O
with	O
legacy	O
NATs	O
.	O
</s>
<s>
In	O
either	O
case	O
,	O
the	O
high-level	O
protocol	O
must	O
be	O
designed	O
with	O
NAT	B-Protocol
traversal	I-Protocol
in	O
mind	O
,	O
and	O
it	O
does	O
not	O
work	O
reliably	O
across	O
symmetric	O
NATs	O
or	O
other	O
poorly	O
behaved	O
legacy	O
NATs	O
.	O
</s>
<s>
Other	O
possibilities	O
are	O
Internet	B-Protocol
Gateway	I-Protocol
Device	I-Protocol
Protocol	I-Protocol
,	O
NAT	B-Protocol
Port	I-Protocol
Mapping	I-Protocol
Protocol	I-Protocol
(	O
NAT-PMP	B-Protocol
)	O
,	O
or	O
Port	B-Protocol
Control	I-Protocol
Protocol	I-Protocol
(	O
PCP	O
)	O
,	O
but	O
these	O
require	O
the	O
NAT	B-Protocol
device	I-Protocol
to	O
implement	O
that	O
protocol	O
.	O
</s>
<s>
Most	O
client	B-Operating_System
–	I-Operating_System
server	I-Operating_System
protocols	O
(	O
FTP	B-Protocol
being	O
the	O
main	O
exception	O
)	O
,	O
however	O
,	O
do	O
not	O
send	O
layer	B-Application
3	I-Application
contact	O
information	O
and	O
do	O
not	O
require	O
any	O
special	O
treatment	O
by	O
NATs	O
.	O
</s>
<s>
NATs	O
can	O
also	O
cause	O
problems	O
where	O
IPsec	B-Protocol
encryption	O
is	O
applied	O
and	O
in	O
cases	O
where	O
multiple	O
devices	O
such	O
as	O
SIP	B-Device
phones	I-Device
are	O
located	O
behind	O
a	O
NAT	O
.	O
</s>
<s>
Phones	O
that	O
encrypt	O
their	O
signaling	O
with	O
IPsec	B-Protocol
encapsulate	O
the	O
port	B-Protocol
information	O
within	O
an	O
encrypted	O
packet	O
,	O
meaning	O
that	O
NAT	B-Protocol
devices	I-Protocol
cannot	O
access	O
and	O
translate	O
the	O
port	B-Protocol
.	O
</s>
<s>
In	O
these	O
cases	O
,	O
the	O
NAT	B-Protocol
devices	I-Protocol
revert	O
to	O
simple	O
NAT	O
operations	O
.	O
</s>
<s>
There	O
are	O
a	O
couple	O
of	O
solutions	O
to	O
this	O
problem	O
:	O
one	O
is	O
to	O
use	O
TLS	B-Protocol
,	O
which	O
operates	O
at	O
layer	B-Architecture
4	I-Architecture
and	O
does	O
not	O
mask	O
the	O
port	B-Protocol
number	I-Protocol
;	O
another	O
is	O
to	O
encapsulate	O
the	O
IPsec	B-Protocol
within	O
UDP	B-Protocol
–	O
the	O
latter	O
being	O
the	O
solution	O
chosen	O
by	O
TISPAN	O
to	O
achieve	O
secure	O
NAT	B-Protocol
traversal	I-Protocol
,	O
or	O
a	O
NAT	O
with	O
"	B-Protocol
IPsec	I-Protocol
Passthru	I-Protocol
"	I-Protocol
support	O
;	O
another	O
is	O
to	O
use	O
a	O
session	B-Protocol
border	I-Protocol
controller	I-Protocol
to	O
help	O
traverse	O
the	O
NAT	O
.	O
</s>
<s>
Interactive	O
Connectivity	O
Establishment	O
is	O
a	O
NAT	B-Protocol
traversal	I-Protocol
technique	O
that	O
does	O
not	O
rely	O
on	O
ALG	O
support	O
.	O
</s>
<s>
The	O
DNS	O
protocol	O
vulnerability	O
announced	O
by	O
Dan	O
Kaminsky	O
on	O
July	O
8	O
,	O
2008	O
,	O
is	O
indirectly	O
affected	O
by	O
NAT	O
port	B-Protocol
mapping	I-Protocol
.	O
</s>
<s>
To	O
avoid	O
DNS	O
cache	O
poisoning	O
,	O
it	O
is	O
highly	O
desirable	O
not	O
to	O
translate	O
UDP	B-Protocol
source	O
port	B-Protocol
numbers	I-Protocol
of	O
outgoing	O
DNS	O
requests	O
from	O
a	O
DNS	O
server	B-Application
behind	O
a	O
firewall	O
that	O
implements	O
NAT	O
.	O
</s>
<s>
The	O
recommended	O
workaround	O
for	O
the	O
DNS	O
vulnerability	O
is	O
to	O
make	O
all	O
caching	O
DNS	O
servers	O
use	O
randomized	O
UDP	B-Protocol
source	O
ports	O
.	O
</s>
<s>
If	O
the	O
NAT	O
function	O
de-randomizes	O
the	O
UDP	B-Protocol
source	O
ports	O
,	O
the	O
DNS	O
server	B-Application
becomes	O
vulnerable	O
.	O
</s>
