ssh tunnel error : channel 3: open failed: connect failed: Connection refused

12,772

The -D option does not creates an HTTP proxy. It creates a SOCKS5 proxy:

 -D [bind_address:]port
         Specifies a local “dynamic” application-level port forwarding....Currently the SOCKS4 and SOCKS5 protocols are sup‐
         ported, and ssh will act as a SOCKS server.

In order to use the proxy you will need to configure Firefox to use a SOCKS5 proxy as described in this document.

Share:
12,772

Related videos on Youtube

soroosh.strife
Author by

soroosh.strife

Updated on September 18, 2022

Comments

  • soroosh.strife
    soroosh.strife over 1 year

    I'm trying to access and browse internet through a ssh server so in my laptop (ubuntu 12.04) I do this:

    ssh -D 9999 root@server-ip
    

    then in the network proxy in my laptop I set:

    HTTP proxy 127.0.0.1      port 9999
    

    but when I try to open a page in my browser it doesn't connect and in my terminal I get errors like these :

    channel 4: open failed: connect failed: Connection refused
    channel 3: open failed: connect failed: Connection refused
    channel 5: open failed: connect failed: Connection refused
    channel 4: open failed: connect failed: Connection refused
    channel 6: open failed: connect failed: Connection refused
    

    I'm new to this and found this method on the internet so I'm don't know what I'm doing wrong. I'd really appreciate it if anyone can help me make this work.

    • larsks
      larsks almost 11 years
      Note that -D does not create an HTTP proxy, it creates a SOCKS5 proxy...so make sure you configure your browser correctly (e.g., as described here.
    • soroosh.strife
      soroosh.strife almost 11 years
      oh! thank you it worked. I was setting http proxy instead of socks host.
    • terdon
      terdon almost 11 years
      @larsks you seem tohave solved this, care to post it as an answer?
    • larsks
      larsks almost 11 years
      I've gone ahead and posted it as an answer. Cheers!