访问virtualbox虚拟机中架设的网站

翻译比较累,直接贴上原文:

6.3.1. Configuring port forwarding with NAT
As the virtual machine is connected to a private network internal to VirtualBox and invisible to the host, network services on the guest are not accessible to the host machine or to other computers on the same network. However, VirtualBox can make selected services available outside of the guest by using port forwarding. This means that VirtualBox listens to certain ports on the host and resends all packets which arrive on them to the guest on the ports used by the services being forwarded.

To an application on the host or other physical (or virtual) machines on the network, it looks as though the service being proxied is actually running on the host (note that this also means that you cannot run the same service on the same ports on the host). However, you still gain the advantages of running the service in a virtual machine -- for example, services on the host machine or on other virtual machines cannot be compromised or crashed by a vulnerability or a bug in the service, and the service can run in a different operating system than the host system.

You can set up a guest service which you wish to proxy using the command line tool VBoxManage. You will need to know which ports on the guest the service uses and to decide which ports to use on the host (often but not always you will want to use the same ports on the guest and on the host). You can use any ports on the host which are not already in use by a service. An example of how to set up incoming NAT connections to an ssh server on the guest requires the following three commands:

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22

VBoxManage setextradata "Linux Guest"

"VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

The above example assumes a PCNet virtual network card; if you have configured the guest to use the Intel PRO/1000, replace "pcnet" with "e1000" in the above commands. Similarly, if you want to configure a different interface instance replace the /0/ with the appropriate index. pcnet and e1000 are counted separately in this respect, and counting starts at 0 for both types.

The name guestssh is an arbitrary one chosen for this particular forwarding configuration. With that configuration in place, all TCP connections to port 2222 on the host will be forwarded to port 22 on the guest. Protocol can be either of TCP or UDP (these are case insensitive). To remove a mapping again, use the same commands, but leaving out the values (in this case TCP, 22 and 2222).

It is not possible to configure incoming NAT connections while the VM is running. However you can change the settings for a VM which is currently saved (or powered off at a snapshot).
超级详细的 VirtualBox 虚拟机安装 及入门教程 `虚拟机(Virtual Machine)`指通过软件模拟的具有完整硬件系统功能的、运行在一个完全隔离环境中的完整计算机系统。在实体计算机中能够完成的工作在虚拟机中都能够实现。 阅读详情

相关推荐

Oracle VM VirtualBox虚拟机安装配置

1. 首先,需要从Oracle官方网站下载VirtualBox的最新版本。 2. 下载完成后,双击安装包开始安装。按照安装向导的提示,同意许可协议,并选择安装位置。 3. 在安装过程中,可以根据需要选择是否创建快捷方式、是否安装USB支持等附加功能。 4. 完成安装后,打开VirtualBox,你会看到一个空白的虚拟机列表。

不积跬步无以至千里,不积小流无以成江海。一个喜欢学习分享的程序员 7787

设置端口转发来访问Virtualboxlinux中的网站

访问Virtualbox里面NAT模式下linux中的网站

明月天涯 7753

virtualbox虚拟机安装以及简单配置

安装虚拟机及简单配置

qq_45839537的博客 6285

Linux虚拟机实现上网以及本地电脑访问虚拟机主页

全网最详解,图文并茂,欢迎参考!!!

m0_48333563的博客 1020

virtualBox安装centos7设置静态路由并且实现局域网任意主机访问本机虚拟机

说明: 最近需要搭一个测试Hadoop的服务器于是记录一下过程,采用的是virtualBox + centos7。 virtualBox网上直接可以下载, centos7:http://ftp.yz.yamagata-u.ac.jp/pub/linux/centos-altarch/7.9.2009/isos/i386/CentOS-7-i386-Minimal-2009.iso ...

java技术分享 1457

Win10宿主机访问virtualbox虚拟机centos7的web(通过域名访问

Win10宿主机访问virtualbox虚拟机centos7的web(通过域名访问) 首先要确保主机和虚拟机能够互ping。我使用的是桥接模式。 把虚拟机的网络设置为桥接模式 接着进入centos设置网卡。 先通过ifconfig查看自己的ip: 再去查看windows的ip。通过cmd打开终端输入ipconfig/all 再回到centos修改网卡配置vim /etc/sysconfig/network-scripts/ifcfg-enp0s3 圈出来的都是要修改或者添加的必要项。子网掩码和

zhuzi的博客 1697

连线到 VirtualBox 中的网站 ( Port Forwarding )

架设VirtualBox 中的网站,透过 「连接埠转送」( Port Forwarding ),透过转送的方式把网页传送出来。

JuzerTech的博客 608

VirtualBox虚拟机安装教程

VirtualBox:开源免费的软件

Zhichao_Zhang的博客 9万+

银河麒麟V10虚拟机里用virtualbox安装虚拟机

源于一时兴起的瞎折腾,好奇Linux有哪些虚拟机管理工具,通过查找最终确定了使用virtualbox

m0_45037578的博客 1万+

VirtualBox虚拟机安装 Linux 系统

版本更新:RHEL 和 Oracle Linux 有明确的版本号和发布周期,而 CentOS 的发布可能会有所延迟,因为它是基于RHEL源代码进行重新编译的。首先,打开 VirtualBox 虚拟机,点击新建,创建一个新的虚拟主机,填写相关信息,这里我们选择安装红帽(Redhat 64)系统,因为生产环境最常用。Oracle Linux 是在RHEL的基础上进行修改和优化的,同时它也是一个商业产品,并且提供了与 RHEL 相似的服务和支持。随后,按照 Linux 安装程序的指示完成安装过程。

lsdb 7610

VirtualBox上配置网站服务器

一、使用Net网络进行配置 1.1配置VirtualBox Net网络并安装centos7 打开VirtualBox,点击:管理-全局配置-网络-新建网卡,然后对Net网络进行配置,设置网络CIDR和端口转发如图所示: ...

菜鸟技术人员的叨逼叨 1171

LinuxVirtualBox 搭建 Ubuntu 虚拟机教程

本文详细介绍了使用VirtualBox搭建Ubuntu虚拟机的完整流程。首先概述了VirtualBox和Ubuntu的特点及优势,然后详细讲解了准备工作,包括下载Ubuntu ISO镜像和安装VirtualBox的步骤。接着重点演示了在VirtualBox中创建Ubuntu虚拟机的过程,涵盖虚拟机基本信息配置、内存分配、虚拟硬盘创建等关键环节。最后指导用户完成虚拟机创建并准备系统安装。整个教程图文并茂,步骤清晰,适合不同水平的用户参考使用,帮助读者快速搭建Linux开发测试环境。

千淘万漉虽辛苦,吹尽狂沙始到金 2万+

Mac安装 VirtualBox虚拟机

如果在安装过程中遇到"系统扩展被阻止"的问题,需要进入"系统偏好设置",在"安全性与隐私"->“一般”->“允许来自Oracle的软件”,然后点击"允许"。注意:如果你的Mac版本为新的M1或者M1 Pro、M1 Max芯片,现在有可能遇到兼容性问题,你可能需要寻找其他的虚拟机软件替代VirtualBox。安装完成后,从启动台或应用程序文件夹打开VirtualBox,如果能够正常打开,那么恭喜你,VirtualBox已经成功安装到你的Mac电脑上。,然后在下载页面选择对应的Mac版本下载。

weixin_43891869的博客 1万+

【运维心得】VirtualBox宿主机访问虚拟机web服务

本文主要解决了在virtualbox环境下,当虚拟机发布网站以后,如何用最简单的NAT方式通过宿主机直接访问虚拟机的web服务

目标范式 3342

[ZZ]VBOX穿过主机访问虚拟机中的网站

<br /> 原文链接:http://ce.sysu.edu.cn/hope/Education/ShowArticle.asp?ArticleID=7556<br />最近大家开始搭上我们这个学期的关键——Siteweaver,为了这个东西大家无所不用其极,有人换系统,有人开始学习用虚拟机。用虚拟机的同学会发现,我们在使用虚拟机搭建网站的时候,怎么可以方便地从主机和局域网访问虚拟机中的网站呢?下面就跟着我一起穿越吧,让穿过我们的主机访问虚拟机里面的网站。<br />  虽然说VBox的网络功能支持没有

砚的专栏 2687

VirtualBox虚拟机安装Centos7详细教程图解

VirtualBox虚拟机安装Centos7详细教程图解

weixin_40547993的博客 2万+

VirtualBox 安装 Ubuntu 虚拟机

Vmware 性能更好,可以提供更好的资源管理和虚拟化性能,尤其是在多核和多任务的环境中。Ubuntu (Safe graphics) 如果你显卡兼容性不好,图形界面无法正常启动,可以用这个。而我们本身就装在虚拟机里,默认就行)勾选增强功能,在安装 VirtualBox 的文件夹内找到图示名字的增强功能光盘(如果没有,可以看前文)。跳过自动安装(自动安装是英文,需要手动改中文。Ubuntu 桌面版的最新LTS(Long Term Support,长期支持)版本,

weixin_46044549的博客 2769

virtualBox虚拟机安装多个+主机访问虚拟机+虚拟机访问外网配置

host-only配置好之后我们测试一下,点击一下切换成test为on的模式,在我们主机上ping一下我们虚拟机的ip地址。Adress的范围参考,工具-网络管理器中host-only的网卡配置,在这个网卡配置的网段内即可。点击存储——没有盘片——再点击右上角的 类似光盘的小图标,再点击 “选择虚拟光盘”,将之前下载的。如 果之前已经在上面的网络步骤配置过,这里就会出现之前配置过的选项。选择虚拟硬盘大小,我这里设置的是30G,点击完成虚拟机的新建。验证虚拟机的上网功能,以及再次验证主机连接虚拟机功能。

u012558695的博客 1887

VirtualBox虚拟机与主机互传文件的五种方法

挂载完成后,只需要访问Linux本地的/mnt文件夹,就相当于在访问主机上的D:\目录。

m0_60352504的博客 6万+
上一篇: Javascript对象继承
下一篇: Ubuntu下VNC配置
pythoner
博客等级 码龄18年 15粉丝 89原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值