我有 ec2 实例。此 ec2 实例中有 3 个嵌套的 Ubuntu 在其中运行。为了连接到这个实例,我必须连接到 ec2 实例,然后通过 ssh 进入嵌套的 ubuntu 机器。
有没有一种方法可以让我直接从本地主机电脑 ssh 或连接到这台嵌套计算机。
最佳答案
假设您的机器 A 具有 IP A_ip 和用户 A_user,机器 B 具有 IP B_ip 且用户为 B_user,机器 C 具有 IP C_ip 和用户 C_user,则只需运行以下命令:-
ssh -J A_user@A_ip B_user@B_ip C_user@C_ip
来自man-ssh
-J [user@]host[:port]
Connect to the target host by first making a ssh connection to
the jump host and then establishing a TCP forwarding to the
ultimate destination from there. Multiple jump hops may be
specified separated by comma characters. This is a shortcut to
specify a ProxyJump configuration directive.
关于mysql - 如何使用 IP 直接从本地主机连接嵌套虚拟机?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57993290/