0

Short intro: I have 2 servers. Home server and in remote location Raspberry Pi. Both are running ssh, postfix (rpi as backup), bind (home server for lan only), squid3, fail2ban and other (possibly not so important).

Both are behind routers with static public IPs. Problem started few days ago with casual connection (ssh) from home network to rpi and connection was unsuccessful (timed out), checked that IP is being resolved properly and tried from phone to connect - worked. Tried to connect to router (WebUI) worked, nothing is being blocked/banned. Tried to connect trough http-proxy (from home to rpi) worked.

nmap'ing shows that port 22 is being filtered, but doing the same thing from work showed the port is open. From work ssh'ed to home and then tried to ssh into rpi and the same thing.

Checked iptables on both devices and the IP isn't being blocked.

I can ssh from rpi to home but not vice versa. tcpdump shows that home is sending packets, but rpi shows that nothing is being received.

Tried to connect portable PC directly to wall Ethernet outlet, but the same situation.

rpi:# iptables -S

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N fail2ban-recidive
-N fail2ban-ssh
-A INPUT -p tcp -j fail2ban-recidive
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A fail2ban-recidive -j RETURN
-A fail2ban-ssh -s 91.224.161.69/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -s 85.25.120.207/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -s 113.21.228.166/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -s 122.225.243.194/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -s 183.61.109.240/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -s 116.31.116.48/32 -j REJECT --reject-with icmp-port-unreachable
-A fail2ban-ssh -j RETURN

none of the banned IPs are mine.

Already tried SSH Server Not Responding To Connection Request

If some logs or tests needed please say!

Thanks in advance!

0

Tried sudo traceroute -4T -p 22 [ip_address] with specific port and discovered that all packets (not only when trying to ssh into rpi, but also to other servers) with dest port 22 gets stopped at my ISP's gateway. Opened another port for ssh and now everything works like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.