Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have probably the simplest ssh/portforwarding question imaginable. I've searched around here and elsewhere, but I haven't managed to get this working. I've used networks and ssh for years, but never set one up before, so there is some basic understanding missing.

Anyhoo, what I want to do is simple. I have a WLAN at home with a Netcomm modem/router. I believe I have setup portforwarding of port 22 for a particular machine I have running at home (i.e. specifying the 192.168.1.X address for this machine). I did this via the GUI interface to the modem.

Now, I want to be able to SSH into this machine from anywhere else outside of my home WLAN (i.e. remotely).

I can successfully ping my fixed IP address, but attempting to ssh simply fails to connect. For what it's worth the machine is running Ubuntu. Sorry to ask such a basic question.

share|improve this question

migrated from Apr 12 '12 at 9:34

This question came from our site for professional and enthusiast programmers.

What happens when you try to connect to port 22 on your public IP address using telnet or nc ? Do you see SSH headers? If not, then you probably haven't configured your router correctly. On your machine at home, what does tcpdump show you on incoming port 22 connections? Are they received? Lots of basic debugging you could do before bringing this here. By the way, this is a programming forum.... – ghoti Apr 12 '12 at 4:47

2 Answers 2

you will need to go to configuration panel of your modem/router. then forward ssh port to the IP of that machine thats running sshd

In netgear its on Firewal Rules You need to add Inbound Service for that 192.168.1.X on port 22 for Service ssh

share|improve this answer
Thanks. I think that I have already done this, at least I have attempted to. Perhaps this is not correctly configured. I will double check. – Bogdanovist Apr 12 '12 at 3:43
Can you correct my understanding here. A wireless modem/router uses NAT to connect your machine to the Internet. So, without any ssh port forwarding business you cannot ssh to your internal machine. Hence you are forwarding your routers incoming packets on port 22 to your internal machine. Hence you are doing something like this on the router : "Forward my incoming packets on localhost port 22 to local machine port 22 using localhost as an intermediate" . Does a router provide this facility ?? Does it have a small computer or this is all done by changing routing table entries ?? – prathmesh.kallurkar Apr 12 '12 at 5:01
@prathmesh.kallurkar Most routers do, indeed, provide such a facility - the common name is "port forwarding", but it's not quite the same as the same concept in ssh, since there's no ssh transport layer involved; basically all the router needs to do is rewrite the packet headers a bit. Generally they're running some form of Linux, and the firewalling and port-forwarding both are all the kernel firewall (managed internally with iptables) in the background, but that's not relevant to the question. If it's correctly set up (quite easy on most routers) then the router shouldn't cause a problem – Darael Apr 12 '12 at 13:33

You need to verify if your ISP does not prevent creating connections (some here in Brazil prevent your fixed IP to listen on lower ports (< 1024)).

One other option is to have a machine on the Internet to work as a proxy to your home machine - on the home machine you need to run ssh with -R to this proxy machine and enable GatewayPorts on remote so you can redirect a port on a interface rather than localhost. For instance, if you run on your Ubuntu machine:

ssh -N -f -R user@remote-machine

All connections on port 2222 of remote-machine will be redirected throught the tunnel to your Ubuntu machine (even if this machine is inside a NAT and without port forwarding your modem).

share|improve this answer

Your Answer


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.