networking - VirtualBox端口转发不适用于NAT适配器

标签 networking port virtualbox forwarding nat

我正在尝试使用VirtualBox进行简单的端口转发,但似乎VirtualBox.exe在主机上侦听该端口,但实际上并未将连接转发给 guest 。我尝试了多个端口,并多次重启了VirtualBox。另一方面, guest 与主机之间的连接很好。这是信息:

Host: Win7 x64
Guest: Win7 x64
VirtualBox version: VirtualBox 4.2.10
Firewalls: All firewalls on host and guest disabled.

Virtual Box > Machine Settings > Network
 Adapter 1: 
  Attached to: NAT
  Cable Connected : True
  Port Forwarding:
   Rule 1: TCP, HostIP=127.0.0.1, HostPort=8081, GuestIP=127.0.0.1, GuestPort=8081

On Host:
[VirtualBox.exe]  TCP    127.0.0.1:8081         IBM-6KT5OPCF76P:0      LISTENING

On Guest:
I never get the connection request on port 8081 or any others I've tried.

有任何想法吗?由于多种原因,我想避免使用VirtualBox的桥接适配器。我的印象是,使用VirtualBox,NAT端口转发相对简单。

谢谢!

最佳答案

您以错误的方式指出了 guest ip,它应该是 guest 的ip(如果您为 guest 静态分配了ip地址)或将其留空。请注意,您将主机ip指向127.0.0.1,这意味着您只能从端口访问要转发的端口(如果不是您想要的端口,则也应该为空)。

VBoxManage modifyvm "win" --natpf1 ",tcp,,8081,,8081"

也许这是您想要做的。 (请look here for more details)

关于networking - VirtualBox端口转发不适用于NAT适配器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15580525/

相关文章:

c# - 如何实现与 WNetAddConnection2 相同的超时?

networking - 如何从外部访问内部?

apache 端口 80 非 root

windows - Vagrant Windows - ssh_exchange_identification : read: Connection reset by peer

德尔福XE2 : Invisible Firemonkey controls in VirtualBox

.net - 捕获 VPN 使用统计信息

转换从 TUN 接口(interface)接收的原始数据包数据

java - 告诉 ThreadPoolExecutor 何时应该继续或不继续

python - Amazon EC2 上的 Flask 应用程序

Virtualbox 将 vhd 类型从不可变更改为正常