SSH 从主机上的一个虚拟机连接到另一台主机上的另一台机器

SSH connect from one virtual machine on a host to another machine on another host

我有两台笔记本电脑连接到同一个 WIFI 网络。我在两者上都创建了 Ubuntu 个虚拟机。我想通过 SSH 将这两个虚拟机相互连接起来。我怎样才能做到这一点?谢谢

1。在虚拟机 A 上安装并启用 SSH 服务器:

sudo apt install openssh-server

2。验证 SSH 服务已在虚拟机 A 上启动:

sudo systemctl status ssh

3。现在从虚拟机 B 连接使用:

ssh user@ip