I am badly facing a stone wall while trying to remotely ssh into a local machine via Port 22 from anywhere outside my local network.
I have a local machine running with Ubuntu Server and a Fritz box on my local network.
The Local machine runs both on my Wi-Fi and my LAN. I can already ssh into the local machine, while being on my home network, directly connected to my router.
Preconditions
- I am Using Fritz box 7590
- Ubuntu Server v24.10 on a Raspberry PI 4
- Port forwarding for Ports 21,22,80,443 is set up and activated on my router
- I have set a static IP for the machine on my router
- OpenSSH is fully configured
- Local Access via SSH works
- Firewall status is inactive
- While performing an ssh connect on my local network I can see on my server some errors popping up brmcfmac: brcmf_set_channel: set chanspec 0x100e fail, reason -52 (WiFi works, though)
- I have the IP address from my router. Let's say it's 41.564.827.27
This is what I did already to reproduce the steps:
- Installed a full version of Ubuntu Server v23.10 including OpenSSH
- Configured all the users and privileges with different access rights
- Configured the SSH Client accordingly (SSH Status check=Active)
- I can now access my machine via the local network through my Mac, using term2 a terminal
- On my router, I have created the relevant port forwarding for PORT 22, 21, 80 and 443
- IfConfig is checked, and static IP was given to the device
- Iptables -L (input, output, forward) are all set to accept
- Checking my access logs on the machine, I can see that my requests are not being forwarded via the router.
Here are the errors I face while trying to ssh into the machine from outside the local network
❯ ssh -L 22 [email protected]
Bad local forwarding specification '22'
❯ ssh -p 22 [email protected]
ssh: connect to host 41.564.827.27 port 22: Operation timed out
❯ ssh -p 55 [email protected]
ssh: connect to host 41.564.827.27 port 22: Operation timed out
❯ ssh [email protected]:22
ssh: Could not resolve hostname 41.564.827.27:22: nodename nor
servname provided, or not known
I have pinged the router both internally and externally. ##Here are the results of the ping##
Internal Ping from the local network to the local IP
PING 192.168.178.1 (192.168.178.1): 56 data bytes
64 bytes from 192.168.178.1: icmp_seq=0 ttl=64 time=3.736 ms
64 bytes from 192.168.178.1: icmp_seq=1 ttl=64 time=4.215 ms
64 bytes from 192.168.178.1: icmp_seq=2 ttl=64 time=8.692 ms
64 bytes from 192.168.178.1: icmp_seq=3 ttl=64 time=6.017 ms
64 bytes from 192.168.178.1: icmp_seq=4 ttl=64 time=3.381 ms
64 bytes from 192.168.178.1: icmp_seq=5 ttl=64 time=8.389 ms
^C
--- 192.168.178.1 ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 3.381/5.738/8.692/2.149 ms
Internal Ping from the local network to the public IP
PING 41.564.827.27 (41.564.827.27): 56 data bytes
64 bytes from 41.564.827.27: icmp_seq=0 ttl=61 time=52.221 ms
64 bytes from 41.564.827.27: icmp_seq=1 ttl=61 time=61.948 ms
64 bytes from 41.564.827.27: icmp_seq=2 ttl=61 time=301.428 ms
64 bytes from 41.564.827.27: icmp_seq=3 ttl=61 time=344.452 ms
64 bytes from 41.564.827.27: icmp_seq=4 ttl=61 time=185.545 ms
64 bytes from 41.564.827.27: icmp_seq=5 ttl=61 time=16.076 ms
64 bytes from 41.564.827.27: icmp_seq=6 ttl=61 time=20.815 ms
64 bytes from 41.564.827.27: icmp_seq=7 ttl=61 time=42.052 ms
64 bytes from 41.564.827.27: icmp_seq=8 ttl=61 time=68.746 ms
64 bytes from 41.564.827.27: icmp_seq=9 ttl=61 time=151.611 ms
^C
--- 41.564.827.27 ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 16.076/124.489/344.452/112.113 ms
~/Developer master* 10s ❯ ping ackets transmitted, 4 packets received, 0.0% packet loss
External WAN ping on the public IP
PING 41.564.827.27 (41.564.827.27): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
^C
--- 41.564.827.27 ping statistics ---
11 packets transmitted, 0 packets received, 100.0% packet loss