You are not logged in.

#1 2010-01-27 23:06:08

AlexS
Member
From: Munich, Germany
Registered: 2009-05-16
Posts: 114

[solved]Can't ssh my server externally

I'm trying to setup an old computer as a server, and I would like to be able to establish an ssh connection to it from the outside. I followed the Comprehensive Server Guide, Ssh and Denyhosts wiki pages.

My problem is that I am able to ssh the server from my laptop using the local server IP, but never managed to do it from outside (connection refused or timed out).

I thought the problem might be that all my computers in the LAN share the same external IP, which makes me think I should setup port forwarding in my router (a O2 Surf & Phone, Zyxel router).
pckonfig-a-routers-bild.jpg
So in the router's configuration I setup NAT to forward port 22 to my server's local IP.

Nevertheless, if I try to ssh into my server by using the external IP, I am still being blocked! mad
(I tried this from my laptop, but also from a remote account, via ssh)

By this time I'm running out of ideas sad I'm sure I'm missing something obvious, and would like to ask for suggestions.

Maybe it will help if I paste here my ssh config files:

/etc/hosts.allow

#
# /etc/hosts.allow
#
sshd: ALL EXCEPT /etc/hosts.evil
# End of file

/etc/hosts.evil

<empty>

/etc/hosts.deny

#
# /etc/hosts.deny
#

ALL: ALL: DENY
# End of file

/etc/ssh/sshd_config

#       $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 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 change a
# default value.

#Port 22
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require 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

# 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 no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile     .ssh/authorized_keys

# 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
#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 yes
#PermitEmptyPasswords no

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

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# 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 no
#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
# override default of no subsystems
Subsystem       sftp    /usr/lib/ssh/sftp-server

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

Last edited by AlexS (2010-01-27 23:59:59)

Offline

#2 2010-01-27 23:49:47

foutrelis
Developer
From: Athens, Greece
Registered: 2008-07-28
Posts: 705
Website

Re: [solved]Can't ssh my server externally

It's possible that your ISP is blocking incoming traffic on low ports in the range of 1-1024. I know mine did this by default but provided an option to unblock them.

Offline

#3 2010-01-27 23:59:18

AlexS
Member
From: Munich, Germany
Registered: 2009-05-16
Posts: 114

Re: [solved]Can't ssh my server externally

foutrelis wrote:

It's possible that your ISP is blocking incoming traffic on low ports in the range of 1-1024. I know mine did this by default but provided an option to unblock them.

Yup, that was the problem, and I found the option that re-enabled it. It's finally working, it's great, thanks!

Offline

Board footer

Powered by FluxBB