I'm having an odd LAN connection problem that i can't seem to track down. First the setup, somewhat simplified: Two computers, both connected through wifi to a router, which in turn is connected to the outside internet (IP address supplied by ISP, let's say 64.x.y.z, and an internal address of 192.168.0.1). One of the computers, running Ubuntu 18.04 (computerA, 192.168.0.100) is running an sshd server that i would like to connect to from the other (computerB, 192.168.0.103). This computer could be a phone, a Windows laptop... The wireless router has incoming connections on port 22 from outside forwarded to computerA, the Ubuntu sshd server.
I cannot seem to ssh directly from computerB to computerA. I simply get a message:
Connecting to 192.168.0.100 port 22
And nothing happens. Interestingly, netstat running on computerA shows a connection is attempted:
tcp 0 0 192.168.0.100:22 192.168.0.103:58652 SYN_RECV
That just eventually times out, though.
On the other hand, if i ssh to the router's external IP address, 64.x.y.z from computerB, the connection is forwarded to computerA (as it should be) and the ssh session is immediately established.
Some additional information in case it's relevant: I can't ping the Ubuntu server from computerB, but traceroute does work:
# traceroute 192.168.0.100 traceroute to 192.168.0.100 (192.168.0.100), 30 hops max, 46 byte packets 1 192.168.0.100 (192.168.0.100) 14.309 ms 3.068 ms 2.777 ms
From the Ubuntu server i CAN ping computerB, and traceroute similarly shows 1 hop. Physically, the route should pass through the wifi router, but its address (192.168.0.1) doesn't show up. So i don't think the issue is with the router (I could be wrong... computerB is using the 5GHz link, computerA the 2.4GHz link. Though, when computerB was the Windows laptop, that was also on 2.4GHz).
Iptables on the Ubuntu server is completely empty.
Very, very rarely the ssh connection from computerB to computerA is established. I can't reproduce when this happens, though.
I suspect something on the Ubuntu server is (mis)configured to reject connections coming from the local 192.168.0.0/24 network. I'm at a loss how to further diagnose this problem... Any suggestions would be greatly appreciated!
lsof -i shows that sshd is indeed listening:
sshd 1316 root 3u IPv4 58798457 0t0 TCP *:ssh (LISTEN) sshd 1316 root 4u IPv6 58798461 0t0 TCP *:ssh (LISTEN)
Not sure what else i should be looking for... As i mentioned, connections from outside of my LAN work without an issue.
No firewall at all:
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination