# ssh works with localhost only

## Gradaz

I am a Linux novice, so please dont flame me:) But here it goes:

I just installed openssh and I can get it to work through localhost only. I have a cable connection that uses an internal and external IP address:

 *Quote:*   

> 
> 
> eth0      Link encap:Ethernet  HWaddr 00:50:2C:04:D0:90
> 
>           inet addr:10.62.4.140  Bcast:10.62.255.255  Mask:255.255.0.0
> ...

 

Previously I was playing around with a ftp server under Win2k OS and I had a very similar problem. I could connect to my ftp from certain connections (for example I cound not ftp from company lan, but I could ftp from dialup connection. my company lan does not restrict ftp access). So I suspect that this problem might have to do something with my ISP network setup.

I did not change anything on stock firewall settings for Gentoo.

----------

## devon

Are you trying to ssh to your Gentoo box from the Internet? Are you forwarding tcp/22 through your router to your Gentoo box?

----------

## Gradaz

Well, I tried from my own box using "ssh root@XXX.bounceme.net" I am running a no-ip service.

I dont have a router. It is simple cable modem - computer setup. I assume the router is a part of the isp equipment.

----------

## devon

Did you try another user other than root? IIRC, direct root ssh logins are disabled by default.

----------

## herring

Just to be sure...

Did you configure ListenAddress in /etc/ssh/sshd_config ?

```
ListenAddress 192.168.1.1
```

My setup listens only on local subnet

----------

## nsahoo

I am having exactly the same problem. I had a wireless router before, then I could connect to my machine from my school, but, now I am connected to the modem directly without any router and can't connect to my box from school. I can ping, but, no ssh. I checked /etc/ssh/sshd_config, It has all ListenAddress commented. Any help ?

----------

## nsahoo

bump ...

any help ?

this is the verbose out put of ssh

```

% ssh -v nsahoo.redirectme.net

OpenSSH_3.4p1, SSH protocols 1.5/2.0, OpenSSL 0x0090609f

8575: debug1: Reading configuration data /etc/ssh_config-3.4

8575: debug1: /etc/ssh_config-3.4 line 22: Deprecated option "FallBackToRsh"

8575: debug1: /etc/ssh_config-3.4 line 23: Deprecated option "UseRsh"

8575: debug1: Rhosts Authentication disabled, originating port will not be trusted.

8575: debug1: ssh_connect: needpriv 0

8575: debug1: Connecting to nsahoo.redirectme.net [66.167.56.10] port 22.

```

it just stays like that.

----------

## devon

Is sshd runnig? What does "netstat -an --inet" show?

----------

## herring

 *nsahoo wrote:*   

> bump ...
> 
> any help ?
> 
> this is the verbose out put of ssh
> ...

 

Is the IP adress of you box you're running sshd on 66.167.56.10 ?

Then try listening on this interface(eth0)/address.

----------

## nsahoo

 *herring wrote:*   

> 
> 
> Is the IP adress of you box you're running sshd on 66.167.56.10 ?
> 
> Then try listening on this interface(eth0)/address.

 

Yes the ip is correct. By listening do you mean pinging ? ping works. but, i don't know how to ping on a particular port. 

```
% ping nsahoo.redirectme.net

nsahoo.redirectm: #####

nsahoo.redirectm:   5/5   succ. = 100.00%

```

and 

```

% ping 66.167.56.10

66.167.56.10    : #####

66.167.56.10    :   5/5   succ. = 100.00%

```

but telnet at port 22 fails.

```

% telnet nsahoo.redirectme.net 22

Trying 66.167.56.10...

^C

% telnet 66.167.56.10 22

Trying 66.167.56.10...

^C

%

```

----------

## Rebes

Is sshd running?

/etc/init.d/sshd start

To make it start at boot time, do this:

rc-update add sshd default

If it's running, and you still can't connect to it, you can comment out the ListenAddress in /etc/ssh/sshd_config, and it will listen on all addresses instead of just localhost.  ie, do this:

#ListenAddress localhost

#ListenAddress ::

Then restart sshd with

/etc/init.d/sshd restart

Hope this helps a bit,

R!

----------

## nsahoo

sshd is running already. tried restarting, still no use  :Sad: 

there is no ListenAddress line in my /etc/ssh/sshd_config

It was working when I had a router, and I had set up port forwarding in it. But, now that I have connected it to modem directly, without router, it does not work.

----------

## devon

Can you verify that sshd is listening on the right interface? What does a "netstat -an --inet" show?

----------

## nsahoo

surprisingly it started working today (i don't like this kind of surprises). yesterday I had upgraded the firmware of my modem. may be it had something to do with working.

----------

## vertigo

I'm having a similar problem. sshd listens fine on eth0, which is pulling an ip open to the internet from a cable modem.

However, as soon as i pull a dynamic ip from an internal network on eth1, sshd seems to 'jump' over to the internal address

Ie, eth0 is set to 24.xxx.xxx.y, and eth1 is inactive.

I can ssh to 24.xxx.xxx.y without any problem.

As soon as I issue a dhcpcd eth1, and have eth1 pulling an ip of 192.168.0.104,

I can no longer ssh to the 24.xxx.xxx.y address, but i can ssh to the 192.168.0.104 address.  Same thing happens with squid.

Any ideas? I feel like i must be missing something stupid...

Relevant portions of my sshd_config:

```

Port xx

#Protocol 2,1

#ListenAddress 24.164.246.65

#ListenAddress ::

```

I had read that if ListenAddress is commented out, sshd will listen on all local addresses..

----------

## devon

What does a "netstat -tln" show before and after you bring up eth1? Does "ssh -vv <ip>" show anything when you try to connect to the 24.x.x.x address after bringing up eth1?

----------

## teknomage1

Are you doing anything crazy like running iptables or somesort of firewall, that might be blocking port 22?

----------

