I am using VirtualBox Version 6.1.26 r145957 (Qt5.6.2)
I have a use case where I need my VMs to communicate to each other, and I want to connect to them from my Windows host. So I created a Nat Network and assigned it to my 2 VMs (Ubuntu and Debian), I can ssh between them so everything is working. In both VMs I set up a static IPv4 address.
I have created some 2 port forwarding rules to be able to connect to them via ssh:
Code: Select all
>vboxmanage list natnets
NetworkName: natnet1
IP: 10.0.2.1
Network: 10.0.2.0/24
IPv6 Enabled: No
IPv6 Prefix: fd17:625c:f037:2::/64
DHCP Enabled: Yes
Enabled: Yes
Port-forwarding (ipv4)
ssh debian:tcp:[10.0.2.5]:2222:[10.0.2.5]:22
ssh ubuntu:tcp:[10.0.2.4]:2222:[10.0.2.4]:22
loopback mappings (ipv4)
127.0.0.1=2
Code: Select all
>ipconfig
Configuration IP de Windows
....
Carte Ethernet VirtualBox Host-Only Network :
Suffixe DNS propre à la connexion. . . :
Adresse IPv6 de liaison locale. . . . .: fe80::1fd:5739:1c69:1fc6%12
Adresse IPv4. . . . . . . . . . . . . .: 192.168.190.1
Masque de sous-réseau. . . . . . . . . : 255.255.255.0
Passerelle par défaut. . . . . . . . . :
....
If I change the port forwarding rule to bind the host on 127.0.0.1, then I can connect to the guest from the host.
Moreover, I cannot start/stop the nat network from the command line:
Code: Select all
>vboxmanage natnetwork start --netname natnet1
VBoxManage.exe: error: Cannot start DHCP server because it is already running (pid 000024c4)
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component DHCPServerWrap, interface IDHCPServer, callee IUnknown
VBoxManage.exe: error: Context: "Start()" at line 482 of file VBoxManageNATNetwork.cpp
VBoxManage.exe: error: Failed to start network
>vboxmanage natnetwork stop --netname natnet1
>vboxmanage natnetwork start --netname natnet1
VBoxManage.exe: error: Cannot start DHCP server because it is already running (pid 000024c4)
VBoxManage.exe: error: Details: code VBOX_E_OBJECT_IN_USE (0x80bb000c), component DHCPServerWrap, interface IDHCPServer, callee IUnknown
VBoxManage.exe: error: Context: "Start()" at line 482 of file VBoxManageNATNetwork.cpp
VBoxManage.exe: error: Failed to start network
I already did this configuration in the past and it always worked! What am I doing wrong? Thank you in advance!