0

I'm running a simple Ubuntu installation on a custom built box on my home network. I am able to SSH into the box from the local 192.x.x.x address while on my home wifi.

I've been trying to get this connected in a way that I can SSH into the box from other networks, like at work and I think I've read every article on the internet now about how to do this.

  1. Server is running OpenSSH, can connect to it from within the network. Check.
  2. Router (Eero) has port forwarding enabled. I have one port forwarding reservation set up forwarding 21>192.x.x.x:22 Check.
  3. I can ping my external IP, 67.x.x.x (I tethered my laptop to my phone's cellular before doing so). Check.
  4. Now I assume I should be able to do ssh [email protected] -p 21 but this times out.

When I run nmap on this IP, it does not find any open ports.

All 1000 scanned ports on ai.sytes.net (67.x.x.x) are filtered

Running it with -nP says I have about 999 "filtered" ports. Only port 21 is listed as open. Could any of that be the reason?

Starting Nmap 7.60 ( https://nmap.org ) at 2018-03-06 21:33 PST                         
Nmap scan report for yy.yy.net (67.x.x.x)                                       
Host is up (0.018s latency).                
rDNS record for 67.x.x.x: c-67-x-x-x.hsd1.ca.comcast.net                      
Not shown: 999 filtered ports               
PORT   STATE SERVICE  
21/tcp open  ftp      

Nmap done: 1 IP address (1 host up) scanned in 10.68 seconds 

Edit: Looks like 22 and another four digit port were open to when I ran nmap -sT -p XX [host] against those ports. I've set up port forward reservations for those as well but am still getting the same results.

5
  • Have you set firewall rules to allow this kind of traffic across your public interface?
    – Spooler
    Mar 7, 2018 at 6:48
  • Try ssh -p 21 [email protected] instead. All options after user@host are passed to the remote shell, not to local ssh
    – Kondybas
    Mar 7, 2018 at 6:51
  • @Kondybas Thanks. Tried that but still the same results.
    – Adam Grant
    Mar 7, 2018 at 7:06
  • @SmallLoanOf1M I haven't. Where would I set those. Is that something that I do on the host server?
    – Adam Grant
    Mar 7, 2018 at 7:06
  • How did you find the IP address? What does a traceroute to that IP address look like from the server?
    – kasperd
    Mar 7, 2018 at 8:08

2 Answers 2

1

Be sure that you're not only providing a port forward from your public IP to your target private IP, but also that you're allowing incoming traffic via this port and public IP on your firewall.

You're not having local SSH issues, so you can safely discount the server side OS firewall as your problem. However, your firewall that owns the public IP needs rules configured to allow incoming traffic on public-ip:22 even if you have a forward across your NAT set up for that port.

I'd generally recommend using 22 for SSH unless you have a good reason not to. A good reason would be that another more important machine is accepting SSH connections on this port, such as the firewall itself. This just makes things more obvious regarding functionality.

1
  • It appears that my firewall is configured to allow this, if you mean the firewall config on my router. By default it blocks incoming conns from the internet unless you explicitly set port forwarding.
    – Adam Grant
    Mar 7, 2018 at 8:30
0

You did not explicitly mentioned for which protocol (tcp, udp) the port-forwarding is configured. Since ssh uses tcp, make sure that the port-forwarding is for "tcp".

2
  • 1
    In Eero, I have it configured to use both, but thanks for letting me know.
    – Adam Grant
    Mar 9, 2018 at 2:31
  • shutdown the ssh server and test (nmap) if the port 21 on the router is still open, then some other service would be using it. Then/Additionally your could try another port forwarding, e. g. router:2022 to ssh-server:22 Mar 10, 2018 at 10:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .