Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Virtualbox 如何在两个虚拟机箱主机之间通信_Virtualbox - Fatal编程技术网

Virtualbox 如何在两个虚拟机箱主机之间通信

Virtualbox 如何在两个虚拟机箱主机之间通信,virtualbox,Virtualbox,主机:windows 8.1 guest1(server1运行):ubuntu 14.04 guest2(服务器2运行):ubuntu 14.04 我所做的 eth0 Link encap:Ethernet HWaddr 08:00:27:09:e8:02 inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff

主机:windows 8.1

guest1(server1运行):ubuntu 14.04

guest2(服务器2运行):ubuntu 14.04

我所做的

eth0      Link encap:Ethernet  HWaddr 08:00:27:09:e8:02  
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe09:e802/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:330 errors:0 dropped:0 overruns:0 frame:0
          TX packets:168 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:52722 (51.4 KiB)  TX bytes:21827 (21.3 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:8a:dc:96  
          inet addr:10.0.2.4  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe8a:dc96/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:462 errors:0 dropped:0 overruns:0 frame:0
          TX packets:421 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:61578 (60.1 KiB)  TX bytes:38012 (37.1 KiB)
我在guest1中有一个转发端口8558,用于处理来自主主机的请求。它工作正常。现在我希望从guest1向guest2服务器发送请求,该服务器在端口5672上运行。为此,我在guest2中有一个转发端口5672

问题

当我连接到guest2时,它会失败。 我无法在guest2中获得请求


如何解决这个问题?

我使用两个Debian虚拟机,我可以从另一个虚拟机访问一个虚拟机,反之亦然。使用Ubuntu虚拟机应该不会有什么不同。以下是我的设置:

VirtualBox:5.0.24 r108355

主机:OS X 10.11.5

VM1:Debian Jessie

VM2:Debian Stretch

主机上的:

1) 创建NAT网络:

VirtualBox -> Preferences -> Network -> NAT Networks -> Add new NAT Network
2) 创建仅限主机的网络:

VirtualBox -> Preferences -> Network -> Host-only Networks -> Add host-only network
3) 在每个客户机上,添加一个Nat网络和一个连接到主机上创建的同一接口的纯主机适配器。选择半虚拟化网络(virtio net)作为适配器类型

在VM1中(Debian Jessie)

4) 这样修改
/etc/network/interfaces

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug enp0s3
iface enp0s3 inet dhcp

allow-hotplug enp0s8
iface enp0s8 inet dhcp
在VM2中(Debian Stretch)

5) 这样修改
/etc/network/interfaces

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug eth0
iface eth0 inet dhcp

allow-hotplug eth1
iface eth1 inet dhcp
source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

allow-hotplug enp0s3
iface enp0s3 inet dhcp

allow-hotplug enp0s8
iface enp0s8 inet dhcp
请注意,在Debian stretch中,网络交互命名方案已更改。接口名为
enp0s*
,不再是
eth*

在这一点之后,一切都应该可以运行。答案的其余部分仅供参考。

每个客人都有两个IP地址,一个用于主机通信,一个用于互联网访问

在VM1中(Debian Jessie)

在VM2中(Debian Stretch)


VM2中的原理相同。

我遇到的问题相同!!我正在从我的主机windows和虚拟机两个来宾操作系统发送HttpRequest!在第一个操作系统中,Webservices运行,第二个guest运行另一个服务器,但端口转发问题!!我的web服务器找不到另一台正在第二个来宾服务器中运行的服务器!!请给出一些想法!!如果你支持一个公司代理,别忘了。