LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-27-2007, 10:39 PM   #1
MrSpandex
LQ Newbie
 
Registered: Sep 2005
Location: Detroit, MI
Distribution: Slackware 11
Posts: 9

Rep: Reputation: 0
Unhappy Remote SSH not working


ANSWER IS: I was attempting to connect to the external IP from within my LAN to test.


Hello,

I have SSHD running on my slackware 11.0 system. I am able to connect via Putty from my Windows box with the local IP (192.168.0.111), and I can even connect from the slackware box to itself using this same IP (192.168.0.111). What I am having trouble with is connecting to it using my external IP (68.XX.XX.XX). I cannot connect from either box. Both simply time out.

I have forwarded port 22 on my router, which I am confident should work (I forward lots of ports) to 192.168.0.111, the local LAN IP. DHCP is off.

The slackware box connects to the net just fine through Firefox and links. Its ifconfig output:
Code:
eth0      Link encap:Ethernet  HWaddr 00:D0:B7:21:A9:73
          inet addr:192.168.0.111  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16518 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4977 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3566389 (3.4 MiB)  TX bytes:2062364 (1.9 MiB)
          Interrupt:10 Base address:0x1000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1432 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1432 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:112744 (110.1 KiB)  TX bytes:112744 (110.1 KiB)
Thanks in advance for any help. I <3 Slackware

Last edited by MrSpandex; 06-28-2007 at 12:10 PM.
 
Old 06-28-2007, 12:56 AM   #2
opensourcedevelopmen
LQ Newbie
 
Registered: Jun 2007
Location: Delhi
Distribution: Linux
Posts: 21

Rep: Reputation: 16
Which Firewall u r using?
 
Old 06-28-2007, 01:04 AM   #3
MrSpandex
LQ Newbie
 
Registered: Sep 2005
Location: Detroit, MI
Distribution: Slackware 11
Posts: 9

Original Poster
Rep: Reputation: 0
I run Sygate on the Windows PC Im trying to conenct with, and no firewall to my knowlege on the slackware box. If it has one, it is the default. I just got slackware up 2 days ago.
 
Old 06-28-2007, 01:14 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Double check that the router forwards port 22 to 192.168.0.111

Quote:
I am able to connect via Putty from my Windows box with the local IP
So, you don't have a firewall problem on the slackware host, unless a firewall rule explicitly blocks outside IPs and allows LOCAL IPs.
Check /etc/hosts.deny and /etc/hosts.allow.
I wasn't able to ssh into my fedora core 6 laptop until I edited /etc/hosts.allow:
sshd : 192.168.1.0/255.255.255.128 : ALLOW
I had my lan subnetted so I couldn't connect from another host on the lan until I edited hosts.allow.

Look in your /etc/ssh/sshd_config and check for the port number. It may be changed.
Code:
$ sed -n '21q;1,20p' /etc/ssh/sshd_config
#       $OpenBSD: sshd_config,v 1.74 2006/07/19 13:07:10 dtucker 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
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
I have disabled Protocol 1 for security reasons. If you also have, make sure that putty is using Protocol 2.

Also, test the connection using a telnet client
ex:
Code:
Trying 192.168.1.102...
Connected to delllap.
Escape character is '^]'.
SSH-2.0-OpenSSH_4.3
You won't be able to complete the connection, but you should see something if the you don't have a firewall or port forwarding problem.

Last edited by jschiwal; 06-28-2007 at 01:17 AM.
 
Old 06-28-2007, 02:38 AM   #5
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
This is a routing issue - an explanation is given here:
http://iptables.rlworkman.net/chunkyhtml/x4033.html

The easiest solution is (if you have a small LAN) to define the external domain name of the ssh server in /etc/hosts on all of the other clients using the *internal* ip of the server, or if you have a large LAN, then set up multiple views in bind and serve the internal ip to clients inside the lan.

If you want to ssh to the ip address directly (not using the external domain name), then you'll need to follow the advice in the tutorial above.
 
Old 06-28-2007, 10:57 AM   #6
bijit1709
Member
 
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67

Rep: Reputation: 15
In order for you to get connected to a ssh server. The server should use a public static ip address, not a dynamic ip. If you use a dynamic ip you can only connect to the server through the computer on your lan. But in order to connect from outside your lan you need a static ip. I hope this helps..
 
Old 06-28-2007, 11:16 AM   #7
MrSpandex
LQ Newbie
 
Registered: Sep 2005
Location: Detroit, MI
Distribution: Slackware 11
Posts: 9

Original Poster
Rep: Reputation: 0
Everything is left as default in sshd_config, but I did change the protocol to 2 only. Both hosts.allow and hosts.deny are empty. What you added to your hosts.allow seems to be for LAN entry, but my problem is with outside entry. What would I need to put in there?

Telnet also does not connect. Perhaps my ISP is blocking port 22. COuld this possibly be because I am trying to connectto the external IP from within the local network?

Also, to the new reply: I have not heard this before. I know the IP changes once in a while, but I have never had problems hosting services out of this box as a windows server on a dynamic IP behind a NAT. Is this specific to ssh?

EDIT: I attempted forwarding 23 to the box and changing the listen port for SSHD to 23. I have the same problem. This is looking very much like a forwarding problem, but I just can;t see how. I have other ports forwarded the same way with no issue.

EDIT2: I used a port forwarding test app on the server which reports the port forwarding is good on ports 22 and 23.

Last edited by MrSpandex; 06-28-2007 at 11:36 AM.
 
Old 06-28-2007, 11:48 AM   #8
bijit1709
Member
 
Registered: Oct 2006
Location: Costa Rica, Escazu
Distribution: Slackware 12.0 (2.6.21.5)
Posts: 67

Rep: Reputation: 15
To tell you the very truth i don't know much on NAT. I have ftp and ssh server at home and the only way I use to connect is I had to accquire a static ip from my isp and assign it to my server. After that i was able to connect from anywhere. I did not had to change any config file. Only had to add it so it starts automatically at start up(sshd).
 
Old 06-28-2007, 12:04 PM   #9
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by MrSpandex
COuld this possibly be because I am trying to connectto the external IP from within the local network?
That's exactly what it is, and it's discussed in the link I gave you in my earlier post.
 
Old 06-28-2007, 12:05 PM   #10
MrSpandex
LQ Newbie
 
Registered: Sep 2005
Location: Detroit, MI
Distribution: Slackware 11
Posts: 9

Original Poster
Rep: Reputation: 0
Wow, I am an idiot. Sorry for all the trouble And thanks for the help!

Last edited by MrSpandex; 06-28-2007 at 12:09 PM.
 
Old 06-28-2007, 05:41 PM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I missed that. I though you were trying to SSH into your home computer from work or a remote address. You should be able to SSH into that host using the hosts ip address, or if it is in /etc/hosts, using the local computer's hostname. Don't feel bad. We see many people trying the same thing to connect to their web server, using the FQDN instead of a local alias or local IP address.

Your router has a Public Internet address (unless you are an unlucky DNS customer). Your host doesn't need a public address as another respondent said. The port forwarding takes care of that.

About the hosts.deny and hosts.allow files, if you had "ALL : ALL" in hosts deny and only allowed LOCAL LAN connections, that could prevent sshd from connecting to an outside IP address. Since you don't have either file, that isn't the case. It was one thing to check. The hosts.deny file could be used to deny non-LAN connections. ( Not that a hacker couldn't try to connect from a machine on the LAN he compromised. )

An entry like "AllowUsers mrspandex@www.doom.com" would only allow connections to be authenticated for user "mrspandex" ( a local user account ) coming from a remote computer with a hostname of "www.doom.com". If you configure sshd to check IP addresses it will lookup www.doom.com. If that isn't a registered hostname, and isn't in your /etc/hosts file, the connection may be denied.

Last edited by jschiwal; 06-28-2007 at 05:43 PM.
 
Old 11-24-2007, 06:29 PM   #12
kulapalanont
LQ Newbie
 
Registered: Jun 2006
Posts: 2

Rep: Reputation: 0
Are there any way to config remote access to dynamic SSH server

IS IT TRUE !


ONLY NEED STATIC IP ! FOR REMOTE ACCESS TO SSH SERVER



Please I need solution to remotely move around my SSH server using no-ip


with Mac OSX.

Lan access is no problem.


I installed / reinstalled my Mac for both Tiger and Leopard still didn't work work a week.

Please confirm.


Thanks,


Kulapalanont
 
Old 11-25-2007, 04:44 PM   #13
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
I haven't read the thread, but... Not the static ip, but external one. Local ip like 192.168.x.x is not suitable one.
 
Old 09-19-2008, 10:22 AM   #14
jhelzunn
LQ Newbie
 
Registered: Apr 2008
Posts: 11

Rep: Reputation: 0
i also have the same problem. my server has 2 NIC ( one for private IP and another one for public IP)I can connect before to my server inside LAN or outside. then suddenly I could not connect anymore from outside. no problem from inside. I haven't change anything on my config. can anybody tell me why this happened? and what is the turn around for this problem of mine? thanks!
 
Old 09-19-2008, 03:35 PM   #15
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
If access from the outside "suddenly" stopped working, then either your ISP has now blocked the TCP/IP port where you were connecting to, or your ISP gives you a dynamic IP address which has suddenly changed. If you have registered a hostname for external access to your server, then the mapping hostname <--> IP address is broken.

Eric
 
  


Reply

Tags
networking, ssh



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
Cannot ssh from remote pc pk_fox Linux - Networking 2 09-24-2008 07:47 AM
remote ssh jonfa Linux - General 3 02-10-2005 09:35 PM
problems getting remote ssh/X connection working fabs Linux - Newbie 6 03-01-2004 10:24 PM
Remote with ssh DaFrEQ Linux - General 5 12-04-2002 10:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration