I set up a SSH server on my Ubuntu on my laptop by OpenSSH. While ssh localhost is okay, I try to first ssh to another computer from, and then from there ssh back to my laptop with its external IP address but it fails with "connect to host xxx port xxx: Connection timed out". My laptop is wirelessly connected to the internet through a router with Comcast as the provider. So I guess I am having a dynamic IP? What is the correct way for setup or connection? Thanks and regards!
If the IP reported by ifconfig is in the range
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255
You will need to configure your router to forward port 22 to this address. SSH should still work from other machines on your wireless lan.
As the answer above states, if you're on a wireless LAN, you're probably stuck behind a NAT (network address translation) firewall. You need to go to your wireless router's configuration page (usually http://192.168.0.1) and tell it to forward connections on port 22 to your laptop.