Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

hi everyone is there any way to open 3128 port (which is closed by firewall) using ssh? i have root access to the server thnx

share|improve this question

migrated from Jan 16 '11 at 4:16

This question came from our site for professional and enthusiast programmers.

Question for unix stackexchange? – Mark Loeser Jan 15 '11 at 18:54
up vote 2 down vote accepted

It is likely that the 3128 port on the server is closed to the external network interface but not to localhost, so you can access it by using port redirection over ssh.

If you want to use the squid proxy on that server running at port 3128 from your local machine, you can ssh into the server and expose the port on your local machine with the following:

ssh user@servername -NfL 3333:localhost:3128

-N means do not execute a remote command, just make the connection and do the port redirect

-f means make ssh go into the background, so you can close or continue to use the command prompt

-L means take Local port 3333 and connect it to the remote machine's localhost:3128

If you do a ps -ax afterwards, you will see the connection is running in the background, and you can kill it with its pid if you need to.

Then you can point your browser's proxy setting to http://localhost:3333 and it should work fine.

You can also use the following to have command-line tools use the proxy too, like lynx, yum, apt-get, etc:

export http_proxy=http://localhost:3333

share|improve this answer
it worked, thnx man :) – dave Jan 15 '11 at 20:04

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.