<s>
In	O
computer	B-Architecture
networking	I-Architecture
,	O
localhost	O
is	O
a	O
hostname	B-Protocol
that	O
refers	O
to	O
the	O
current	O
device	O
used	O
to	O
access	O
it	O
.	O
</s>
<s>
It	O
is	O
used	O
to	O
access	O
the	O
network	O
services	O
that	O
are	O
running	O
on	O
the	O
host	O
via	O
the	O
loopback	B-Protocol
network	I-Protocol
interface	O
.	O
</s>
<s>
The	O
local	O
loopback	B-Protocol
mechanism	O
may	O
be	O
used	O
to	O
run	O
a	O
network	O
service	O
on	O
a	O
host	O
without	O
requiring	O
a	O
physical	B-Protocol
network	I-Protocol
interface	I-Protocol
,	O
or	O
without	O
making	O
the	O
service	O
accessible	O
from	O
the	O
networks	O
the	O
computer	O
may	O
be	O
connected	O
to	O
.	O
</s>
<s>
The	O
name	O
localhost	O
normally	O
resolves	O
to	O
the	O
IPv4	B-Protocol
loopback	B-Protocol
address	B-Protocol
,	O
and	O
to	O
the	O
IPv6	B-Protocol
loopback	B-Protocol
address	B-Protocol
.	O
</s>
<s>
IPv4	B-Protocol
network	I-Protocol
standards	O
reserve	B-Protocol
the	O
entire	O
address	B-Protocol
block	O
127.0.0.0/8	O
(	O
more	O
than	O
16	O
million	O
addresses	O
)	O
for	O
loopback	B-Protocol
purposes	O
.	O
</s>
<s>
The	O
address	B-Protocol
is	O
the	O
standard	O
address	B-Protocol
for	O
IPv4	B-Protocol
loopback	B-Protocol
traffic	O
;	O
the	O
rest	O
are	O
not	O
supported	O
by	O
all	O
operating	O
systems	O
.	O
</s>
<s>
The	O
IPv6	B-Protocol
standard	O
assigns	O
only	O
a	O
single	O
address	B-Protocol
for	O
loopback	B-Protocol
:	O
.	O
</s>
<s>
The	O
resolution	O
of	O
the	O
name	O
localhost	O
to	O
one	O
or	O
more	O
IP	B-Protocol
addresses	I-Protocol
is	O
normally	O
configured	O
by	O
the	O
following	O
lines	O
in	O
the	O
operating	O
system	O
's	O
hosts	B-Protocol
file	I-Protocol
:	O
</s>
<s>
The	O
name	O
may	O
also	O
be	O
resolved	O
by	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
(	O
DNS	B-Protocol
)	O
servers	O
,	O
but	O
queries	O
for	O
this	O
name	O
should	O
be	O
resolved	O
locally	O
,	O
and	O
should	O
not	O
be	O
forwarded	O
to	O
remote	O
name	O
servers	O
.	O
</s>
<s>
In	O
addition	O
to	O
the	O
mapping	O
of	O
localhost	O
to	O
the	O
loopback	B-Protocol
addresses	O
(	O
and	O
)	O
,	O
localhost	O
may	O
also	O
be	O
mapped	O
to	O
other	O
IPv4	B-Protocol
(	O
loopback	B-Protocol
)	O
addresses	O
and	O
it	O
is	O
also	O
possible	O
to	O
assign	O
other	O
,	O
or	O
additional	O
,	O
names	O
to	O
any	O
loopback	B-Protocol
address	B-Protocol
.	O
</s>
<s>
The	O
mapping	O
of	O
localhost	O
to	O
addresses	O
other	O
than	O
the	O
designated	O
loopback	B-Protocol
address	B-Protocol
range	O
in	O
the	O
hosts	B-Protocol
file	I-Protocol
or	O
in	O
DNS	B-Protocol
is	O
not	O
guaranteed	O
to	O
have	O
the	O
desired	O
effect	O
,	O
as	O
applications	O
may	O
map	O
the	O
name	O
internally	O
.	O
</s>
<s>
In	O
the	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
,	O
the	O
name	O
localhost	O
is	O
reserved	O
as	O
a	O
top-level	O
domain	O
name	O
,	O
originally	O
set	O
aside	O
to	O
avoid	O
confusion	O
with	O
the	O
hostname	B-Protocol
used	O
for	O
loopback	B-Protocol
purposes	O
.	O
</s>
<s>
The	O
name	O
localhost	O
is	O
reserved	O
for	O
loopback	B-Protocol
purposes	O
by	O
RFC	O
6761	O
(	O
Special-Use	O
Domain	O
Names	O
)	O
,	O
which	O
achieved	O
the	O
Proposed	O
Standard	O
maturity	O
level	O
in	O
February	O
2013	O
.	O
</s>
<s>
The	O
standard	O
sets	O
forth	O
a	O
number	O
of	O
special	O
considerations	O
governing	O
the	O
use	O
of	O
the	O
name	O
in	O
the	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
:	O
</s>
<s>
An	O
IPv4	B-Protocol
or	O
IPv6	B-Protocol
address	B-Protocol
query	O
for	O
the	O
name	O
localhost	O
must	O
always	O
resolve	O
to	O
the	O
respective	O
loopback	B-Protocol
address	B-Protocol
,	O
which	O
is	O
specified	O
in	O
a	O
separate	O
standard	O
.	O
</s>
<s>
Applications	O
may	O
resolve	O
the	O
name	O
to	O
a	O
loopback	B-Protocol
address	B-Protocol
themselves	O
,	O
or	O
pass	O
it	O
to	O
the	O
local	O
name	O
resolver	O
mechanisms	O
.	O
</s>
<s>
When	O
a	O
name	O
resolver	O
receives	O
an	O
address	B-Protocol
(	O
A	O
or	O
AAAA	O
)	O
query	O
for	O
localhost	O
,	O
it	O
should	O
return	O
the	O
appropriate	O
loopback	B-Protocol
addresses	O
,	O
and	O
negative	O
responses	O
for	O
any	O
other	O
requested	O
record	O
types	O
.	O
</s>
<s>
To	O
avoid	O
burdening	O
the	O
Domain	B-Protocol
Name	I-Protocol
System	I-Protocol
root	O
servers	O
with	O
traffic	O
,	O
caching	O
name	O
servers	O
should	O
never	O
request	O
name	O
server	O
records	O
for	O
localhost	O
,	O
or	O
forward	O
resolution	O
to	O
authoritative	O
name	O
servers	O
.	O
</s>
<s>
DNS	B-Protocol
registrars	O
are	O
precluded	O
from	O
delegating	O
domain	O
names	O
in	O
the	O
top-level	O
domain	O
localhost	O
.	O
</s>
<s>
The	O
IPv4	B-Protocol
loopback	B-Protocol
addresses	O
are	O
reserved	O
within	O
the	O
IPv4	B-Protocol
address	B-Protocol
space	O
by	O
the	O
IETF	O
"	O
Special	O
Use	O
IPv4	B-Protocol
Addresses	O
"	O
standard	O
(	O
RFC	O
5735	O
)	O
.	O
</s>
<s>
In	O
contrast	O
,	O
the	O
IETF	O
"	O
IP	B-Protocol
Version	I-Protocol
6	I-Protocol
Addressing	O
Architecture	O
"	O
standard	O
(	O
RFC	O
4291	O
)	O
reserves	O
the	O
single	O
IPv6	B-Protocol
loopback	B-Protocol
address	B-Protocol
within	O
the	O
IPv6	B-Protocol
address	B-Protocol
space	O
.	O
</s>
<s>
The	O
standard	O
precludes	O
the	O
assignment	O
of	O
that	O
address	B-Protocol
to	O
any	O
physical	O
interface	O
,	O
as	O
well	O
as	O
its	O
use	O
as	O
the	O
source	O
or	O
destination	O
address	B-Protocol
in	O
any	O
packet	O
sent	O
to	O
remote	O
hosts	B-Protocol
.	O
</s>
<s>
Any	O
such	O
packet	O
that	O
is	O
erroneously	O
transmitted	O
is	O
not	O
supposed	O
to	O
be	O
routed	O
,	O
and	O
should	O
be	O
dropped	O
by	O
all	O
routers	O
or	O
hosts	B-Protocol
that	O
receive	O
it	O
.	O
</s>
<s>
The	O
processing	O
of	O
any	O
packet	O
sent	O
to	O
a	O
loopback	B-Protocol
address	B-Protocol
is	O
implemented	O
in	O
the	O
link	O
layer	O
of	O
the	O
TCP/IP	B-Protocol
stack	I-Protocol
.	O
</s>
<s>
Such	O
packets	O
are	O
never	O
passed	O
to	O
any	O
network	B-Protocol
interface	I-Protocol
controller	I-Protocol
(	O
NIC	O
)	O
or	O
hardware	O
device	O
driver	O
and	O
must	O
not	O
appear	O
outside	O
of	O
a	O
computing	O
system	O
or	O
be	O
routed	O
by	O
any	O
router	O
.	O
</s>
<s>
Looped-back	O
packets	O
are	O
distinguished	O
from	O
any	O
other	O
packets	O
traversing	O
the	O
TCP/IP	B-Protocol
stack	I-Protocol
only	O
by	O
the	O
special	O
IP	B-Protocol
address	I-Protocol
they	O
were	O
addressed	O
to	O
.	O
</s>
<s>
To	O
simplify	O
such	O
testing	O
,	O
the	O
hosts	B-Protocol
file	I-Protocol
may	O
be	O
configured	O
to	O
provide	O
appropriate	O
names	O
for	O
each	O
address	B-Protocol
.	O
</s>
<s>
Packets	O
received	O
on	O
a	O
non-loopback	O
interface	O
with	O
a	O
loopback	B-Protocol
source	O
or	O
destination	O
address	B-Protocol
must	O
be	O
dropped	O
.	O
</s>
<s>
Such	O
packets	O
are	O
sometimes	O
referred	O
to	O
as	O
Martian	B-Protocol
packets	I-Protocol
.	O
</s>
<s>
As	O
with	O
any	O
other	O
bogus	O
packets	O
,	O
they	O
may	O
be	O
malicious	O
and	O
any	O
problems	O
they	O
might	O
cause	O
can	O
be	O
avoided	O
by	O
applying	O
bogon	B-Protocol
filtering	I-Protocol
.	O
</s>
<s>
The	O
commonality	O
of	O
localhost	O
being	O
used	O
for	O
development	O
purposes	O
has	O
been	O
best	O
described	O
by	O
various	O
stickers	O
,	O
t-shirts	O
,	O
and	O
manifestos	O
containing	O
the	O
punchline	O
"	O
There	O
is	O
no	O
place	O
like	O
127.0.0.1	O
"	O
.	O
</s>
<s>
The	O
releases	O
of	O
the	O
MySQL	B-Application
database	O
differentiate	O
between	O
the	O
use	O
of	O
the	O
hostname	B-Protocol
localhost	O
and	O
the	O
use	O
of	O
the	O
addresses	O
and	O
.	O
</s>
<s>
When	O
using	O
localhost	O
as	O
the	O
destination	O
in	O
a	O
client	O
connector	O
interface	O
of	O
an	O
application	O
,	O
the	O
MySQL	B-Application
application	O
programming	O
interface	O
connects	O
to	O
the	O
database	O
using	O
a	O
Unix	B-Protocol
domain	I-Protocol
socket	I-Protocol
,	O
while	O
a	O
TCP	O
connection	O
via	O
the	O
loopback	B-Protocol
interface	O
requires	O
the	O
direct	O
use	O
of	O
the	O
explicit	O
address	B-Protocol
.	O
</s>
<s>
One	O
notable	O
exception	O
to	O
the	O
use	O
of	O
the	O
addresses	O
is	O
their	O
use	O
in	O
Multiprotocol	B-Protocol
Label	I-Protocol
Switching	I-Protocol
(	O
MPLS	B-Protocol
)	O
traceroute	O
error	O
detection	O
,	O
in	O
which	O
their	O
property	O
of	O
not	O
being	O
routable	O
provides	O
a	O
convenient	O
means	O
to	O
avoid	O
delivery	O
of	O
faulty	O
packets	O
to	O
end	O
users	O
.	O
</s>
