Router Port Forwarding and SSH – A Complete Guide

networkingport-forwarding

I would like to access my Ubuntu PC remotely via SSH. The SSH daemon is currently listening on port [x].
My router is a ASUS DSL-N12E.

I have created a rule for the firewall with the following parameters:

  • Protocol: TCP
  • Direction: Downstream
  • Source Port: [x]
  • Dest IP/Mask: 192.168.1.100/255.255.255.255
  • Dest Port: [x]

and a NAT Virtual Server rule with the following parameters:

  • Protocol: TCP
  • Local IP: 192.168.1.100
  • Local Port: [x]
  • WAN IP: pppoe1
  • WAN Port: [x]

I'm able to connect to the SSH server from the local network, using ssh -p [x] myuser@192.168.1.100, but I can't do it using ssh -p [x] myuser@mypublicip. I'm guessing there's something wrong with the router configuration although canyouseeme.org says that port [x] is open.

Any ideas about what I might be doing wrong?

Best Answer

This is a common issue on a lot of routers.

It sounds simply like you need to enable NAT reflection, Nat hairpin or NAT loopback, the name changes on different routers - but be warned that not all routers support it.

... Please check your firmware version, it looks like your router either didn't support it out the box, or has been buggy... I just found this, although 6 months old, it indicates a firmware fix where loopback wasn't always working. (Don't get from here - check Asus directly for even newer).

Related Question