Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I looked on previous related answers and I think I'm close to nail this down...

I can ssh from my machine outside to other servers on the internet. When I try to ssh back to my machine, the connection is refused. I'm working on Ubuntu 10.4.

I found out that in my wireless router settings, all inbound traffic are blocked. I then added SHH and FTP to the white list. I can see now a private and public ip addresses. After rebooting both my machine and the router (which is also the modem), the problem is yet to be fixed.

Any ideas? Thanks!

last comment - I'm using the inet address I see under wlan when I run the ssh; is that correct? it even fails when I'm trying to ssh from my machine to my machine.

update: I can see on my router page the following:

|device: allowed apps: app type: protocol : port #: public ip|
my-laptop  : SSH Server   : - :  TCP     : 22:      108...

I'm trying to connect from the internet and I'm using the WAN IP. How do I check if the router forwards inbound connections to my local ip address?

Solution

Two things to do:

a. I was using a wrong ip address. The inet address is private. The router assigns a different public address that is not listed using ifconfig. Need to go to the router settings and find it. Even easier, go to www.whatismyip.com to find out the right ip.

b. Also, Need to check if Ubuntu blocks the inbound traffic. I don't know what's the default because I played with it from the command line and I might changed things. Anyway, Ubunutu has a firewall apparently, called ufw I think; it maintains something called iptables that contains rules for inbound and outbound access. The easiest way to update it is to install gufw (a very intuitive gui for the firewall) and either allow all inbound traffic or just certain services like ssh on port 22.

Thanks for the help!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Is the local computer configured correctly to accept SSH connections?

Have you checked this by attempting to connect from another machine on the same local network? If you cannot connect locally, you must solve that issue first before moving on.

This seems obvious, but will obviously prevent all other measures from having any effect - the computer needs to not be firewalling connections on the ports you need and must have a relevant application / service / daemon correctly configured and running to accept the connections.

Apologies, as I didn't spot the relevant comment the first time I read the question or I would of said this initally, but since you cannot SSH from the machine to itself, this could well indicate a problem in this area (this is assuming you are connecting to its LAN IP, or localhost, and not the WAN IP).


Is your router forwarding the ports to the correct internal IP?

This isn't immediately clear from your question, so thought I'd check.

If you are connecting from within the same LAN you need to connect to the computer's local IP.

If you are connecting from the internet you need to connect to you router's WAN IP, and the router has to be configured to accept conections on the relevant ports and also to forward inbound conections on those ports to your computer's local IP address.


Does your ISP block the relevant ports?

Some ISP's block inbound connections to certain ports for "home" users to stop "home" users from using their connection for business purposes.

Not sure how you'd go about checking this (reading your ISP's policies is probably a good start) but if they are blocking the ports you'll need to use a different port instead - one that isn't blocked - and forward that port from your router as required.

share|improve this answer
    
done. thanks a lot for your help. –  user56165 Nov 19 '10 at 12:44
    
@user it looks like forwarding is probably configured then - in which case there's two other possibilities I've thought of. I'll update my answer... –  DMA57361 Nov 19 '10 at 12:45
1  
@user56165: Some routers will not let you connect from inside the LAN to the public IP. In this case and as was said above: from inside the LAN you can only connect to local addresses. –  harrymc Nov 19 '10 at 12:49
    
@DMA57361 maybe I'm using the wrong ip? I type ifconfig and use the inet address listed under wlan0. –  user56165 Nov 19 '10 at 12:50
    
@DMA57361 thanks a lot for the excellent update! It seems tat the first option is the most relevant at the moment, since I cannot ssh from my machine to my machine when using the inet address listed under "lo" (ifconfig). What service may block it? I don't think Ubuntu comes with a firewall, but maybe there's somewhere to modify the networking settings. –  user56165 Nov 19 '10 at 12:58
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.