[SOLVED] ssh, ping and "no route to host" message in network

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
nonkel
Level 1
Level 1
Posts: 19
Joined: Sat Sep 17, 2016 9:11 am

[SOLVED] ssh, ping and "no route to host" message in network

Post by nonkel »

I have this configuration:
Router connected wireless with:
A PC windows 10
B PC windows 10 and Linux Mint 18.2 cinnamon Sonya
C PC Linux Mint 18.2 cinnamon Sonya

All internet connections work fine.
I want to communicate between B (Linux part) and C using SSH. Openssh-server is installed on both machines.
When I ping B to C, or C to B I get "unreachable " as message.
When I try a SSH connection I get "no route to host"

When I cable the network, I can ping in both directions, but ssh results in "no route to host".

So I guess I have both a wireless network issue and a SSH issue.
All this makes me :( and :?
So please help :!:
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: ssh, ping and "no route to host" message in network

Post by rene »

Particularly this bit:
nonkel wrote:When I cable the network, I can ping in both directions, but ssh results in "no route to host"
would appear to be impossible unless you specify the host to ping/to connect to differently. F.e., specifying by IP address for ping and by hostname for ssh. Both this and the wireless part could then be sort of explained by additionally you having added these hosts to /etc/hosts with [edit] wrong IP addresses. Also make very sure the wireless network is not an isolated guest-type of network.[/edit] Please specify in full detail the commands and their outputs: copy/paste them (in between code-tags).
nonkel
Level 1
Level 1
Posts: 19
Joined: Sat Sep 17, 2016 9:11 am

Re: ssh, ping and "no route to host" message in network

Post by nonkel »

@rene
commands I used in cabled network (I'm not particularly interested in the cabled network, since computers are standing reasonably far apart, but Okay, for arguments sake...):
<ping 192.168.x.xx>
<ssh username@192.168.x.xx>
Both IP's are identical.

This host is not added in /etc/hosts
I don't see a file called /edit
The wireless network is not a guest network, it is provided by my Internet-provider.

I think I forgot to mention: the router is also the modem.
BrianD

Re: ssh, ping and "no route to host" message in network

Post by BrianD »

I have my computers set up in a similar manner, some wired Ethernet and some wireless. On all of the machines, regardless of wired/wireless, I do the following:

1. "reserve" a specific IP address (192.168.1.101, 192.168.1.102, etc.) for each machine in the router/dhcp according to MAC address of the network card.
2. add a line to /etc/hosts on all computers on my network for each computer

With this configuration, I've never had any problems connecting between any computers on my local LAN, using ping, tracert, SSH, SCP, Samba, etc.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: ssh, ping and "no route to host" message in network

Post by rene »

The bit between "edit" tags was me editing out a brain-inversion in my original reply; never mind.
<ping 192.168.x.xx>
<ssh username@192.168.x.xx>
Both IP's are identical.
Assuming that indeed the above ping works and the above ssh does not with the "no route to host" message as reported, basically the only thing I can come up with is ...
I think I forgot to mention: the router is also the modem.
... the modem/router dropping port 22 traffic as part of its default firewall setup. I believe you'll need to first of all check there. I am of course assuming you have not setup a personal firewall on either originator or target.
nonkel
Level 1
Level 1
Posts: 19
Joined: Sat Sep 17, 2016 9:11 am

Re: ssh, ping and "no route to host" message in network

Post by nonkel »

Ok, we're getting somewhere :) .
I managed to open port 22 on the router/modem. Result: pinging works over the wireless network!
But... (there's always one): ssh connection returns this message: <ssh: connect to host 192.168.x.xx port 22: Connection timed out>
I use very common firewall settings: Incoming: Deny, Outgoing: Allow
User avatar
greerd
Level 6
Level 6
Posts: 1060
Joined: Sat Jul 31, 2010 10:58 am
Location: Nova Scotia, Canada

Re: ssh, ping and "no route to host" message in network

Post by greerd »

Sorry to but in here but I think you will have to create a firewall rule on both PCs, allowing port 22 incoming. You could temporarily disable the firewalls just to check.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: ssh, ping and "no route to host" message in network

Post by rene »

nonkel wrote:I managed to open port 22 on the router/modem. Result: pinging works over the wireless network!
Ping doesn't need port 22; that's only ssh.

I'll forego commenting on local firewall setups. A firewall is a ridiculous thing. It's you opening the doors and windows on your house, going "well, that doesn't look very secure now does it?!" and then bricklaying a sturdy wall around your entire house. The only excuse for a firewall is closed software --- Windows as well as programs/games running under it --- making it less than easy or even impossible to close or find those open doors and windows but over here in Linux, a firewall is just plain ridiculous.

Please note that whoever disagrees with me at this point has at that same time volunteered to guide you through any local firewall-related issues you seem to have left. Good luck :)
nonkel
Level 1
Level 1
Posts: 19
Joined: Sat Sep 17, 2016 9:11 am

Re: ssh, ping and "no route to host" message in network

Post by nonkel »

Ping doesn't need port 22; that's only ssh.
That is quite right, it was the reboot of the router/modem that restored the ping-function.
Opening port 22 on the router/modem was not necessary for SSH, what is necessary is:
or: disable the server's(=target) firewall, client's(=me) firewall is left unchanged
or: add rule to firewall to allow port 22 and add client's and server's IP, so only SSH is possible between these 2 PC's

Thank you all very much for each of your contributions and time :)
Locked

Return to “Networking”