I'm experiencing problems wanting to access my SSH server over my public IPv4 address, in my local network everything works fine though.
The connection would work as expected locally:
[alex@deathstar ~]$ ssh 192.168.178.86 -p 1338
Last login: Wed Jan 8 12:30:51 2020 from 192.168.178.85
[alex@bielefeld ~]$
But fatally fail publicly:
[alex@deathstar ~]$ ping 62.XXX.XXX.XXX
PING 62.XXX.XXX.XXX (62.XXX.XXX.XXX) 56(84) bytes of data.
64 bytes from 62.XXX.XXX.XXX: icmp_seq=1 ttl=63 time=13.3 ms
(...)
[alex@deathstar ~]$ ssh 62.XXX.XXX.XXX -p 1338
ssh: connect to host 62.XXX.XXX.XXX port 1338: Connection timed out
I'll give a quick summary:
- My server is using Arch Linux (2020.01.01)
- The server's firewall is disabled
- I've forwarded the port on my router (Fritz!Box 7590 version 07.12)
- Everything works fine inside my local network
- Pinging the public IPv4 address works
Also these checks I did may be useful:
Firewall settings:
I'm using Uncomplicated firewall.
[root@bielefeld /]# ufw status
Status: active
To Action From
-- ------ ----
1338/tcp ALLOW Anywhere
1338/tcp (v6) ALLOW Anywhere (v6)
Network connections (Server):
You can also see my other computer being connected over the local network.
[root@bielefeld /]# netstat -tupan
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:1338 0.0.0.0:* LISTEN 4068/sshd
tcp 0 0 192.168.178.86:1338 192.168.178.85:53868 ESTABLISHED 3326/sshd: alex
Port scan locally (From server):
[root@bielefeld /]# nmap -p 1338 localhost
Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-08 13:10 CET
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000043s latency).
Other addresses for localhost (not scanned): ::1
PORT STATE SERVICE
1338/tcp open SSH
Nmap done: 1 IP address (1 host up) scanned in 0.13 seconds
Port scan on the server (From client)
[alex@deathstar ~]$ nmap -p 1338 62.XXX.XXX.XXX
Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-08 13:26 CET
Note: Host seems down. If it is really up, but blocking our ping probes, try -Pn
Nmap done: 1 IP address (0 hosts up) scanned in 3.04 seconds
SSH daemon configuration (/etc/ssh/sshd_config)
Port 1338
ListenAddress 0.0.0.0
PermitRootLogin no
MaxAuthTries 3
MaxSessions 6
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
PermitEmptyPasswords yes
UsePAM yes
AllowAgentForwarding yes
AllowTcpForwarding yes
GatewayPorts yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
PermitTTY yes
PrintMotd no # pam does that
AllowUsers alex
Thank you so much in advance! I've grown deseperate to this point.