8

I've a site running on IIS on a Windows 8 virtual machine.

http://localhost/RTStreamer/Ticker.html

How do I access that site from outside the host machine? The host machine ip is 168.192.42.1

I've already changed the network of the virtual machine to "Bridged Network" but don't know what is the ip and port to access from the host machine network.

4
  • You'd get it the same way you would with ANY Windows machine. One way: type ipconfig /all in a command-line in the VM to get its current IP information. Aug 1, 2014 at 17:44
  • It's not that easy. I've been researching and maybe needing for port forwarding, etc. Why the negative vote?
    – DK39
    Aug 1, 2014 at 18:15
  • What's "not that easy"? What I've suggested is how you get the current IP address from the OS. You only need to forward ports if you have the firewall up, and the only port you'd need to forward for HTTP traffic is the usual port 80. What exactly have you tried already, and what were the results? Aug 1, 2014 at 18:22
  • @DK39, are you clear that you need to get the IP from within the VM and not the host? Once you have that, you'll need to change your URI to point to the IP of the VM. For example, if your VM's IP address is 168.192.42.100, your URI will be 168.168.42.100/REStreamer/Ticker.html. "localhost" should always redirect to the machine on which you requested the address, meaning that if you try to reach localhost on the host, you'll only get the host, not the VM. If you run it on the VM, you'll get the VM, not the host.
    – Ickster
    Aug 1, 2014 at 19:29

4 Answers 4

4

Check your network settings in VirtualBox. By default, NAT is selected.

NAT is fine for most purposes, but to access the services of the guest, you have to forward the ports. There is a button at the bottom of the VirtualBox network settings to configure port forwarding.

Your IIS is serving on port 80. You have to create a rule that forwards from guest port 80 to host port 8080.

Now you can browse to http://localhost:8080 on your host.

1

Make sure you have the firewall configured accordingly to allow HTTP traffic in the virtual machine.

Below is how to enable it in Windows Firewall, I believe it is disabled by default. Windows Firewall HTTP Inbound Traffic

3
  • I've enabled the inbound traffic in the firewall but still cannot access the website on the virtual machine
    – DK39
    Aug 5, 2014 at 13:23
  • I hope you have enabled inbound traffic in Virtual Machine, and accessing the site with URL below! http://<<virtual_machine_IP>>/RTStreamer/Ticker.html Aug 5, 2014 at 15:23
  • Yes, I've done that...
    – DK39
    Aug 5, 2014 at 15:25
0

Ok I got this to work by doing both the port forwarding and firewall rule addition.

Firstly make sure you can hit the website on the guest with the public ip address you discovered by using the console command ipconfig.

Then add a firewall rule for a port and use port 80

Then setup the port forwarding in the virtual box by just specifying the host port as 8080 and the guest port as 80

Then hit the url following url the host http://localhost:8080/{Yoursitename}

0

I feel other responses might like lack a bit in precision so here is my "procedure":

Host: Windows 10 Home

Guest: Windows Server 2022 Standard Evaluation

Configuration in Virtual Box: Bridged Adapter (so guest IP is 192.168.1.5)

Firewall in Host: If you have the same setting as I have (which is default one and allows outbound connection for whatever public/domain/private profile), you shouldn't have to do anything in here: enter image description here

Firewall in Guest: I created an inbound rule for port 8082 specifically (that's the one I chose for my API in Guest). That means that you go:

  • create new rule
  • Step1: choose "port" rule type
  • Step2: Allow the connection
  • step3: Choose a specific port
  • step4: Choose private only (at least for me private was sufficient and seems the only active anyways)
  • step5: name it and you're done

As you see guest will allow connection from any remote port to 8082. If you want to change that, you may have to search what is the source port. I think I tried 80 and 8080 but it still didn't work.

I was then able to call my API from host to guest on IIS: http://192.168.1.5:8082/api/Cards

Some notes:

You must log in to answer this question.

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