I have the IP address for Ubuntu machine, and I want to access the application running on localhost in Ubuntu from my virtual Windows box. Is there a way to do it? Typing the [inet address]:8080 doesn't work.

5 Answers 5


Windows has its "own" localhost, so you have to "help" it find Ubuntu's one.

In your virtual machine, go to this ip and it should work. You can edit windows host file to make localhost point to that ip so you don't have to remember it.

In: C:\Windows\System32\drivers\etc\hosts

Add: localhost
  • Awesome! Works like a charm! Sep 4, 2017 at 4:28

You could set the virtual machine to use a bridged connection. That way the virtual machine will get its own IP-address, and you should be able to connect to the host machine.

  1. Right click on the Virtual Machine (while it is not running)
  2. Choose 'Settings'
  3. Choose 'Network'
  4. Under the 'Adapter 1' tab, set 'Attached to' to 'Bridged Adapter'.
  • This worked like a charm ! Sep 1, 2021 at 20:16

First, make sure the web server process is running. Type localhost:8080 in a browser window on your Ubuntu machine. If you get the page you were expecting proceed to next step, otherwise start the webserver process and retry.

Second, make sure that both machines are on the same sub-network. i.e. something like 192.168.x.y/ and 192.168.x.z/ If not, make necessary adjustments and proceed to next step.

Third, check if a firewall is running on your ubuntu server. If so, check if the desired port is open (8080 in your case). If you do not want to open the port to public access you can configure a rule to accept only traffic from the local sub-net.

Edit: Step 0. Make the settings suggested in the answer by @Eeroz


If you are using Ubuntu you have to first disable your firewall.

sudo ufw disable

Now find your ipv4 address from system settings-> Network and click on arrow of connected wifi to get more information about it.There you will find ipv4 address of your pc. Then you can use localhost of your pc as


Do not forget to enable firewall after completing your work.Use-

sudo ufw enable



If you have determined that it is your firewall, I would advise adding this rule instead of disabling your firewall:

sudo ufw allow 8080

When you are finished you should run:

sudo ufw status numbered

find the numbers in brackets. Say it's [ 1] and [ 3]:

sudo ufw delete 1 3

Then, if you are on virtual box you will navigate to if you have your network set as NAT. You can do this for any port and it will work the same.

Even though this is some extra work, you should never disable your firewall even on a secure network.

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.