The routes look fine. I'll assume that those IP addresses are private ones (LAN) and not public accessible.
Since you're connected in different ways to the network (wifi / wired), it's very likely that your router has separated wired / wireless networks. Try connecting both of them on a wired (or wireless) connection. Another possibility is that a firewall on the Ubuntu machines is blocking connections.
Otherwise, configure your router to use the same network (subnet) for wireless and wired connections. Also make sure that the router does not block client-to-client communication.
Your router is possibly dropping all unsolicited packets, that's why your friend gets a "connection timed out" message on your public IP address. Configure NAT port forwarding so that the public IP address + port combination forwards to your LAN address.
Example network:
YOUR NETWORK (A)
Router A (public address: 198.51.100.1)
Desktop A - 10.0.0.2
Laptop A - 10.0.0.3
YOUR FRIENDS NETWORK (B)
Router B (public address: 203.0.113.1)
Machine B - 192.168.0.2
On Router A, setup NAT forwarding:
To make your desktop accessible:
forward the public port 22 to 10.0.0.2
To make your laptop accessible:
forward the public port 2222 to 10.0.0.3
If you've a firewall (ufw
, iptables
, ...) on the machines set, allow incoming traffic to port 22 (Desktop A) and port 2222 (Laptop A).
The desktop can now be accessed using SSH with:
ssh user@198.51.100.1 -p 22
The laptop can now be accessed using SSH with:
ssh user@198.51.100.1 -p 2222
If you want to access your friends machine, apply these instructions to his machine + router.
This is likely a problem with how older versions of SSH handle host verification when ECDSA is used by default.
If you trust that the server and network have not been compromised, just add the host's RSA key to your known_hosts file:
ssh-keyscan ssh-server.example.com | tee -a ~/.ssh/known_hosts
Best Answer
"Host key verification failed" means that the host key of the remote host was changed.
SSH stores the host keys of the remote hosts in
~/.ssh/known_hosts
. You can either edit that text file manually and remove the old key (you can see the line number in the error message), or useFrom man page:
(which I learned from the answer to Is it possible to remove a particular host key from SSH's known_hosts file?).