Connect to VirtualBox localhost from Mac host


Nathan Baker

I'm running a .NET server on localhost in a virtual machine VM. I want to access the VM localhost from a browser on a Mac - I'm working on a new javascript client for this project and would like to do this on a Mac.

There are many answers for doing the opposite of the above (that is, connecting from a VM to a Mac localhost), but I couldn't find a good answer for connecting from a host to a VM localhost.

Mac uses 10.1.10.173

$ ifconfig
--> inet 10.1.10.173 ...

The VM uses 10.0.3.15 (found in Network Settings)

I tried using bridged network adapters and NAT with port forwarding. There must be a way to do this - any ideas?

Nathan Baker

Adding (properly configured) port forwarding rules solved the problem.

The VM uses the IP 10.0.2.15and IIS uses port 80 to serve my .NET API. Set new rules as follows:

VM Settings > Network > Adapter 1

Set to NATand Advancedclick Port Forwarding. Add a new rule to forward port 80 from the VM to port 8000 (or whatever port number you want) on the Mac.

Name     Protocol  Host IP  Host Port   Guest IP  Guest Port
Rule 1     TCP    127.0.0.1    8000     10.0.2.15     80

Now I can interact with the application on the VM through the VM using from the Mac localhost:8000/the-app-name.

This is a useful read

Related


Connect to VirtualBox localhost from Mac host

Nathan Baker I'm running a .NET server on localhost in a virtual machine VM. I want to access the VM localhost from a browser on a Mac - I'm working on a new javascript client for this project and would like to do this on a Mac. There are many answers for doin

Access VirtualBox localhost from the host

Shane Bacon I'm connecting to a server via ssh -L 8000:localhost:8000 <hostname>an Ubuntu virtual machine in VirtualBox . In the VM, I can access the server via "localhost:8000" but not from the IP address "192.168.11.175:8000" (I have bridged adapter). I can'

Connect to localhost from Genymotion (Virtualbox)

luigi7up This question has been asked many times, but none of the answers worked for me. A few days ago, my nativescript app (emulated in Genymotion device) could connect to my local Rails server ( localhost:3000 ) perfectly, if I remember correctly using 10.0

Connect to localhost from Genymotion (Virtualbox)

luigi7up This question has been asked many times, but none of the answers worked for me. A few days ago, my nativescript app (emulated in Genymotion device) could connect to my local Rails server ( localhost:3000 ) perfectly, if I remember correctly using 10.0

Connect to host from VirtualBox guest OS?

Naftuli Kay I essentially want to access my host from a guest in VirtualBox. Is there an IP address for my host that I can use from the guest? Are additional steps required to set this up? I want to access the host's Apache, FTP and SSH services. Naftuli Kay T

Connect to host from VirtualBox guest OS?

Naftuli Kay I essentially want to access my host from a guest in VirtualBox. Is there an IP address for my host that I can use from the guest? Are additional steps required to set this up? I want to access the host's Apache, FTP and SSH services. Naftuli Kay T

How to connect to localhost from iPhone on Mac OS

Sarah I read a lot of questions about it and still have the problem. When I use localhost and correct the NSAppTransportSecurity optinos from the emulator , everything is correct. Right now, I'm using my iPhone to debug. Both iPhone and Mac are connected to th

How to connect to localhost from iPhone on Mac OS

Sarah I read a lot of questions about it and still have the problem. When I use localhost and correct the NSAppTransportSecurity optinos from the emulator , everything is correct. Right now, I'm using my iPhone to debug. Both iPhone and Mac are connected to th

How to connect to docker from external host (mac)

web library I am new to Docker. I've got a docker container running with mongo running (using boot2docker) docker run --name some-mongo -p 27017:27017 -d mongo Inside docker: root@8e9b742c127a:/# mongo MongoDB shell version: 3.0.2 connecting to: test Server ha

How to connect to docker from external host (mac)

web library I am new to Docker. I've got a docker container running with mongo running (using boot2docker) docker run --name some-mongo -p 27017:27017 -d mongo Inside docker: root@8e9b742c127a:/# mongo MongoDB shell version: 3.0.2 connecting to: test Server ha

How to connect to docker from external host (mac)

web library I am new to Docker. I've got a docker container running with mongo running (using boot2docker) docker run --name some-mongo -p 27017:27017 -d mongo Inside docker: root@8e9b742c127a:/# mongo MongoDB shell version: 3.0.2 connecting to: test Server ha

How to connect to docker from external host (mac)

web library I am new to Docker. I've got a docker container running with mongo running (using boot2docker) docker run --name some-mongo -p 27017:27017 -d mongo Inside docker: root@8e9b742c127a:/# mongo MongoDB shell version: 3.0.2 connecting to: test Server ha

How to connect to docker from external host (mac)

web library I am new to Docker. I've got a docker container running with mongo running (using boot2docker) docker run --name some-mongo -p 27017:27017 -d mongo Inside docker: root@8e9b742c127a:/# mongo MongoDB shell version: 3.0.2 connecting to: test Server ha

Remote host pingable from Mac but not from Virtualbox VM

Arjun I have a remote that I can ping from the Macbook terminal. However, when I start the VirtualBox Ubuntu 16.04 VM and ping the same remote host, it fails to ping and I get the error "target host unreachable". Also, when I do this, I'm on the company's VPN,

Remote host pingable from Mac but not from Virtualbox VM

Arjun I have a remote that I can ping from the Macbook terminal. However, when I start the VirtualBox Ubuntu 16.04 VM and ping the same remote host, it fails to ping and I get the error "target host unreachable". Also, when I do this, I'm on the company's VPN,

Remote host pingable from Mac but not from Virtualbox VM

Arjun I have a remote that I can ping from the Macbook terminal. However, when I start the VirtualBox Ubuntu 16.04 VM and ping the same remote host, it fails to ping and I get the error "target host unreachable". Also, when I do this, I'm on the company's VPN,

How to access localhost on Virtualbox host

alias body I created a virtual machine on Virtualbox on Ubuntu 12.04 just to install the LAMP solution and use it with the host, but I can't access the localhost using the ip (10.0.2.15) in the browser. Is there any way to solve this problem? username First, y

How to access localhost on Virtualbox host

alias body I created a virtual machine on Virtualbox on Ubuntu 12.04 just to install the LAMP solution and use it with the host, but I can't access the localhost using the ip (10.0.2.15) in the browser. Is there any way to solve this problem? username First, y

How to access localhost on Virtualbox host

alias body I created a virtual machine on Virtualbox on Ubuntu 12.04 just to install the LAMP solution and use it with the host, but I can't access the localhost using the ip (10.0.2.15) in the browser. Is there any way to solve this problem? username First, y

How to connect to host PostgreSQL from idle virtualbox machine

Jorge Arevalo I have a VirtualBox machine running Ubuntu 12.04 on a Mac OS X host. In my host machine (Mac OS X) I have PostgreSQL installed. I want to connect to this PostgreSQL server from my Ubuntu virtual machine (I usually know it's the other way around).

Unable to connect to VirtualBox VM from Kubuntu host using NAT

Gilberts I am using Kubuntu 13 as host and Xubuntu 12 as guest. In the VM network options, I selected NAT, and like 127.0.0.1:23 => 10.0.2.15:22. I can access the internet from the guest, but when I try to SSH to the guest, I get connection refused. Recently I

Connect to VirtualBox machine from host machine using IP address

doron In the Macbook host I run VirtualBox with a guest ubuntu server and NAT network setup. In the virtual machine application "Parallels", I'll get the guest's IP address on the host, which I can later set and access directly. However, I can't find a way to

Connect to VirtualBox machine from host machine using IP address

doron In the Macbook host I run VirtualBox with a guest ubuntu server and NAT network setup. In the virtual machine application "Parallels", I'll get the guest's IP address on the host, which I can later set and access directly. However, I can't find a way to