Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 user@8.8.8.8.
user@8.8.8.8's password: 
bind: Cannot assign requested address

(where 8.8.8.8 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 127.0.0.1 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.

share|improve this question
    
What if you try and force it to use ipv4? (just as an initial troubleshooting test). E.g. ssh -4 -D 1080 user@8.8.8.8 –  Fred Clausen Nov 1 '12 at 10:54
    
Can you try a higher port number, 4000? –  jwbensley Nov 1 '12 at 10:57
    
Thanks for inputs. I got it to work with: ssh -4 -D 8081 user@8.8.8.8 –  JosephK Nov 1 '12 at 15:51

1 Answer 1

up vote 15 down vote accepted

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 user@8.8.8.8
share|improve this answer
    
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 Nov 6 '12 at 5:57
    
A long shot but perhaps turning off SSH DNS resolution on the server, "UseDNS no" in sshd_config, might resolve it. Perhaps some weird DNS resolution is going on the server causing bind issues. –  Fred Clausen Nov 6 '12 at 10:44
    
Thanks a lot, the -4 was also the solution for Ubuntu 11.04. –  Sander Dec 24 '12 at 21:03
    
I started having this issue after upgrading to Ubuntu 13.04, and this was the fix. –  Nick Mar 14 '13 at 12:47

Your Answer

 
discard

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.