0

I am running on 20.04.1. I have a virtual machine installed using Oracle VirtualBox 6.12. The VM is also Ubuntu 20.04. The virtual machine networking type is bridged. When I try to access the virtual machine from Google Chrome or from Firefox on the host, I get a report of connection refused on the virtual machine, I can use ping on the VM to access both localhost and the IP address. nmap on the VM can acesss localhost successfully but not the IP address of the VM. Neither ping nor nmap can access localhost or the IP address of the VM when used from the host. Both machines are on the same subnet. I have tried with ufw both enabled and disabled on the VM. This has worked before for me using the same host but a different VM. In addition, I cannot use ssh on port 22 from the host to the VM with the same problem.

I tried making a new virtual machine which changed the problem slightly. In this case, I was still unable to connect to a web server on the VM through a browser on my host but I was able to ping the VM from the host. nmap on the host still stated that it thought that the VM was down.

Any ideas on how I can troubleshoot this?

1
  • I don't quite get "I am able to ping [...] the network address of the VM." and "I am unable to ping the VM from the host machine." Those seem contradictory as written, so please edit your question to clarify a bit, please.. – user535733 Sep 19 '20 at 2:18
0

I think you need to enable port-forwarding on the VM. (with the NAT type in the Attached to option)

In Virtualbox, choose the Settings of the context menu of the VM (or Machine -> Settings while the VM is running), go to Network, then expand the Advanced option and choose Port Forwarding. In the dialogbox that shows up, click the + sign to add a new TCP/IP rule (if not exists).

In both the Host Port and Guest Port fields, enter a port number (e.g. 8080), then click OK.

Now, you should be able to access the servers (e.g. HTTP on 8080) on the guest (if you have configured an HTTP server at that port).

2
  • Two points. 1. I have never needed to use port forwarding in the past. 1. Ping and nmap should be able to find the address of the VM and work with it. The problem seems to be at the hardware address level, rather than at the port level. – Jonathan Sep 19 '20 at 1:46
  • Also I need bridged networking for other reasons, so NAT addressing is not usable. – Jonathan Sep 19 '20 at 1:54
0

It turns out that the problem had nothing to do with the operating system. The web server was coming up on 127.0.0.1 which was not accessible on the network. Changing it to come up on 0.0.0.0 fixed the problem.

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.