0

I am using the same ova image on both my local machine and another headless server, which is virtualized on some vsphere esxi server.
When running the VM on my local machine, I can access the SSH server of the guest via NAT (localhost:2222) as well as via host-only-network (192.168.56.111:22).
When running the guest on the headless server, I cannot ping the machine using the host-only-network. When I try to use the NAT, the port 2222 is open on the headless server, but the ssh connection times out as nothing is returned.

vboxmanage showvminfo shows the following for the network settings of the guest (same output on local machine and headless server):

NIC 1:           MAC: 080027788420, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings:  MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC 1 Rule(0):   name = Rule 1, protocol = tcp, host ip = , host port = 2222, guest ip = , guest port = 22
NIC 2:           MAC: 080027FBC41B, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none

vboxmanage list hostonlyifs shows this, with the same values for my local machine and headless server:

Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
DHCP:            Disabled
IPAddress:       192.168.56.1
NetworkMask:     255.255.255.0
IPV6Address:     fe80::800:27ff:fe00:0
IPV6NetworkMaskPrefixLength: 64
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Wireless:        No
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet0

vboxmanage list natnets shows this, with the same values for my local machine and headless server:

NetworkName:    NatNetwork
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
loopback mappings (ipv4)
    127.0.0.1=2

ifconfig on my local machine and on the headless server shows the vboxnet0 interface with the same values.

I am out of ideas why I cannot access the guest's SSH server on the headless server, help is very much appreciated.

0

In general, use NAT in VirtualBox for outgoing sessions only. In-coming sessions are troublesome. You can, however, create portforwarding rules, like this:

VBoxManage setextradata VMNameHere "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata VMNameHere "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata VMNameHere "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

The host-only network is, just as it says, host only. That means that it is available on the host, but not elsewhere. So you have two options:

  • use a bridged adapter instead of a host-only. Bridged adapters are available from the outside world.
  • Create a bridge (on Linux with bridge-utils) between

I would use a bridged adapter.

--EDIT--

The bridged adapter is just like putting the OVA on the network. If your network uses dhcp, you should see it in your dhcp-sever's log. Or possibly, you could use nmap to find the address.

Alternatively, use a second adapter as bridged adapter, ssh into the host and try to determine to which port the server listens with netstat -an

| improve this answer | |
  • I tried the port forwarding rules, but that didn't help. I also tried the bridged network, but I don't know how to access the guest as I don't know the IP address of the guest. – Benny Sep 30 '19 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.