I have installed Oracle VM VirtualBox and created a virtual machine running Ubuntu Server 18 LTS. Inside the virtual machine I have download and started Apache Tomcat 9. Now if I launch Firefox from within the virtual machine and type localhost:8080
in the address bar I can see the Tomcat welcome page correctly.
But what if I wanted to view the Tomcat welcome page from the host machine? That is from outside the virtual machine?
0
votes
This isn't really a question about Tomcat but about networking. Are you using NAT or Bridged networking? Bridged networking makes this easy: just use the IP address of the host and not the hostname "localhost". It can be done with NAT but it's more complicated because you need to make sure that a route exists between the guest machine and the host machine that sends the data outside of the NET networking.
– Christopher Schultz
Initially I had one NAT adapter. Then I read a guide suggesting that I add a host only adapter
– nix86
Host-only networking means that the VM is a theoretically inescapable box, network-wise. If you want to get from the VM out to the host, you'll need to use another kind of network adapter.
– Christopher Schultz
You're right. The bridge network is needed.
– nix86