2

If i do:

ssh 192.168.1.8 //my wlan0 connection

i get:

ssh: connect to host 192.168.1.8 port 22: Connection refused

However, if i plug the LAN, i can ssh to 192.168.1.7 (wired ip). And after that, i can ssh to 192.168.1.8 (wlan0 port) with no issues even after unplugging lan.

What can it be?

Drawing:

enter image description here

closed as off-topic by Jesse_b, Rui F Ribeiro, Kiwy, Anthony Geoghegan, Christopher Apr 23 '18 at 13:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Jesse_b, Rui F Ribeiro, Kiwy, Christopher
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Usually it helps if you set the option "devices can connect each other" in the wlan router. – ott-- Jun 21 '15 at 19:12
  • are the 2 interfaces bridged, as they are on the same subnet? – meuh Jun 21 '15 at 19:19
  • sshd started before wifi interface was up. – Rui F Ribeiro Apr 21 '18 at 19:40
2

This sounds like ssh isn't listening on all interfaces or is administratively blocked (iptables rule for example).

Start by making sure that sshd is listening on all interfaces. Go to the server you are trying to connect to and run:

sudo lsof -n -i -P | grep sshd

This is ls for open files. The flags are -n => don't bother looking up ip names (this makes lsof return faster), -i => list all Internet network files, and -P => don't bother looking up port names. Then we look only for the ssh daemon using grep.

You should get something like:

sshd       1472        root    3u  IPv4 4972775      0t0  TCP *:22 (LISTEN)
sshd       1472        root    4u  IPv6 4972777      0t0  TCP *:22 (LISTEN)

Here sshd is listening on TPC port 22 for all ip addresses (*:22).

Next check for iptables rules:

sudo iptables -L -n

This is list (-L) the rules and again don't look up names (-n).

One of these is most likely the problem.

  • 1. yes, i got 0t0 TCP *:22 (LISTEN). 2. I use UFW, and port 22 is allowed: 22/tcp ALLOW Anywhere – Gabriel A. Zorrilla Jun 21 '15 at 22:26
  • Try temporarily disabling UFW completely. Also, what does sshd log: (try sudo journalctl _COMM=sshd)? – user1794469 Jun 22 '15 at 2:08

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