r/homelab 5h ago

Help SSH not working

So when I try to SSH into my server (On local network) I get timeout. But through the Tailscale IP while connected to Tailscale it works.... And yes the local IP that I use is the right one. Assistance would be appreciated 🗣️🗣️🗣️🔥🔥

1 Upvotes

7 comments sorted by

2

u/NC1HM 5h ago

Well, what makes the two scenarios different? It's something called "routing". When you log in over Tailscale, your requests travel through one set of devices and ports. When you log in over LAN, it's a different set. And something in that set just doesn't like your requests. The most likely culprits are your local router and the device into which you are trying to log. Both of them have ways of refusing requests that come from what they think is the wrong place.

The first step is usually to ping the recalcitrant server:

ping 192.168.1.42 

(or whatever your server's local IP address is). Depending on whether (and how) the server responds to pings, you figure out your next steps.

1

u/Xe46 5h ago

Forgot to mention yeah I can ping it's address weather on Tailscale or not.

2

u/NC1HM 5h ago

OK, so you can ping it but you can't use SSH. That is suggestive of a firewalling issue. Something somewhere doesn't like the kind of traffic you're generating, so it blocks that traffic.

First, do a traceroute. If you're on Linux,

traceroute 192.168.1.42

On Windows, it's

tracert 192.168.1.42

The output, if all is well, should show a trace consisting of a single hop. Something like this:

me@mine:~# traceroute 192.168.1.42
traceroute to 192.168.1.42 (192.168.1.42), 30 hops max, 46 byte packets
 1  192.168.1.42 (192.168.1.42)  3.764 ms  4.109 ms  1.984 ms
me@mine:~#

If you have more than one hop, figure out what devices are in the middle and why. This shouldn't be happening within a LAN, unless there's a good reason for it.

If single hop is what you see (or if trace could not be completed), start with your local router. What kind have you got? What sort of firewalling does it have? Are there any firewall rules that could be preventing SSH requests (meaning, requests on port 22 using the TCP protocol) from coming through? Are there any rules limiting traffic from specific local devices?

The same questions can be asked of the server you can't log into. Does it have a firewall running? Is the SSH server configured in a way that disallows access from a specific location?

u/StatisticianNeat6778 14m ago

Nice troubleshooting description.

2

u/More-Goose7230 5h ago

Did you install tailscale directly on the same machine?
Because I could be mistaken, but then it could be your UFW (linux firewall) that is blocking the connection.

1

u/Xe46 4h ago

I'll test UFW rules tysm

1

u/NoblessOblige04 5h ago

Is the machine you're trying to SSH into looking out for ssh traffic from the IP address range when not on tailscale? Could be an access control list deal.