0

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

  1. I am Using Fritz box 7590
  2. Ubuntu Server v24.10 on a Raspberry PI 4
  3. Port forwarding for Ports 21,22,80,443 is set up and activated on my router
  4. I have set a static IP for the machine on my router
  5. OpenSSH is fully configured
  6. Local Access via SSH works
  7. Firewall status is inactive
  8. 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)
  9. 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:

  1. Installed a full version of Ubuntu Server v23.10 including OpenSSH
  2. Configured all the users and privileges with different access rights
  3. Configured the SSH Client accordingly (SSH Status check=Active)
  4. I can now access my machine via the local network through my Mac, using term2 a terminal
  5. On my router, I have created the relevant port forwarding for PORT 22, 21, 80 and 443
  6. IfConfig is checked, and static IP was given to the device
  7. Iptables -L (input, output, forward) are all set to accept
  8. 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

Thanks in advance for all your help and time!

3
  • @user535733, done. As expected it results in a timeout. I assured myself that I was having the right public IP using ip4.me additionally.
    – Reeen
    Commented Oct 22, 2023 at 12:55
  • This sounds like it’s either a router mis-configuration or your ISP is blocking incoming ports. I would verify with your ISP that they are not blocking the ports. If they are, then you’ll have to port-forward from a different external port to your local port 22. If they are not blocking, then double check your port forwarding rules to ensure they’re correct. Please update your post with screenshots of the port forwarding config in your Fritz box.
    – mpboden
    Commented Oct 22, 2023 at 15:31
  • Thanks @mpboden. It turned out your assumtion was correct. My ISP gave me a DSL Lite connection without IPv4. So, the issue was the package provided by my ISP.
    – Reeen
    Commented Oct 30, 2023 at 12:26

0

You must log in to answer this question.

Browse other questions tagged .