LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
LinkBack Search this Thread
Old 06-14-2011, 07:26 AM   #1
Awesome
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Rep: Reputation: Disabled
Exclamation SSH server problem. Can connect remotely but not locally


I'm having issues with my SSH server.

The server is running on a Slackware 13.37 machine, using the default SSH server software, which I believe is OpenSSH.

On my Windows machine, I've tried connecting to my Slackware machine but can only do so using the external IP, not the LAN IP, instead I get a "Connection Refused" error using PuTTy. I've forwarded port 22 for both UDP and TCP packets to my Slackware machine.

I don't really know what information you need so just ask me and I'll respond to the best of my abilities.
 
Old 06-14-2011, 07:39 AM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,769
Blog Entries: 1

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
Welcome to LQ!

We'll probably need to see your sshd_config file and any firewall you may have in place, particularly on the Slackware box. You also might look in the log files (/var/log) and see if sshd is leaving better clues as to why it is refusing a connection.
 
Old 06-14-2011, 07:59 AM   #3
Awesome
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Hangdog42 View Post
Welcome to LQ!

We'll probably need to see your sshd_config file and any firewall you may have in place, particularly on the Slackware box. You also might look in the log files (/var/log) and see if sshd is leaving better clues as to why it is refusing a connection.
Thank you.

Doing a tcpdump shows that the Slackware machine doesn't even get the connection, this is further strengthened by the fact the the log files aren't picking up the attempt to connect either, at least when trying to connect using the LAN IP, using the external IP it shows, since it is possible to connect then. What information do you need from sshd_config file?

Also, I already checked the firewall, and that showed that port 22 is open and listening for the SSH server.
 
Old 06-14-2011, 08:16 AM   #4
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,769
Blog Entries: 1

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
Quote:
Originally Posted by Awesome
Doing a tcpdump shows that the Slackware machine doesn't even get the connection, this is further strengthened by the fact the the log files aren't picking up the attempt to connect either, at least when trying to connect using the LAN IP,
OK, that certainly helps.

Quote:
Originally Posted by Awesome
using the external IP it shows, since it is possible to connect then. What information do you need from sshd_config file?
Hm. Hold off on sshd_config for a bit, unless you've got the ListenAddress set to anything besides the default.

Quote:
Originally Posted by Awesome
Also, I already checked the firewall, and that showed that port 22 is open and listening for the SSH server.
The other place to look would be your hosts.allow/hosts.deny files. Those can be used to intercept IP addresses prior to SSH seeing them. By the way, I'm assuming you don't have any IP address restrictions anywhere in your firewall. Also, are you running something like fail2ban on the SSH server? And just as a test, you might try turning off the firewall temporarily and seeing if you can connect. Maybe a rule earlier on in the firewall is stopping the traffic from your LAN.

The last thing I would think about would be is your router behaving correctly when using LAN IP addresses? Are there other services you run on your LAN that work properly when identifying computers by IP address?
 
Old 06-14-2011, 10:12 AM   #5
Awesome
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Hm. Hold off on sshd_config for a bit, unless you've got the ListenAddress set to anything besides the default.
It is the default.

Quote:
The other place to look would be your hosts.allow/hosts.deny files. Those can be used to intercept IP addresses prior to SSH seeing them. By the way, I'm assuming you don't have any IP address restrictions anywhere in your firewall. Also, are you running something like fail2ban on the SSH server? And just as a test, you might try turning off the firewall temporarily and seeing if you can connect. Maybe a rule earlier on in the firewall is stopping the traffic from your LAN.
Both the hosts.allow and hosts.deny files are the default. I should also note that this was working fine just about a month ago. I don't have any IP restrictions in my firewall. I'm not running anything like fail2ban anywhere. About the firewall, the Windows built in one is turned off, and the router doesn't have a built in firewall I believe (it's a DLink DIR-100), and I believe Slackware doesn't have a built-in firewall?

Quote:
The last thing I would think about would be is your router behaving correctly when using LAN IP addresses? Are there other services you run on your LAN that work properly when identifying computers by IP address?
The machine I'm trying to connect with, my Slackware box, and my router, can all ping each other.
 
Old 06-14-2011, 10:51 AM   #6
jlarsen
Member
 
Registered: Jan 2005
Location: Dallas, TX
Distribution: Slackware 13.0
Posts: 76

Rep: Reputation: 15
No, there is not a firewall on Slackware out of the box. Since you have not changed any of the sshd config files I would lean toward thinking it is network related.
You said you can ping it, do you mean you can ping the LAN address? Start tcpdump on the internal interface of the Slackware box and do a portscan from the Windows box. Can you see the traffic?
Maybe try removing network cables from the Slackware box and ping the LAN address again - just to rule out ip conflict.
How many ip's does the Slack box have verse how many network interfaces (use lspci to find them)? Could the cable be in the wrong NIC? I only ask because I have done stuff like that before.
Good luck...
 
Old 06-14-2011, 11:21 AM   #7
oso_togari
LQ Newbie
 
Registered: Jan 2008
Distribution: SOLARIS 9, RHEL4
Posts: 22

Rep: Reputation: 0
Question

Hi
knows nothing about the schema of the LAN, and asuming that the config files are OK, sounds like an IP masquerading problem or a DMZ firewall config

Maybe ICMP packets are driven with no problems, but other kind of traffic are not allowed, and maybe this configs are not applied when you enter via "external"

its only a idea.
 
Old 06-14-2011, 11:31 AM   #8
Awesome
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
OK, I think I have found the problem. The LAN IP seems to be a little messed up.

Disconnecting the ethernet cable from my Slackware machine didn't make the LAN IP I tried connecting to un-pingable, meaning that I was trying to reach the wrong IP. However, during boot, it says "[DHCP] leased 192.168.0.101 for 60800 seconds". 192.168.0.101 was the LAN IP I was trying to connect to. Also, doing an ifconfig -a shows that it has 192.168.0.101 as it's LAN IP. Furthermore when selecting ports to forward, the Slackware machine's IP is listed as 192.168.0.101 (select device -> slackware machine -> input in box becomes 192.168.0.101). However, my router doesn't list it as an active device on it's status page, but it doesn't list my internet connected Xbox either, so I'm not really sure if that matters.
 
Old 06-15-2011, 07:08 AM   #9
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,769
Blog Entries: 1

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
Man, this is seriously weird. Generally if ifconfig shows you an IP address, that is what the box is trying to use. The fact that port forwarding from the WAN side works, suggests that the IP address isn't the problem. If the Slackware box didn't know its IP address, it wouldn't respond to either the WAN or the LAN connection attempts.

I would look very hard at the router. If you've tried to set up something like MAC filtering or DNS you might try turning those off and testing. Get to as basic a router config as possible. You also might give it a good power down and re-booting, it is possible the routing tables have gotten messed up (of course that would also affect ping, but we've reached the fishing stage here). By the way, it might be useful to know the make/model of the router.

Quote:
Originally Posted by Awesome
Both the hosts.allow and hosts.deny files are the default. I should also note that this was working fine just about a month ago.
I know this is asking a lot, but can you think of anything that changed around the time it stopped working? Software changes? Bad storms?
 
Old 06-15-2011, 08:05 AM   #10
Awesome
LQ Newbie
 
Registered: Jun 2011
Posts: 5

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by Hangdog42 View Post
Man, this is seriously weird. Generally if ifconfig shows you an IP address, that is what the box is trying to use. The fact that port forwarding from the WAN side works, suggests that the IP address isn't the problem. If the Slackware box didn't know its IP address, it wouldn't respond to either the WAN or the LAN connection attempts.

I would look very hard at the router. If you've tried to set up something like MAC filtering or DNS you might try turning those off and testing. Get to as basic a router config as possible. You also might give it a good power down and re-booting, it is possible the routing tables have gotten messed up (of course that would also affect ping, but we've reached the fishing stage here). By the way, it might be useful to know the make/model of the router.



I know this is asking a lot, but can you think of anything that changed around the time it stopped working? Software changes? Bad storms?
This is odd indeed. When I unplugged it, it was still pingable, with responses (any idea why?), however, after plugging it back in, it magically worked. I hate when these things happen, why did it just start working again? I really need to get around to reading books about networking and such, so I can understand and fix these problems my self.
 
Old 06-15-2011, 11:42 AM   #11
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,769
Blog Entries: 1

Rep: Reputation: 410Reputation: 410Reputation: 410Reputation: 410Reputation: 410
Quote:
Originally Posted by Awesome View Post
This is odd indeed. When I unplugged it, it was still pingable, with responses (any idea why?), however, after plugging it back in, it magically worked. I hate when these things happen, why did it just start working again? I really need to get around to reading books about networking and such, so I can understand and fix these problems my self.
WHAT??!?!??!?!???

OK, one of the general rules of thumb I have is when things head this far into the Twilight Zone, I start thinking there is a hardware problem. Maybe a bum cable? Loose connection?

One other explanation is that you have two devices on your LAN with the same IP address. Is that possible? Usually that causes some pretty noticeable network issues, but hey, I'm fishing hard here.
 
Old 06-16-2011, 02:27 AM   #12
splinux
Member
 
Registered: Jun 2011
Location: Sri Lanka
Distribution: centos,redhat,ubuntu
Posts: 90

Rep: Reputation: Disabled
Awesome:

Hi enable the forwarding setup and set the ports
flush the iptables totally
disable the router firewall + ur firewall
enable the net.ipv4.ip_forward = 1
restart the all the services again and make sure SSH port 22
u tell any friend login from his IP it will work.
Some routers have problems connecting from the inside to the outside and back in

http://www.linuxquestions.org/questi...lic-ip-886488/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New ISP / modem... Unable to connect to ssh server (or ping) remotely Lyle Linux - Networking 6 03-07-2011 01:04 PM
vsftpd: can connect remotely but not locally jsmith6 Linux - Server 3 02-08-2011 04:31 PM
xen: Running Firefox remotely via ssh -X actually runs locally. ordinary Linux - Networking 9 02-27-2008 10:02 AM
vsftpd server: can connect locally, not remotely propz Linux - Networking 2 10-24-2005 12:59 AM
Howto use Postfix, Kmail locally, pine & ssh remotely ? chazza Linux - Software 0 12-27-2003 11:56 AM


All times are GMT -5. The time now is 01:31 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration