SSH doesn't work: No route to host
Hi all,
I was connected to a mail server via PuTTY and all of a sudden the connecttion dropped and I've tried everything and no luck. My SSH is not the default port 22. Here are the commands I ran, Code:
# ssh -l root mailservername -p [my ssh port number] ssh localhost works just fine Code:
#ps aux | grep ssh Code:
#getenforce Code:
#nmap Code:
# traceroute [mailservername] The mail server is up and running but SSH to that box just doesn't work. would someone please help me fix this issue? I'd really appreciate it. Thank you, t |
Are you connecting from your LAN or from the outside?
Try to restart the ssh daemon. Kind regards |
Thanks repo.
I'm trying to SSH from inside the LAN. But the mail server doesn't have a LAN address(i.e. 192.x.x.x). It has only one interface which should be accessible from anywhere. The ifconfig returns only 127.x.x.x address and that external address. I've already rebooted the ssh many times, no luck. ssh localhost on the mail server works just fine. |
Did it worked before?
Did you forwarded port 22 on the router? Try to connect from the outside. Kind regards |
Thanks, I'll have to try to connect from the outside when I get home.
It has always been working just fine. The SSH port is not 22, have changed that years ago and apparently forwarding was working until couple days ago. |
If you have telnet on your localhost try doing:
Code:
# telnet localhost [port] If you get "connection refused" then odds are ssh is configured to only allow local connections. If it allows than problem is most likely external to server. Also, another place to check is /etc/services file. Make sure it is configured for correct port or some other perhaps new service isn't trying to take that port. ALSO - by default firewalls are configured to allow port 22. If ssh port is changed it really sounds like the firewall is blocking connect. Especially based on error message you are receiving. |
Thanks for your reply. I get a "connection refused" if I try port 22. If I try the port I configured to be my new SSH port, it says "no route to host". It has been working for years now and never had a problem with it and the firewall never blocked that before. Haven't installed a new thing on that machine either.
I tried accessing from outside of the LAN but same thing happened. I did stop and start the iptable and still no luck. Maybe the firewall detected something and automatically all of a sudden blocked that port? How can I make the firewall not block that custom port now? I did this and no luck: Code:
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport {my ssh port} ACCEPT |
This is what I found in each file:
iptables: Code:
# Generated by iptables-save v1.3.5 on Fri Jan 27 12:16:54 2012 Code:
nginx: .google.com This file was empty |
try this command
Code:
#netstat -ntlp | grep (ssh port no) |
All times are GMT -5. The time now is 11:31 AM. |