this is my first post on here so constructive criticism is appreciated.
target machine uname -a (the NAS itself):
Linux nas 4.19.0-9-amd64 #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07) x86_64 GNU/Linux
remote machine uname -a (the machine from which I'm attempting to access the NAS):
Linux tilly 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
The following aliases are used throughout the post:
LocalIPv4 - The local ipv4 address of the NAS assigned by the router (192.168.X.X).
WinLocalIPv4 - The local ipv4 address of a windows machine (accepting Remote Desktop connections) connected to the same router; this is the machine I used to test RDP (also 192.168.X.X).
PublicIPv4 - The public ipv4 address of the router
I'm setting up a NAS fileserver and have been having issues shelling into the machine via the internet. This isn't my first rodeo with ssh; I spent plenty of time trying, and failing, to fix it myself.
Locally, that is ssh localhost on the target machine works fine. Similarly, ssh LocalIPv4 from machines on the same network works fine. I have little experience manipulating Debian's firewall (ufw) so as far as I know it's been left default(See below for output of iptables -L).
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Pinging the router's PublicIPv4 works fine; here's the output:
PING PublicIPv4 (PublicIPv4) 56(84) bytes of data.
64 bytes from PublicIPv4: icmp_seq=1 ttl=63 time=5.08 ms
64 bytes from PublicIPv4: icmp_seq=2 ttl=63 time=3.59 ms
64 bytes from PublicIPv4: icmp_seq=3 ttl=63 time=11.4 ms
64 bytes from PublicIPv4: icmp_seq=4 ttl=63 time=13.6 ms
^C
--- PublicIPv4 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 3.589/8.424/13.592/4.194 ms
Port 22 has been forwarded to the correct machine in the router's settings. Here's the output of ssh -vvv PublicIPv4:
OpenSSH_8.2p1 Ubuntu-4ubuntu0.1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname PublicIPv4 is address
debug2: ssh_connect_direct
debug1: Connecting to PublicIPv4 [PublicIPv4] port 22.
note from op: Hangs here with no timeout; I have to Ctrl+C out.
Here's the output of netstat -tlpn | grep 22:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 17420/sshd
tcp6 0 0 :::22 :::* LISTEN 17420/sshd
Thinking it was an issue with the isp blocking certain ports, I tried switching to port 2222. With this port, ssh localhost -p 2222 from target machine and ssh LocalIPv4 -p 2222 from networked machine both work fine. However, the same issue when running ssh -vvv PublicIPv4 -p 2222.
I have also tried completely disabling the router's firewall, which was also default showing no obvious reasons why it would block port 22. I heard mention of some odd reverse DNS lookup issues and tried adding host rules in /etc/hosts on both machines to no avail.
In a desperate attempt, I tried accessing networked windows machines with RDP. I used rdesktop WinLocalIPv4 which also works fine, but, after forwarding the appropriate ports, even rdesktop PublicIPv4 hangs on a similar Connecting to . . . debug output line.
I've exhausted every option I know of as well as others that I have seen on this exchange. If there's any other information you would need to better inform your own troubleshooting/diagnosis I would be more than happy to provide. Thanks for the time.
EDIT:
After using a service called Shields Up!, it reported that the ports I had opened were operating in its "stealth mode". After disabling all obvious security features of my router, temporarily, the service still reported those ports as a "black hole for tcp packets". I'm almost certain this is the issue, but now the question is how do I actually open these ports? It seems as if disabling security features and port-forwarding are useless to that end. I'm considering opening a new question, but I'm not entirely sure where as this platform is new to me. Any advice on that front is appreciated.
EDIT 2:
After enabling connectivity logs on my router and running a probe of ports 0-1023, via Shields Up!, on my network, the connectivity logs report no incoming connections at all. The logs are working; there is plenty of outgoing https traffic. This definitely seems to be the issue, but I don't know how to stop this behavior. Where would I post a question like that?