Trying to create a socks (-D) ssh tunnel - Linux box to Linux box (both centos):

sshd running on remote side ok.

From local machine we do / see this:

ssh -D 1080 [email protected].
[email protected]'s password: 
bind: Cannot assign requested address

(where is really my server's IP and 'user' is my real username)

I am logged into the remote side in this terminal-window. I can verify that the local port was unused prior to this command, and then used by an ssh process, after the command, via:

netstat -lnp | grep 1080

So, unlike most googled-responses with this error, the problem would not seem to be the loopback interface assignment. If I try to use this tunnel with a mail client, the local-side permits the attempt (no 'proxy-failed' error), but no data / reply is returned.

On the remote side, I do have "PermitTunnel yes" in my sshd_config (though 'yes' should be the default, anyway).

Ideas or Clues?

Here is the relevant debug-output

OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *


debug1: Authentication succeeded (password).
debug1: Local connections to LOCALHOST:1080 forwarded to remote address socks:0
debug1: Local forwarding listening on port 1080.
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on ::1 port 1080.
bind: Cannot assign requested address
debug1: channel 1: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.utf8

Other clue: If I run a Virtual Box on the client running Windows, open a tunnel with putty in that box, that tunnel, to the same remote server, works.

Stranger Still" If I use Putty (for linux) running directly on the Linux Client, it does NOT work, even if the settings are an exact duplicate of the putty settings which DO WORK in Putty running on Windows in a Virtual Box on the same Client Machine?? There is something fishy ... still trying experiments to figure out what it is.

  • What if you try and force it to use ipv4? (just as an initial troubleshooting test). E.g. ssh -4 -D 1080 [email protected] Commented Nov 1, 2012 at 10:54
  • Can you try a higher port number, 4000?
    – Baldrick
    Commented Nov 1, 2012 at 10:57
  • Thanks for inputs. I got it to work with: ssh -4 -D 8081 [email protected]
    – JosephK
    Commented Nov 1, 2012 at 15:51

1 Answer 1


The close the loop here. The answer, in this case, was to force the ssh client to use ipv4. E.g.

ssh -4 -D 8081 [email protected]
  • So I would think, except that I can select 'force ip4' in putty (running on Linux) without success. Also IPV6 is disabled on this machine, so theoretically should not have been at play. The completely inconsistent results I still get trying different permutations of this thing leave me scratching my head. In any case, your answer helped me get it working, and perhaps has uncovered something odd about how this version of CentOS or Linux Kernel or some-such is operating - Thanks.
    – JosephK
    Commented Nov 6, 2012 at 5:57
  • 1
    Thanks a lot, the -4 was also the solution for Ubuntu 11.04.
    – Sander
    Commented Dec 24, 2012 at 21:03
  • 6
    Instead of having to specify -4 every time, assuming all ssh connections are to be made with IPv4 only, add "AddressFamily inet" to your ssh_config file -- per user in ${HOME}/.ssh/ssh_config, or system wide for all users in /etc/ssh/ssh_config
    – J G Miller
    Commented Mar 13, 2017 at 13:04
  • 6
    What was the clue that made you think to try -4?
    – Paul Price
    Commented Apr 28, 2018 at 0:11
  • 2
    Refer to electricmonk.nl/log/2014/09/24/… . The clue is it listens on ipv6: "debug1: Local forwarding listening on ::1 port 8080."
    – Haili Sun
    Commented Oct 29, 2021 at 5:26

You must log in to answer this question.

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