如何在VirtualBox上ping Ubuntu guest虚拟机 [英] How to ping ubuntu guest on VirtualBox

查看:109
本文介绍了如何在VirtualBox上ping Ubuntu guest虚拟机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有Ubuntu的VM(VirtualBox).主机是Windows 7. 如何从主机ping我的Ubuntu,反之亦然? 尝试在VM设置中设置桥接"连接类型,但没有效果,我只在Ubuntu中失去了互联网连接.

I have an VM (VirtualBox) with Ubuntu. Host machine is Windows 7. How can I ping my Ubuntu from host and vice versa? Trying to set "Bridged" connection type in VM settings but there is no effect, I only lose my internet connection in Ubuntu.

推荐答案

在大多数情况下,只需将虚拟机网络适配器切换为 bridged 模式就足以从外部访问来宾计算机.

In most cases simply switching the virtual machine network adapter to bridged mode is enough to make the guest machine accessible from outside.

有时,在切换到桥接模式后(甚至在重新启动客户机之后),客户机也可能不会自动收到与主机IP范围匹配的IP.这通常是由主机网络上的DHCP故障或配置错误造成的.

Sometimes it's possible for the guest machine to not automatically receive an IP which matches the host's IP range after switching to bridged mode (even after rebooting the guest machine). This is often caused by a malfunctioning or badly configured DHCP on the host network.

例如,如果主机IP为192.168.1.1,则访客计算机需要具有格式为192.168.1.*的IP,其中仅允许最后一组数字不同于主机IP.

For example, if the host IP is 192.168.1.1 the guest machine needs to have an IP in the format 192.168.1.* where only the last group of numbers is allowed to be different from the host IP.

您可以使用终端机(外壳)并键入ifconfig(对于Windows guest虚拟机,则为ipconfig)来检查为该客户机分配了哪些IP,并在需要时进行更改.

You can use a terminal (shell) and type ifconfig (ipconfig for Windows guests) to check what IP is assigned to the guest machine and change it if required.

如果主机和来宾IP不匹配,只需为来宾计算机设置静态IP即可解决此问题.

If the host and guest IPs do not match simply setting a static IP for the guest machine explicitly should resolve the issue.

这篇关于如何在VirtualBox上ping Ubuntu guest虚拟机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆