3

I installed ubuntu server on a virtual machine (virtual box), and set up ssh. I made sure that everything worked and I disabled all firewalls, but when I try to connect via ssh from Microsoft's windows it says “connection timed out”. I thought maybe the server is not accessible, so when I tried to ping the server, it also said timed out. Does anyone know how to resolve this?

5
  • 1
    What sort of virtual machine? Is the hypervisor running on the same windows machine you are trying to ssh/ping from? How is the networking configured?
    – jesse_b
    Apr 13, 2019 at 15:40
  • @Jesse_b the virtual machine is virtual box, and the hypervisor is running on the same windows machine and what do you specifically want to know about the network configuration? Apr 13, 2019 at 15:43
  • 1
    Everything you can tell me. From what you are describing it seems your VM network is either not configured or not configured properly.
    – jesse_b
    Apr 13, 2019 at 15:44
  • In the network configuration of virtual box, what are the settings? Apr 13, 2019 at 15:46
  • @ctrl-alt-delor in the network tab it says that it is attached to NAT, promiscuous mode is on Deny. I dont believe you need to know the adapter type or MAC address, if you do then just tell me Apr 13, 2019 at 15:49

1 Answer 1

2

NAT mode in virtualbox typically doesn't support initiating connections to the guest machine (or at least not easily). You may want to switch it into bridged mode.

NAT Mode:

When the guest OS boots, it typically uses DHCP to get an IP address. VirtualBox will field this DHCP request and tell the guest OS its assigned IP address and the gateway address for routing outbound connections. In this mode, every vm is assigned the same IP address (10.0.2.15) because each vm thinks they are on their own isolated network. And when they send their traffic via the gateway (10.0.2.2) VirtualBox rewrites the packets to make them appear as though they originated from the Host, rather than the Guest (running inside the Host).

This means that the Guest will work even as the Host moves from network to network (e.g. laptop moving between locations), and from wireless to wired connections too.

However, how does another computer initiate a connection into a Guest? e.g. connecting to a web server running in the Guest. This is not (normally) possible using NAT mode as there is no route into the Guest OS. So for vm's running servers we need a different networking mode....

Bridged Mode:

Bridged Networking is used when you want your vm to be a full network citizen, i.e. to be an equal to your host machine on the network; in this mode, a virtual NIC is "bridged" to a physical NIC on your host.

The effect of this is that each VM has access to the physical network in the same way as your host. It can access any service on the network such as external DHCP services, name lookup services, and routing information just as the host does.

More information: Oracle VM VirtualBox: Networking options and how-to manage them


As ctrl-alt-delor suggests a "Host-only" network may also work for you. This would allow your host machine and virtual machine(s) to be able to communicate between each other but will not allow machines outside your host machine to be able to communicate into your VMs.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .