Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I can use my home computer A to connect by SSH to a server B where access to the external network is blocked. In other words, all requests to Internet from B throw an error: Network is unreachable. Can I redirect all these requests to pass through the computer A which has an unrestricted access to Internet?

Server B is a server which hosts one of my website. I want to download files in order to install some software. But the connection is blocked. I was able to transfer files but it was complicated because the software versions are different on A and B, so the dependencies where different and it required different files on A and B.

I searched on Internet and it seems that I need a reverse tunnel. But I only found solutions where a port is redirected. But it's not what I need since I don't want B to access to A but to Internet.

share|improve this question
if the downvoter of this questions sees this comment, would you mind letting us know why? I don't see anything wrong with it, even if the answer is "not possible". –  strugee Feb 21 '14 at 2:11
Possible duplicate of unix.stackexchange.com/questions/111972/… –  Lawrence Feb 21 '14 at 2:24
ssh allows you to do either local or remote port forwarding -- i.e. when an application on B attempts to open a local port X, that gets forwarded to A as an attempt to open whatever port you've specified. So then A is free to forward that connection request out to the Internet. You haven't mentioned what port(s) or protocols you're trying to use, that would make construction of detailed answers easier. –  Stabledog Feb 21 '14 at 6:29
I'm trying to use composer, so it should be HTTP and HTTPS requests to github in order to download the packages. –  A.L Feb 22 '14 at 16:44

1 Answer 1

up vote 1 down vote accepted

You can run a proxy on Computer A that computer B would then connect to in order to access the internet through Computer A.

Something like this

             +----------+            +-----------+
             |          |+----SSH+-->|           |
             |     A    |            |    B      |
             |+--------+|            |           |
  Internet <-++-+PROXY<++<SSH Tunnel--+          |
             |+--------+|            |           |
             +----------+            +-----------+

Install a proxy like squid on A which listens on port 3128, and then you can ssh to the server with this -
ssh -L 3128: user@B

That will allow B to access the internet through A

share|improve this answer
Once connected to B, how the requests to Internet will be redirected to A? There's no configuration to change? –  A.L Apr 18 '14 at 21:30
You'll need to set a proxy server on B to –  Lawrence Apr 22 '14 at 3:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.