简体   繁体   English

如何在不访问主机的情况下将 ssh 连接到 KVM 来宾 VM?

[英]How to ssh to a KVM guest VM without accessing the host?

I have set up a VM and the VM is accessible from the host through the SSH also.我已经设置了一个 VM,并且还可以通过 SSH 从主机访问该 VM。

The host has a public IP and accessible through SSH.主机有一个公共 IP,可通过 SSH 访问。 the guest VM can access the internet like pinging to google is working with the bridge connectivity.来宾虚拟机可以访问互联网,就像 ping 到谷歌正在使用网桥连接。

For example: the host IP is ( xxx.xxx.xxx.xxx) The vm IP is ( 192.168.yyy.yyy)例如:主机 IP 是(xxx.xxx.xxx.xxx) vm IP 是(192.168.yyy.yyy)

Is it possible to SSH the VM without accessing the host from a different network?是否可以在不从其他网络访问主机的情况下对 VM 进行 SSH ?

As explained here , you find out an IP address of Linux KVM guest from Linux host itself正如这里所解释的,您可以从 Linux 主机本身找到 Linux KVM 来宾的 IP 地址

$ virsh list
$ virsh domifaddr rhel7

But that does require access to the host.但这确实需要访问主机。

You would need to configure libvirt, which comes with its own in-build DNS server, dnsmasq , as explained in " Automated DNS resolution for KVM/libvirt guests with a local domain " from Roland Wolters in order to reference the guest VM directly, through a FQDN, instead of an internal IP address you cannot have without host access.您需要配置 libvirt,它带有自己的内置 DNS 服务器dnsmasq ,如Roland Wolters的“ 具有本地域的 KVM/libvirt 来宾的自动 DNS 解析”中所述,以便直接引用来宾 VM,通过一个 FQDN,而不是内部 IP 地址,如果没有主机访问权限,您将无法拥有。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 vagrant:在主机和来宾之间共享ssh文件夹 - vagrant: Share ssh folder between host and guest 无法在群集中不同主机上的来宾VM之间进行SSH SSH - Unable to SSH between guest VM's which are on different hosts in cluster "如何在vm中连接ssh" - how to connect ssh in vm 如何在不使用临时外部 IP 的情况下使用 GCP VM 使用 Pycharm SSH? - How to SSH with Pycharm a GCP VM without using the ephemeral external IP? 我如何使用 Azure 堡垒主机而不是 Azure 门户 web 登录到 VM? - How can i login to VM using Azure Bastion Host Other than Azure portal web based SSH? 如何获得使用PowerShell创建的新Azure Linux VM的ssh主机密钥? - How can I get the ssh host key for a new Azure Linux VM created using PowerShell? 如何将 vagrant ssh 发送到不同的 guest prot - How to vagrant ssh to different guest prort 如何使用Java SSH到没有密码的主机上 - how to ssh onto a host without password using java Ansible - 如何在没有“主机真实性”提示的情况下进入实例? - Ansible - How to ssh into an instance without the 'authenticity of host' prompt? 如何使用最少的配置/基础设施通过 ssh 连接到 KVM? - How do I ssh into a KVM with minimal configuration/infrastructure?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM