Consider the following situation:

I have 2 machines (S) and (M). S can use all ports, but M can only use port 80. M is running Windows. S is running Debian.

For example, if a program on M wants to use port X to connect to server A, the request should be redirected to port 80 of S. S should then use its own port X to send the request to A and then return the response to port 80 of M.

Is there a way to produce this?

  • Please clarify the direction of the connections you are envisaging. In the first paragraph you describe S as reachable from the internet on all ports, but in the second paragraph you describe S making a connection to S via the internet on port X. Aug 31, 2015 at 17:10
  • @TilmanSchmidt S can use all ports, but M can only use port 80. S is trying to help M to communicate with ports other than 80
    – R. 久蔵
    Aug 31, 2015 at 17:12
  • M:80 ---> S:80 , S:X ---> A:X ||| A:X ---> S:X , S:80 ---> M:80
    – R. 久蔵
    Aug 31, 2015 at 17:15
  • You seem to be under the misconception that source port and destination port are the same. Not so. The client of a TCP service uses an ephemeral port (typically from the range 49152 to 65535) as the local port. Aug 31, 2015 at 17:18
  • The problem is I can't use other ports on M except 80. So I have to use S to reach other servers that work with other ports. Example: FTP. On an other hand, I don't know if there is a way to reach FTP (port 20) using port 80.
    – R. 久蔵
    Aug 31, 2015 at 17:22

1 Answer 1


What you describe can be achieved by running a proxy server on S and enabling the applications on M for that proxy. There are several proxies that may fulfil your needs, for example:

  • SOCKS: run a Socks proxy on S and socksify the applications on M; on Windows you can use a program like FreeCap for that
  • Squid: run Squid on S and use applications on M that are capable of using a standard HTTP proxy; standard web browsers and FTP clients are, for others you'll have to check the documentation

In any case, your applications on M must know how to talk to a proxy instead of directly to the destination server.

  • And is there a program on Windows that knows "how to talk to a proxy" through a proxy on port 80? I forgot to mention that between M and internet there is a Squid Proxy that I'm not the admin of. Sorry
    – R. 久蔵
    Aug 31, 2015 at 17:40
  • Nevermind. I forgot that I have FreeCap
    – R. 久蔵
    Aug 31, 2015 at 17:48
  • Yup, that'll do the trick. Edited my answer to include a reference to it. Aug 31, 2015 at 19:31

You must log in to answer this question.

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