It seems to me that proxy server, gateway and tunneling all forward traffic that they receive to the actual destinations. So is port forwarding always used in proxy server, gateway and tunneling, or just some of the three, or not always for any of the three?

1 Answer 1


A proxy server is probably running something like squid. That accepts connections from clients, checks the request from the client and then opens a connection to fetch whatever the client wants (ignoring the case where the content is in the squid's cache, if enabled). Hence it works as a man-in-the-middle, passing along data actively. Hence it is not strictly forwarding the traffic, in the sense of forwarding on OSI level 4 (transport); it could be considered to be working at level 5 (session).

A gateway does forward traffic and should strictly be considered a router, although I'm sure there are some things called "gateway" that work differently, and what most people call "router" is actually some combination of router, NAT gateway and WIFI access point.

A tunnel is akin to an ethernet cable, so it's a data link (OSI level 2). The system that provides the tunnel endpoint will then be doing the forwarding.

  • thanks. Is SSH tunneling not considered as "tunnel" in last paragraph, because SSH tunnel is in application layer/level?
    – Tim
    Oct 25, 2015 at 2:18
  • It could be considered a tunnel (and is often called that), I prefer to call it port forwarding.
    – wurtel
    Nov 5, 2015 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .