<s>
In	O
computer	B-Architecture
networks	I-Architecture
,	O
a	O
tunneling	B-Protocol
protocol	I-Protocol
is	O
a	O
communication	O
protocol	O
which	O
allows	O
for	O
the	O
movement	O
of	O
data	O
from	O
one	O
network	O
to	O
another	O
.	O
</s>
<s>
It	O
involves	O
allowing	O
private	B-Protocol
network	I-Protocol
communications	O
to	O
be	O
sent	O
across	O
a	O
public	O
network	O
(	O
such	O
as	O
the	O
Internet	O
)	O
through	O
a	O
process	O
called	O
encapsulation	B-Protocol
.	O
</s>
<s>
The	O
tunneling	B-Protocol
protocol	I-Protocol
works	O
by	O
using	O
the	O
data	O
portion	O
of	O
a	O
packet	B-Protocol
(	O
the	O
payload	O
)	O
to	O
carry	O
the	O
packets	B-Protocol
that	O
actually	O
provide	O
the	O
service	O
.	O
</s>
<s>
Tunneling	O
uses	O
a	O
layered	O
protocol	O
model	O
such	O
as	O
those	O
of	O
the	O
OSI	O
or	O
TCP/IP	B-Protocol
protocol	I-Protocol
suite	I-Protocol
,	O
but	O
usually	O
violates	O
the	O
layering	O
when	O
using	O
the	O
payload	O
to	O
carry	O
a	O
service	O
not	O
normally	O
provided	O
by	O
the	O
network	O
.	O
</s>
<s>
A	O
tunneling	B-Protocol
protocol	I-Protocol
may	O
,	O
for	O
example	O
,	O
allow	O
a	O
foreign	O
protocol	O
to	O
run	O
over	O
a	O
network	O
that	O
does	O
not	O
support	O
that	O
particular	O
protocol	O
,	O
such	O
as	O
running	O
IPv6	B-Protocol
over	O
IPv4	B-Protocol
.	O
</s>
<s>
Another	O
important	O
use	O
is	O
to	O
provide	O
services	O
that	O
are	O
impractical	O
or	O
unsafe	O
to	O
be	O
offered	O
using	O
only	O
the	O
underlying	O
network	O
services	O
,	O
such	O
as	O
providing	O
a	O
corporate	O
network	B-Protocol
address	I-Protocol
to	O
a	O
remote	O
user	O
whose	O
physical	O
network	B-Protocol
address	I-Protocol
is	O
not	O
part	O
of	O
the	O
corporate	O
network	O
.	O
</s>
<s>
Users	O
can	O
also	O
use	O
tunneling	O
to	O
"	O
sneak	O
through	O
"	O
a	O
firewall	B-Application
,	O
using	O
a	O
protocol	O
that	O
the	O
firewall	B-Application
would	O
normally	O
block	O
,	O
but	O
"	O
wrapped	O
"	O
inside	O
a	O
protocol	O
that	O
the	O
firewall	B-Application
does	O
not	O
block	O
,	O
such	O
as	O
HTTP	B-Protocol
.	I-Protocol
</s>
<s>
If	O
the	O
firewall	B-Application
policy	O
does	O
not	O
specifically	O
exclude	O
this	O
kind	O
of	O
"	O
wrapping	O
"	O
,	O
this	O
trick	O
can	O
function	O
to	O
get	O
around	O
the	O
intended	O
firewall	B-Application
policy	O
(	O
or	O
any	O
set	O
of	O
interlocked	O
firewall	B-Application
policies	O
)	O
.	O
</s>
<s>
Another	O
HTTP-based	O
tunneling	O
method	O
uses	O
the	O
HTTP	B-Protocol
CONNECT	O
method/command	O
.	O
</s>
<s>
A	O
client	O
issues	O
the	O
HTTP	B-Protocol
CONNECT	O
command	O
to	O
an	O
HTTP	B-Protocol
proxy	O
.	O
</s>
<s>
The	O
proxy	O
then	O
makes	O
a	O
TCP	O
connection	O
to	O
a	O
particular	O
server:port	O
,	O
and	O
relays	O
data	O
between	O
that	O
server:port	O
and	O
the	O
client	O
connection	O
.	O
</s>
<s>
Because	O
this	O
creates	O
a	O
security	O
hole	O
,	O
CONNECT-capable	O
HTTP	B-Protocol
proxies	O
commonly	O
restrict	O
access	O
to	O
the	O
CONNECT	O
method	O
.	O
</s>
<s>
The	O
proxy	O
allows	O
connections	O
only	O
to	O
specific	O
ports	O
,	O
such	O
as	O
443	O
for	O
HTTPS	B-Protocol
.	O
</s>
<s>
Other	O
tunneling	O
methods	O
able	O
to	O
bypass	O
network	B-Application
firewalls	I-Application
make	O
use	O
of	O
different	O
protocols	O
such	O
as	O
DNS	B-Application
,	O
MQTT	B-Application
,	O
SMS	B-Device
.	O
</s>
<s>
As	O
an	O
example	O
of	O
network	O
layer	O
over	O
network	O
layer	O
,	O
Generic	B-Protocol
Routing	I-Protocol
Encapsulation	I-Protocol
(	O
GRE	B-Protocol
)	O
,	O
a	O
protocol	O
running	O
over	O
IP	O
(	O
IP	B-Protocol
protocol	I-Protocol
number	I-Protocol
47	O
)	O
,	O
often	O
serves	O
to	O
carry	O
IP	O
packets	B-Protocol
,	O
with	O
RFC	B-Protocol
1918	I-Protocol
private	O
addresses	O
,	O
over	O
the	O
Internet	O
using	O
delivery	O
packets	B-Protocol
with	O
public	O
IP	O
addresses	O
.	O
</s>
<s>
The	O
Layer	B-Application
2	I-Application
Tunneling	I-Application
Protocol	I-Application
(	O
L2TP	B-Application
)	O
allows	O
the	O
transmission	O
of	O
frames	B-Protocol
between	O
two	O
nodes	O
.	O
</s>
<s>
A	O
tunnel	O
is	O
not	O
encrypted	O
by	O
default	O
:	O
the	O
TCP/IP	B-Protocol
protocol	I-Protocol
chosen	O
determines	O
the	O
level	O
of	O
security	O
.	O
</s>
<s>
SSH	B-Protocol
uses	O
port	B-Protocol
22	I-Protocol
to	O
enable	O
data	O
encryption	O
of	O
payloads	O
being	O
transmitted	O
over	O
a	O
public	O
network	O
(	O
such	O
as	O
the	O
Internet	O
)	O
connection	O
,	O
thereby	O
providing	O
VPN	B-Application
functionality	O
.	O
</s>
<s>
IPsec	B-Protocol
has	O
an	O
end-to-end	O
Transport	O
Mode	O
,	O
but	O
can	O
also	O
operate	O
in	O
a	O
tunneling	O
mode	O
through	O
a	O
trusted	O
security	O
gateway	O
.	O
</s>
<s>
VXLAN	B-Protocol
(	O
UDP	O
port	O
4789	O
)	O
:	O
Virtual	B-Protocol
Extensible	I-Protocol
Local	I-Protocol
Area	I-Protocol
Network	I-Protocol
.	O
</s>
<s>
A	O
Secure	B-Protocol
Shell	I-Protocol
(	O
SSH	B-Protocol
)	O
tunnel	O
consists	O
of	O
an	O
encrypted	O
tunnel	O
created	O
through	O
an	O
SSH	B-Protocol
protocol	I-Protocol
connection	O
.	O
</s>
<s>
Users	O
may	O
set	O
up	O
SSH	B-Protocol
tunnels	O
to	O
transfer	O
unencrypted	O
traffic	O
over	O
a	O
network	O
through	O
an	O
encrypted	O
channel	O
.	O
</s>
<s>
For	O
example	O
,	O
Microsoft	O
Windows	O
machines	O
can	O
share	O
files	O
using	O
the	O
Server	B-Operating_System
Message	I-Operating_System
Block	I-Operating_System
(	O
SMB	O
)	O
protocol	O
,	O
a	O
non-encrypted	O
protocol	O
.	O
</s>
<s>
To	O
mount	O
the	O
Windows	O
file-system	O
securely	O
,	O
one	O
can	O
establish	O
a	O
SSH	B-Protocol
tunnel	O
that	O
routes	O
all	O
SMB	O
traffic	O
to	O
the	O
remote	O
fileserver	O
through	O
an	O
encrypted	O
channel	O
.	O
</s>
<s>
Even	O
though	O
the	O
SMB	B-Operating_System
protocol	I-Operating_System
itself	O
contains	O
no	O
encryption	O
,	O
the	O
encrypted	O
SSH	B-Protocol
channel	O
through	O
which	O
it	O
travels	O
offers	O
security	O
.	O
</s>
<s>
Once	O
an	O
SSH	B-Protocol
connection	O
has	O
been	O
established	O
,	O
the	O
tunnel	O
starts	O
with	O
SSH	B-Protocol
listening	O
to	O
a	O
port	O
on	O
the	O
remote	O
or	O
local	O
host	O
.	O
</s>
<s>
Tunneling	O
a	O
TCP-encapsulating	O
payload	O
(	O
such	O
as	O
PPP	B-Protocol
)	O
over	O
a	O
TCP-based	O
connection	O
(	O
such	O
as	O
SSH	B-Protocol
's	O
port	B-Protocol
forwarding	I-Protocol
)	O
is	O
known	O
as	O
"	O
TCP-over-TCP	O
"	O
,	O
and	O
doing	O
so	O
can	O
induce	O
a	O
dramatic	O
loss	O
in	O
transmission	O
performance	O
(	O
a	O
problem	O
known	O
as	O
"	O
TCPmeltdown	O
"	O
)	O
,	O
which	O
is	O
why	O
virtual	B-Application
private	I-Application
network	I-Application
software	O
may	O
instead	O
use	O
a	O
protocol	O
simpler	O
than	O
TCP	O
for	O
the	O
tunnel	O
connection	O
.	O
</s>
<s>
However	O
,	O
this	O
is	O
often	O
not	O
a	O
problem	O
when	O
using	O
OpenSSH	O
's	O
port	B-Protocol
forwarding	I-Protocol
,	O
because	O
many	O
use	O
cases	O
do	O
not	O
entail	O
TCP-over-TCP	O
tunneling	O
;	O
the	O
meltdown	O
is	O
avoided	O
because	O
the	O
OpenSSH	O
client	O
processes	O
the	O
local	O
,	O
client-side	O
TCP	O
connection	O
in	O
order	O
to	O
get	O
to	O
the	O
actual	O
payload	O
that	O
is	O
being	O
sent	O
,	O
and	O
then	O
sends	O
that	O
payload	O
directly	O
through	O
the	O
tunnel	O
's	O
own	O
TCP	O
connection	O
to	O
the	O
server	B-Application
side	O
,	O
where	O
the	O
OpenSSH	O
server	B-Application
similarly	O
"	O
unwraps	O
"	O
the	O
payload	O
in	O
order	O
to	O
"	O
wrap	O
"	O
it	O
up	O
again	O
for	O
routing	O
to	O
its	O
final	O
destination	O
.	O
</s>
<s>
SSH	B-Protocol
tunnels	O
provide	O
a	O
means	O
to	O
bypass	O
firewalls	B-Application
that	O
prohibit	O
certain	O
Internet	B-Protocol
services	I-Protocol
so	O
long	O
as	O
a	O
site	O
allows	O
outgoing	O
connections	O
.	O
</s>
<s>
If	O
users	O
can	O
connect	O
to	O
an	O
external	O
SSH	B-Protocol
server	B-Application
,	O
they	O
can	O
create	O
an	O
SSH	B-Protocol
tunnel	O
to	O
forward	O
a	O
given	O
port	O
on	O
their	O
local	O
machine	O
to	O
port	O
80	O
on	O
a	O
remote	O
web	O
server	B-Application
.	O
</s>
<s>
Some	O
SSH	B-Protocol
clients	O
support	O
dynamic	O
port	B-Protocol
forwarding	I-Protocol
that	O
allows	O
the	O
user	O
to	O
create	O
a	O
SOCKS	B-Application
4/5	O
proxy	O
.	O
</s>
<s>
In	O
this	O
case	O
users	O
can	O
configure	O
their	O
applications	O
to	O
use	O
their	O
local	O
SOCKS	B-Application
proxy	I-Application
server	B-Application
.	O
</s>
<s>
This	O
gives	O
more	O
flexibility	O
than	O
creating	O
an	O
SSH	B-Protocol
tunnel	O
to	O
a	O
single	O
port	O
as	O
previously	O
described	O
.	O
</s>
<s>
SOCKS	B-Application
can	O
free	O
the	O
user	O
from	O
the	O
limitations	O
of	O
connecting	O
only	O
to	O
a	O
predefined	O
remote	O
port	O
and	O
server	B-Application
.	O
</s>
<s>
If	O
an	O
application	O
does	O
not	O
support	O
SOCKS	B-Application
,	O
a	O
proxifier	O
can	O
be	O
used	O
to	O
redirect	O
the	O
application	O
to	O
the	O
local	O
SOCKS	B-Application
proxy	I-Application
server	B-Application
.	O
</s>
<s>
Some	O
proxifiers	O
,	O
such	O
as	O
Proxycap	O
,	O
support	O
SSH	B-Protocol
directly	O
,	O
thus	O
avoiding	O
the	O
need	O
for	O
an	O
SSH	B-Protocol
client	O
.	O
</s>
<s>
In	O
recent	O
versions	O
of	O
OpenSSH	O
it	O
is	O
even	O
allowed	O
to	O
create	O
layer	B-Protocol
2	I-Protocol
or	I-Protocol
layer	I-Protocol
3	I-Protocol
tunnels	I-Protocol
if	O
both	O
ends	O
have	O
enabled	O
such	O
tunneling	O
capabilities	O
.	O
</s>
<s>
Over	O
the	O
years	O
,	O
tunneling	O
and	O
data	B-Protocol
encapsulation	I-Protocol
in	O
general	O
have	O
been	O
frequently	O
adopted	O
for	O
malicious	O
reasons	O
,	O
in	O
order	O
to	O
maliciously	O
communicate	O
outside	O
of	O
a	O
protected	O
network	O
.	O
</s>
<s>
In	O
this	O
context	O
,	O
known	O
tunnels	O
involve	O
protocols	O
such	O
as	O
HTTP	B-Protocol
,	O
SSH	B-Protocol
,	O
DNS	B-Application
,	O
MQTT	B-Application
.	O
</s>
