mysql - 如何使用 IP 直接从本地主机连接嵌套虚拟机?

标签 mysql amazon-web-services amazon-ec2 virtual-machine virtualization

我有 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/

相关文章:

mySQL "Too many connections"错误受杂种实例数的影响?

php - 更改日期格式

amazon-web-services - Terraform 和 AWS : modify an existing policy

amazon-web-services - AWS IAM 用户无法查看账单和成本管理仪表板

amazon-web-services - 'aws ec2 import-image' 示例

php - Laravel - 根据 Laravel 中相似的 id 对记录进行分组

php - mysql。如何在没有 COALESCE 的情况下用结果集中的某些预定义值替换 NULL

amazon-web-services - CannotStartContainerError : API error (400): OCI runtime create failed: container_linux. go:348: 启动容器进程导致

javascript - web.js 和 npm express - 警告 : express. createServer() 已弃用

Java AWS SDK - 如何使用 Java API 中的 IAM 配置文件上传文件