Virtual Box NAT Port Forwarding does not work on a specific machine
Posted: 2. Dec 2021, 15:07
I have configured the following NAT network in VirtualBox 6.1.26 r145957 (Windows 10 - 64 bit):
My virtual machine uses this NAT network so I can connect per SSH to the guest.
I'm using NAT, because it is the only way for me to connect to the VM while I'm connected to my company's network through VPN.
This solution worked for a couple of months but now I'm getting the message: "Network error - Connection refused" when connecting to 127.0.0.1:2211 with putty or from the console using the "ssh" command.
I have made no change in the Virtual Box & VM configuration and unfortunately I don't know what else could have changed, so I tried the following things to understand/fix the problem:
- Executed "netstat -na -p tcp" on the command line -> Result: There is no listening socket for 127.0.0.1:2211 - so port forwarding seems not to work
- Changed hostip in VirtualBox port forwarding settings to 0.0.0.0 -> Doesn't work
- Asked a colleague to log in with his windows domain user account on my machine and try to connect -> Doesn't work
- Temporarily deactivated the firewall -> Doesn't work
- Tried to run the same VM + Configuration on a colleague's machine -> Port forwarding & SSH connection works fine (!)
- Used qemu on my machine with same port forwarding settings and image -> Port forwarding & SSH connection works fine (!)
- Finally I reinstalled my whole system, but the SSH connection still cannot be established
VBoxSVC.log (replaced company-specific IPs/domains by ...):
Important: Even though VBoxNetNAT.exe seems to be executed there is no MY_NAT.log created. On the other machines it is there and shows that the ports are successfully forwarded.
Any idea what could be the problem or how I can debug it?
Code: Select all
<NATNetwork networkName="MY_NAT" network="192.168.111.0/24" ipv6="0" ipv6prefix="fd17:625c:f037:2::/64" advertiseDefaultIPv6Route="0" needDhcp="1" enabled="1">
<PortForwarding4>
<Forwarding name="SSH" proto="1" hostip="127.0.0.1" hostport="2211" guestip="192.168.115.20" guestport="22"/>
</PortForwarding4>
<Mappings>
<Loopback4 address="127.0.0.1" offset="2"/>
</Mappings>
</NATNetwork>
I'm using NAT, because it is the only way for me to connect to the VM while I'm connected to my company's network through VPN.
This solution worked for a couple of months but now I'm getting the message: "Network error - Connection refused" when connecting to 127.0.0.1:2211 with putty or from the console using the "ssh" command.
I have made no change in the Virtual Box & VM configuration and unfortunately I don't know what else could have changed, so I tried the following things to understand/fix the problem:
- Executed "netstat -na -p tcp" on the command line -> Result: There is no listening socket for 127.0.0.1:2211 - so port forwarding seems not to work
- Changed hostip in VirtualBox port forwarding settings to 0.0.0.0 -> Doesn't work
- Asked a colleague to log in with his windows domain user account on my machine and try to connect -> Doesn't work
- Temporarily deactivated the firewall -> Doesn't work
- Tried to run the same VM + Configuration on a colleague's machine -> Port forwarding & SSH connection works fine (!)
- Used qemu on my machine with same port forwarding settings and image -> Port forwarding & SSH connection works fine (!)
- Finally I reinstalled my whole system, but the SSH connection still cannot be established
VBoxSVC.log (replaced company-specific IPs/domains by ...):
Code: Select all
01:55:19.258515 Launched VM: 77255088 pid: 16872 (0x41e8) frontend: GUI/Qt name: MY_VM
01:55:24.962176 Load [C:\Program Files (x86)\Sun xVM VirtualBox\ExtensionPacks\Oracle_VM_VirtualBox_Extension_Pack\win.amd64\VBoxHostWebcam.DLL] vrc=VINF_SUCCESS
01:55:25.195888 ERROR [COM]: aRC=VBOX_E_IPRT_ERROR (0x80bb0005) aIID={85632c68-b5bb-4316-a900-5eb28d3413df} aComponent={SessionMachine} aText={Saved screenshot data is not available (VERR_NOT_SUPPORTED)}, preserve=false aResultDetail=-37
01:55:25.584780 VM 'MY_VM' starts using NAT network 'MY_NAT'
01:55:25.584825 HostDnsMonitorProxy::GetDomainName: ...
01:55:25.585052 Saving settings file "C:\DATEN\Virtualbox\VirtualBox.xml" with version "1.14-windows"
01:55:25.592135 HostDnsMonitorProxy::GetNameServers:
01:55:25.592153 name server 1: ...
01:55:25.592161 name server 2: ...
01:55:25.592169 name server 3: ...
01:55:25.592399 Saving settings file "C:\DATEN\Virtualbox\VirtualBox.xml" with version "1.14-windows"
01:55:25.596664 Saving settings file "C:\DATEN\Virtualbox\VirtualBox.xml" with version "1.14-windows"
01:55:25.607645 NetworkServiceRunning: started 'VBoxNetDHCP.exe', pid 00004b20
01:55:25.614115 NetworkServiceRunning: started 'VBoxNetNAT.exe', pid 00002fcc
01:55:25.614167 Started NAT network 'MY_NAT'
Any idea what could be the problem or how I can debug it?