SSH-ing into virtual machine (not installed, just live-system)

I use KVM a lot, but I never set it up myself and I also don’t know how to configure it. I’m just the “consumer” of KVM.

Therefore, I will talk from a VirtualBox perspective, and pretend the same knowledge applies here.

  1. Maybe you need to open ports through the virtual machine’s configuration. E.g. in this case you would open inbound TCP 22.
  2. Ping is overrated in the network world. Everyone says, just ping this, just ping that. But I say: no, don’t just ping. Make an actual TCP or UDP connection.
sudo apt install -y ncat
nc -vz 10.0.2.15 22

This way you can check, if the address is reachable through the TCP port 22 on the target.
Pings actually do not mean much. It’s quick and dirty, but not as reliable, as most people think. You can’t imagine how many people I have seen in my entire life, wasting hours of their precious time, trying to debug a connectivity issue by using Ping, just to find out, that Ping was telling them results, which were not correctly interpreted in the context of the situation. For example, it’s not uncommon for a server to block Ping packets, but let through other types of packets. So, if you try to debug connectivity issues with Ping, it may seem like you cannot connect to the host, even if the host is just blocking all the Ping packets, not other types of packets.

  1. Check if SSH is properly running on the live medium.
ss -tlp '( dport = :22 or sport = :22 )'
1 Like