ssh fails redirecting ports

I’ve set a ssh server on an OS12.3 64 bit, it works but fails when redirecting ports:


ssh  -L 5910:127.0.0.1:5901 xxxxx@yyyyyyyy.org  -vv

............

debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to yyyyyyyyy.org ([a.b.c.d]).
debug1: Local connections to LOCALHOST:5910 forwarded to remote address 127.0.0.1:5901
debug1: Local forwarding listening on 127.0.0.1 port 5910.
debug2: fd 4 setting O_NONBLOCK
debug1: channel 0: new [port listener]
debug1: Local forwarding listening on ::1 port 5910.
bind: Cannot assign requested address


I thought It may be a ipv6 problem because of the ::1 but I’ve disabled ipv6 an the network card and on sshd (or at least i think I’ve done it) and the error persist.
The port is not in use by any other process (Ive tried some other ports, same result). This is my sshd_config.



#       $OpenBSD: sshd_config,v 1.84 2011/05/23 03:30:07 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#Port 22


#AddressFamily any
#cambiado para que use solo ipv4
AddressFamily inet

#ListenAddress 0.0.0.0
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys2

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable support for the deprecated 'gssapi' authentication
# mechanism to OpenSSH 3.8p1. The newer 'gssapi-with-mic' mechanism is included
# in this release. The use of 'gssapi' is deprecated due to the presence of
# potential man-in-the-middle attacks, which 'gssapi-with-mic' is not susceptible to.
#GSSAPIEnableMITMAttack no

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner none

# override default of no subsystems
Subsystem sftp  /usr/lib/ssh/sftp-server

# This enables accepting locale enviroment variables LC_* LANG, see sshd_config(5).
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
AllowTcpForwarding yes
Compression yes
MaxAuthTries 6
PermitRootLogin no
PrintMotd yes
PubkeyAuthentication yes
RSAAuthentication no

# Example of overriding settings on a per-user basis
#Match User anoncvs
#       X11Forwarding no
#       AllowTcpForwarding no
#       ForceCommand cvs server


I don’t know which more test to do.

Does this work?

ssh -4 -L 5910:127.0.0.1:5901

On 09/19/2013 03:16 PM, fperal wrote:
>
> I’ve set a ssh server on an OS12.3 64 bit, it works but fails when
> redirecting ports:
>
>
>
> Code:
> --------------------
>
> ssh -L 5910:127.0.0.1:5901 xxxxx@yyyyyyyy.org -vv
>
> …
>
> debug1: read PEM private key done: type RSA
> debug1: Authentication succeeded (publickey).
> Authenticated to yyyyyyyyy.org ([a.b.c.d]).
> debug1: Local connections to LOCALHOST:5910 forwarded to remote address 127.0.0.1:5901
> debug1: Local forwarding listening on 127.0.0.1 port 5910.
> debug2: fd 4 setting O_NONBLOCK
> debug1: channel 0: new [port listener]
> debug1: Local forwarding listening on ::1 port 5910.
> bind: Cannot assign requested address
> --------------------

I see what you’re writing, and what it’s displaying, but have you tried
accessing the port anyway, or at least checking with ‘ss’ to see if it is
listening?

Code:

/usr/sbin/ss -planeto | grep :5910

The reason I ask is that I see this error all day long, and I use the
forwarded socket anyway. I’ve never bothered really caring what the
problem was after realizing it was cosmetic. On the other hand, some
errors do indicate a real problem, but (in my experience) not this one.

Good luck.

yes, it worked. So the problem is it is using ipv6… or trying because i have it disabled in network setting either on client and server